Class RowSelectionModel<R>
java.lang.Object
org.eclipse.nebula.widgets.nattable.selection.RowSelectionModel<R>
- All Implemented Interfaces:
ILayerEventHandler<IStructuralChangeEvent>
,IRowSelectionModel<R>
,ISelectionModel
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.eclipse.swt.graphics.Rectangle
*live* reference to last range parameter used in addSelection(range)protected Set<Serializable>
protected final IRowDataProvider<R>
protected final IRowIdAccessor<R>
protected Map<Serializable,
R> protected final SelectionLayer
protected final ReadWriteLock
-
Constructor Summary
ConstructorDescriptionRowSelectionModel
(SelectionLayer selectionLayer, IRowDataProvider<R> rowDataProvider, IRowIdAccessor<R> rowIdAccessor) RowSelectionModel
(SelectionLayer selectionLayer, IRowDataProvider<R> rowDataProvider, IRowIdAccessor<R> rowIdAccessor, boolean multipleSelectionAllowed) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSelection
(int columnPosition, int rowPosition) Selects a specified cellvoid
addSelection
(org.eclipse.swt.graphics.Rectangle range) Selects the cells of a specified areavoid
Removes all cell selectionsvoid
clearSelection
(int columnPosition, int rowPosition) Deselects a specified cellvoid
clearSelection
(org.eclipse.swt.graphics.Rectangle removedSelection) Removes the selection of specified cellsvoid
clearSelection
(R rowObject) Removes the selected row object from the selectionint[]
getFullySelectedColumnPositions
(int fullySelectedColumnRowCount) int[]
getFullySelectedRowPositions
(int rowWidth) int[]
Retrieves the columns that have any selected cellsint
Retrieves the number of rows that have any selected cellExpose the underlying row objectsRetrieves the rows with a valid row position that have any selected cellsList<org.eclipse.swt.graphics.Rectangle>
Retrieves the cells that are selectedvoid
boolean
isCellPositionSelected
(int columnPosition, int rowPosition) Determines whether a specified cell is selectedboolean
isColumnPositionFullySelected
(int columnPosition, int fullySelectedColumnRowCount) boolean
isColumnPositionSelected
(int columnPosition) Determines whether a specified column contains any selected cellboolean
isEmpty()
Determines whether there are any selected cellsboolean
Determines whether multiple cells can be selected simultaneouslyboolean
isRowPositionFullySelected
(int rowPosition, int rowWidth) Check if all cells in a row are selected, which means the row is fully selected.boolean
isRowPositionSelected
(int rowPosition) Determines whether a specified row contains any selected cellvoid
setMultipleSelectionAllowed
(boolean multipleSelectionAllowed) Sets whether multiple cells can be selected simultaneously
-
Field Details
-
selectionLayer
-
rowDataProvider
-
rowIdAccessor
-
selectedRows
-
lastSelectedRange
protected org.eclipse.swt.graphics.Rectangle lastSelectedRange*live* reference to last range parameter used in addSelection(range) -
lastSelectedRowIds
-
selectionsLock
-
-
Constructor Details
-
RowSelectionModel
public RowSelectionModel(SelectionLayer selectionLayer, IRowDataProvider<R> rowDataProvider, IRowIdAccessor<R> rowIdAccessor) -
RowSelectionModel
public RowSelectionModel(SelectionLayer selectionLayer, IRowDataProvider<R> rowDataProvider, IRowIdAccessor<R> rowIdAccessor, boolean multipleSelectionAllowed)
-
-
Method Details
-
isMultipleSelectionAllowed
public boolean isMultipleSelectionAllowed()Description copied from interface:ISelectionModel
Determines whether multiple cells can be selected simultaneously- Specified by:
isMultipleSelectionAllowed
in interfaceISelectionModel
- 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 interfaceISelectionModel
- 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 interfaceISelectionModel
- Parameters:
columnPosition
- column position of the cell to selectrowPosition
- 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 interfaceISelectionModel
- 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 interfaceISelectionModel
-
clearSelection
public void clearSelection(int columnPosition, int rowPosition) Description copied from interface:ISelectionModel
Deselects a specified cell- Specified by:
clearSelection
in interfaceISelectionModel
- Parameters:
columnPosition
- column position of the cell to deselectrowPosition
- 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 interfaceISelectionModel
- Parameters:
removedSelection
- the position based area to deselect
-
clearSelection
Description copied from interface:IRowSelectionModel
Removes the selected row object from the selection- Specified by:
clearSelection
in interfaceIRowSelectionModel<R>
-
isEmpty
public boolean isEmpty()Description copied from interface:ISelectionModel
Determines whether there are any selected cells- Specified by:
isEmpty
in interfaceISelectionModel
- Returns:
- whether there are any selected cells
-
getSelections
Description copied from interface:ISelectionModel
Retrieves the cells that are selected- Specified by:
getSelections
in interfaceISelectionModel
- 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 interfaceISelectionModel
- Parameters:
columnPosition
- column position of the cell to inspectrowPosition
- 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 interfaceISelectionModel
- 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 interfaceISelectionModel
- 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 interfaceISelectionModel
- Parameters:
fullySelectedColumnRowCount
- the number of rows in a fully selected column
-
isColumnPositionFullySelected
public boolean isColumnPositionFullySelected(int columnPosition, int fullySelectedColumnRowCount) - Specified by:
isColumnPositionFullySelected
in interfaceISelectionModel
fullySelectedColumnRowCount
- the number of rows in a fully selected column
-
getSelectedRowObjects
Description copied from interface:IRowSelectionModel
Expose the underlying row objects- Specified by:
getSelectedRowObjects
in interfaceIRowSelectionModel<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 interfaceISelectionModel
- Returns:
- the number of rows that have any selected cell
-
getSelectedRowPositions
Description copied from interface:ISelectionModel
Retrieves the rows with a valid row position that have any selected cells- Specified by:
getSelectedRowPositions
in interfaceISelectionModel
- 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 interfaceISelectionModel
- 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 interfaceISelectionModel
- 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 interfaceISelectionModel
- 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
- Specified by:
handleLayerEvent
in interfaceILayerEventHandler<R>
-
getLayerEventClass
- Specified by:
getLayerEventClass
in interfaceILayerEventHandler<R>
-