Class NoSelectionModel<T>

Type Parameters:
T - the record data type
All Implemented Interfaces:
HasHandlers, ProvidesKey<T>, SelectionChangeEvent.HasSelectionChangedHandlers, SelectionModel<T>

public class NoSelectionModel<T> extends SelectionModel.AbstractSelectionModel<T>
A selection model that does not allow selection, but fires selection change events. Use this model if you want to know when a user selects an item, but do not want the view to update based on the selection.
  • Constructor Details

    • NoSelectionModel

      public NoSelectionModel()
      Constructs a NoSelectionModel without a key provider.
    • NoSelectionModel

      public NoSelectionModel(ProvidesKey<T> keyProvider)
      Constructs a NoSelectionModel with the given key provider.
      Parameters:
      keyProvider - an instance of ProvidesKey, or null if the item should act as its own key
  • Method Details

    • getLastSelectedObject

      public T getLastSelectedObject()
      Gets the item that was last selected.
      Returns:
      the last selected item
    • isSelected

      public boolean isSelected(T item)
      Description copied from interface: SelectionModel
      Check if an object is selected.
      Parameters:
      item - the object
      Returns:
      true if selected, false if not
    • setSelected

      public void setSelected(T item, boolean selected)
      Description copied from interface: SelectionModel
      Set the selected state of an object and fire a SelectionChangeEvent if the selection has changed. Subclasses should not fire an event in the case where selected is true and the object was already selected, or selected is false and the object was not previously selected.
      Parameters:
      item - the object to select or deselect
      selected - true to select, false to deselect