Class ListUtils.ListModel<E>

java.lang.Object
org.luwrain.controls.ListUtils.ListModel<E>
All Implemented Interfaces:
ListArea.Model<E>
Direct Known Subclasses:
TreeListArea.ModelImpl
Enclosing class:
ListUtils

public static class ListUtils.ListModel<E> extends Object implements ListArea.Model<E>
  • Field Details

    • source

      protected final List<E> source
  • Constructor Details

    • ListModel

      public ListModel(List<E> source)
  • Method Details

    • getItemCount

      public int getItemCount()
      Description copied from interface: ListArea.Model
      Returns the total number of items in the model.
      Specified by:
      getItemCount in interface ListArea.Model<E>
      Returns:
      the item count
    • getItem

      public E getItem(int index)
      Description copied from interface: ListArea.Model
      Returns the item at the given index.
      Specified by:
      getItem in interface ListArea.Model<E>
      Parameters:
      index - the zero-based index of the item
      Returns:
      the item at that position, or null if the index is out of bounds
    • refresh

      public void refresh()
      Description copied from interface: ListArea.Model
      Called when the underlying data has changed and the list needs to be refreshed. Implementations should reload or update their data.
      Specified by:
      refresh in interface ListArea.Model<E>