Class RowSelectionModel<R>

java.lang.Object
org.eclipse.nebula.widgets.nattable.selection.RowSelectionModel<R>
All Implemented Interfaces:
ILayerEventHandler<IStructuralChangeEvent>, IRowSelectionModel<R>, ISelectionModel

public class RowSelectionModel<R> extends Object implements IRowSelectionModel<R>
  • Field Details

    • selectionLayer

      protected final SelectionLayer selectionLayer
    • rowDataProvider

      protected final IRowDataProvider<R> rowDataProvider
    • rowIdAccessor

      protected final IRowIdAccessor<R> rowIdAccessor
    • selectedRows

      protected Map<Serializable,R> selectedRows
    • lastSelectedRange

      protected org.eclipse.swt.graphics.Rectangle lastSelectedRange
      *live* reference to last range parameter used in addSelection(range)
    • lastSelectedRowIds

      protected Set<Serializable> lastSelectedRowIds
    • selectionsLock

      protected final ReadWriteLock selectionsLock
  • Constructor Details

  • Method Details

    • isMultipleSelectionAllowed

      public boolean isMultipleSelectionAllowed()
      Description copied from interface: ISelectionModel
      Determines whether multiple cells can be selected simultaneously
      Specified by:
      isMultipleSelectionAllowed in interface ISelectionModel
      Returns:
      whether multiple cells can be selected simultaneously
    • setMultipleSelectionAllowed

      public void setMultipleSelectionAllowed(boolean multipleSelectionAllowed)
      Description copied from interface: ISelectionModel
      Sets whether multiple cells can be selected simultaneously
      Specified by:
      setMultipleSelectionAllowed in interface ISelectionModel
      Parameters:
      multipleSelectionAllowed - whether multiple cells can be selected simultaneously
    • addSelection

      public void addSelection(int columnPosition, int rowPosition)
      Description copied from interface: ISelectionModel
      Selects a specified cell
      Specified by:
      addSelection in interface ISelectionModel
      Parameters:
      columnPosition - column position of the cell to select
      rowPosition - row position of the cell to select
    • addSelection

      public void addSelection(org.eclipse.swt.graphics.Rectangle range)
      Description copied from interface: ISelectionModel
      Selects the cells of a specified area
      Specified by:
      addSelection in interface ISelectionModel
      Parameters:
      range - the position based area to select
    • clearSelection

      public void clearSelection()
      Description copied from interface: ISelectionModel
      Removes all cell selections
      Specified by:
      clearSelection in interface ISelectionModel
    • clearSelection

      public void clearSelection(int columnPosition, int rowPosition)
      Description copied from interface: ISelectionModel
      Deselects a specified cell
      Specified by:
      clearSelection in interface ISelectionModel
      Parameters:
      columnPosition - column position of the cell to deselect
      rowPosition - row position of the cell to deselect
    • clearSelection

      public void clearSelection(org.eclipse.swt.graphics.Rectangle removedSelection)
      Description copied from interface: ISelectionModel
      Removes the selection of specified cells
      Specified by:
      clearSelection in interface ISelectionModel
      Parameters:
      removedSelection - the position based area to deselect
    • clearSelection

      public void clearSelection(R rowObject)
      Description copied from interface: IRowSelectionModel
      Removes the selected row object from the selection
      Specified by:
      clearSelection in interface IRowSelectionModel<R>
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: ISelectionModel
      Determines whether there are any selected cells
      Specified by:
      isEmpty in interface ISelectionModel
      Returns:
      whether there are any selected cells
    • getSelections

      public List<org.eclipse.swt.graphics.Rectangle> getSelections()
      Description copied from interface: ISelectionModel
      Retrieves the cells that are selected
      Specified by:
      getSelections in interface ISelectionModel
      Returns:
      the cells that are selected, expressed in position coordinates
    • isCellPositionSelected

      public boolean isCellPositionSelected(int columnPosition, int rowPosition)
      Description copied from interface: ISelectionModel
      Determines whether a specified cell is selected
      Specified by:
      isCellPositionSelected in interface ISelectionModel
      Parameters:
      columnPosition - column position of the cell to inspect
      rowPosition - row position of the cell to inspect
      Returns:
      whether the specified cell is selected
    • getSelectedColumnPositions

      public int[] getSelectedColumnPositions()
      Description copied from interface: ISelectionModel
      Retrieves the columns that have any selected cells
      Specified by:
      getSelectedColumnPositions in interface ISelectionModel
      Returns:
      the column positions that have any selected cells
    • isColumnPositionSelected

      public boolean isColumnPositionSelected(int columnPosition)
      Description copied from interface: ISelectionModel
      Determines whether a specified column contains any selected cell
      Specified by:
      isColumnPositionSelected in interface ISelectionModel
      Parameters:
      columnPosition - column position to inspect
      Returns:
      whether the specified column contains any selected cell
    • getFullySelectedColumnPositions

      public int[] getFullySelectedColumnPositions(int fullySelectedColumnRowCount)
      Specified by:
      getFullySelectedColumnPositions in interface ISelectionModel
      Parameters:
      fullySelectedColumnRowCount - the number of rows in a fully selected column
    • isColumnPositionFullySelected

      public boolean isColumnPositionFullySelected(int columnPosition, int fullySelectedColumnRowCount)
      Specified by:
      isColumnPositionFullySelected in interface ISelectionModel
      fullySelectedColumnRowCount - the number of rows in a fully selected column
    • getSelectedRowObjects

      public List<R> getSelectedRowObjects()
      Description copied from interface: IRowSelectionModel
      Expose the underlying row objects
      Specified by:
      getSelectedRowObjects in interface IRowSelectionModel<R>
      Returns:
      The selected row objects.
    • getSelectedRowCount

      public int getSelectedRowCount()
      Description copied from interface: ISelectionModel
      Retrieves the number of rows that have any selected cell
      Specified by:
      getSelectedRowCount in interface ISelectionModel
      Returns:
      the number of rows that have any selected cell
    • getSelectedRowPositions

      public Set<Range> getSelectedRowPositions()
      Description copied from interface: ISelectionModel
      Retrieves the rows with a valid row position that have any selected cells
      Specified by:
      getSelectedRowPositions in interface ISelectionModel
      Returns:
      the row positions with a valid row position that have any selected cells
    • isRowPositionSelected

      public boolean isRowPositionSelected(int rowPosition)
      Description copied from interface: ISelectionModel
      Determines whether a specified row contains any selected cell
      Specified by:
      isRowPositionSelected in interface ISelectionModel
      Parameters:
      rowPosition - row position to inspect
      Returns:
      whether the specified row contains any selected cell
    • getFullySelectedRowPositions

      public int[] getFullySelectedRowPositions(int rowWidth)
      Specified by:
      getFullySelectedRowPositions in interface ISelectionModel
      Parameters:
      rowWidth - the number of columns in a fully selected row
    • isRowPositionFullySelected

      public boolean isRowPositionFullySelected(int rowPosition, int rowWidth)
      Description copied from interface: ISelectionModel
      Check if all cells in a row are selected, which means the row is fully selected.
      Specified by:
      isRowPositionFullySelected in interface ISelectionModel
      Parameters:
      rowPosition - The row position that should be checked.
      rowWidth - The number of columns in the row which is needed to determine if the all cells in a row are selected.
      Returns:
      true if all cells in a row are selected, false if not
    • handleLayerEvent

      public void handleLayerEvent(IStructuralChangeEvent event)
      Specified by:
      handleLayerEvent in interface ILayerEventHandler<R>
    • getLayerEventClass

      public Class<IStructuralChangeEvent> getLayerEventClass()
      Specified by:
      getLayerEventClass in interface ILayerEventHandler<R>