T - the type of object underlying each rowpublic class PreserveSelectionModel<T> extends Object implements IMarkerSelectionModel
| Modifier and Type | Field and Description |
|---|---|
protected IUniqueIndexLayer |
selectionLayer
Provider of cell information.
|
| Constructor and Description |
|---|
PreserveSelectionModel(IUniqueIndexLayer selectionLayer,
IRowDataProvider<T> rowDataProvider,
IRowIdAccessor<T> rowIdAccessor)
Creates a row sortable selection model
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSelection(int columnPosition,
int rowPosition)
Selects a specified cell
|
void |
addSelection(org.eclipse.swt.graphics.Rectangle range)
Selects the cells of a specified area
|
void |
clearSelection()
Removes all cell selections
|
void |
clearSelection(int columnPosition,
int rowPosition)
Deselects a specified cell
|
void |
clearSelection(org.eclipse.swt.graphics.Rectangle removedSelection)
Removes the selection of specified cells
|
int[] |
getFullySelectedColumnPositions(int columnHeight) |
int[] |
getFullySelectedRowPositions(int rowWidth) |
org.eclipse.swt.graphics.Point |
getLastSelectedCell() |
org.eclipse.swt.graphics.Rectangle |
getLastSelectedRegion() |
Class<IStructuralChangeEvent> |
getLayerEventClass() |
protected Serializable |
getRowIdByPosition(int rowPosition)
Retrieves the row ID for a row position
|
protected int |
getRowPositionByRowObject(T rowObject)
Retrieves the row position for a row object
|
int[] |
getSelectedColumnPositions()
Retrieves the columns that have any selected cells
|
int |
getSelectedRowCount()
Retrieves the number of rows that have any selected cell
|
Set<Range> |
getSelectedRowPositions()
Retrieves the rows with a valid row position that have any selected cells
|
org.eclipse.swt.graphics.Point |
getSelectionAnchor() |
List<org.eclipse.swt.graphics.Rectangle> |
getSelections()
Retrieves the cells that are selected
|
void |
handleLayerEvent(IStructuralChangeEvent event) |
protected boolean |
ignoreVerticalChange(org.eclipse.nebula.widgets.nattable.selection.preserve.Selections.Row<T> row)
Check if the default handling for vertical structure changes should be
performed for the given
Selections.Row, or if it should be skipped. |
boolean |
isCellPositionSelected(int columnPosition,
int rowPosition)
Determines whether a specified cell is selected
|
boolean |
isColumnPositionFullySelected(int columnPosition,
int columnHeight) |
boolean |
isColumnPositionSelected(int columnPosition)
Determines whether a specified column contains any selected cell
|
boolean |
isEmpty()
Determines whether there are any selected cells
|
boolean |
isMultipleSelectionAllowed()
Determines whether multiple cells can be selected simultaneously
|
boolean |
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 cell
|
void |
setLastSelectedCell(org.eclipse.swt.graphics.Point coordinate) |
void |
setLastSelectedRegion(int x,
int y,
int width,
int height)
Will copy the information of the parameters to the already existing
Rectangle object of last selected region.
|
void |
setLastSelectedRegion(org.eclipse.swt.graphics.Rectangle region)
Will set the Rectangle object of the last selected region to be the same
as the parameter object region.
|
void |
setMultipleSelectionAllowed(boolean multipleSelectionAllowed)
Sets whether multiple cells can be selected simultaneously
|
void |
setSelectionAnchor(org.eclipse.swt.graphics.Point coordinate) |
protected final IUniqueIndexLayer selectionLayer
public PreserveSelectionModel(IUniqueIndexLayer selectionLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor)
selectionLayer - provider of cell informationrowDataProvider - provider of underlying row objectsrowIdAccessor - provider of unique IDs for the rowspublic boolean isMultipleSelectionAllowed()
ISelectionModelisMultipleSelectionAllowed in interface ISelectionModelpublic void setMultipleSelectionAllowed(boolean multipleSelectionAllowed)
ISelectionModelsetMultipleSelectionAllowed in interface ISelectionModelmultipleSelectionAllowed - whether multiple cells can be selected simultaneouslypublic void addSelection(int columnPosition,
int rowPosition)
ISelectionModeladdSelection in interface ISelectionModelcolumnPosition - column position of the cell to selectrowPosition - row position of the cell to selectpublic void addSelection(org.eclipse.swt.graphics.Rectangle range)
ISelectionModeladdSelection in interface ISelectionModelrange - the position based area to selectpublic void clearSelection()
ISelectionModelclearSelection in interface ISelectionModelpublic void clearSelection(int columnPosition,
int rowPosition)
ISelectionModelclearSelection in interface ISelectionModelcolumnPosition - column position of the cell to deselectrowPosition - row position of the cell to deselectpublic void clearSelection(org.eclipse.swt.graphics.Rectangle removedSelection)
ISelectionModelclearSelection in interface ISelectionModelremovedSelection - the position based area to deselectpublic boolean isEmpty()
ISelectionModelisEmpty in interface ISelectionModelpublic List<org.eclipse.swt.graphics.Rectangle> getSelections()
ISelectionModelgetSelections in interface ISelectionModelpublic boolean isCellPositionSelected(int columnPosition,
int rowPosition)
ISelectionModelisCellPositionSelected in interface ISelectionModelcolumnPosition - column position of the cell to inspectrowPosition - row position of the cell to inspectpublic int[] getSelectedColumnPositions()
ISelectionModelgetSelectedColumnPositions in interface ISelectionModelpublic boolean isColumnPositionSelected(int columnPosition)
ISelectionModelisColumnPositionSelected in interface ISelectionModelcolumnPosition - column position to inspectpublic int[] getFullySelectedColumnPositions(int columnHeight)
getFullySelectedColumnPositions in interface ISelectionModelcolumnHeight - the number of rows in a fully selected columnpublic boolean isColumnPositionFullySelected(int columnPosition,
int columnHeight)
isColumnPositionFullySelected in interface ISelectionModelcolumnHeight - the number of rows in a fully selected columnpublic int getSelectedRowCount()
ISelectionModelgetSelectedRowCount in interface ISelectionModelpublic Set<Range> getSelectedRowPositions()
ISelectionModelgetSelectedRowPositions in interface ISelectionModelpublic boolean isRowPositionSelected(int rowPosition)
ISelectionModelisRowPositionSelected in interface ISelectionModelrowPosition - row position to inspectpublic int[] getFullySelectedRowPositions(int rowWidth)
getFullySelectedRowPositions in interface ISelectionModelrowWidth - the number of columns in a fully selected rowpublic boolean isRowPositionFullySelected(int rowPosition,
int rowWidth)
ISelectionModelisRowPositionFullySelected in interface ISelectionModelrowPosition - 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.true if all cells in a row are selected,
false if notprotected Serializable getRowIdByPosition(int rowPosition)
rowPosition - row position for retrieving row IDprotected int getRowPositionByRowObject(T rowObject)
rowObject - row object for retrieving row positionpublic org.eclipse.swt.graphics.Point getSelectionAnchor()
getSelectionAnchor in interface IMarkerSelectionModelpublic org.eclipse.swt.graphics.Point getLastSelectedCell()
getLastSelectedCell in interface IMarkerSelectionModelpublic org.eclipse.swt.graphics.Rectangle getLastSelectedRegion()
getLastSelectedRegion in interface IMarkerSelectionModelpublic void setSelectionAnchor(org.eclipse.swt.graphics.Point coordinate)
setSelectionAnchor in interface IMarkerSelectionModelcoordinate - coordinate of the anchorpublic void setLastSelectedCell(org.eclipse.swt.graphics.Point coordinate)
setLastSelectedCell in interface IMarkerSelectionModelcoordinate - coordinate of the last selectedpublic void setLastSelectedRegion(org.eclipse.swt.graphics.Rectangle region)
IMarkerSelectionModelsetLastSelectedRegion in interface IMarkerSelectionModelregion - the last selection position regionpublic void setLastSelectedRegion(int x,
int y,
int width,
int height)
IMarkerSelectionModelsetLastSelectedRegion in interface IMarkerSelectionModelx - origin of the last selection position regiony - origin of the last selection position regionwidth - of the last selection position regionheight - of the last selection position regionpublic void handleLayerEvent(IStructuralChangeEvent event)
handleLayerEvent in interface ILayerEventHandler<IStructuralChangeEvent>protected boolean ignoreVerticalChange(org.eclipse.nebula.widgets.nattable.selection.preserve.Selections.Row<T> row)
Selections.Row, or if it should be skipped. Skipping
for example would make sense for selections that are stored for rows that
have no row data in the backing data structure, e.g. a summary row
selection.row - The internal selected row representation.false if the default handling for vertical changes
should be performed, true if the default handling
should be skipped.public Class<IStructuralChangeEvent> getLayerEventClass()
getLayerEventClass in interface ILayerEventHandler<IStructuralChangeEvent>Copyright © 2019. All rights reserved.