public class SelectionModel extends Object implements ISelectionModel
SelectionLayer| Modifier and Type | Field and Description |
|---|---|
protected SelectionLayer |
selectionLayer |
| Constructor and Description |
|---|
SelectionModel(SelectionLayer selectionLayer) |
SelectionModel(SelectionLayer selectionLayer,
boolean multipleSelectionAllowed) |
| 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
|
protected boolean |
contains(org.eclipse.swt.graphics.Rectangle containerRectangle,
org.eclipse.swt.graphics.Rectangle rectangle) |
int[] |
getFullySelectedColumnPositions(int columnHeight) |
int[] |
getFullySelectedRowPositions(int rowWidth) |
Class<IStructuralChangeEvent> |
getLayerEventClass() |
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
|
List<org.eclipse.swt.graphics.Rectangle> |
getSelections()
Retrieves the cells that are selected
|
void |
handleLayerEvent(IStructuralChangeEvent event) |
protected Set<Range> |
internalGetSelectedColumnPositions() |
boolean |
isCellPositionSelected(int columnPosition,
int rowPosition)
Determines whether a specified cell is selected
|
boolean |
isColumnPositionFullySelected(int columnPosition,
int columnHeight)
Are all cells in this column selected? Different selection rectangles
might aggregate to cover the entire column.
|
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 |
setClearSelectionOnChange(boolean clearSelectionOnChange) |
void |
setMultipleSelectionAllowed(boolean multipleSelectionAllowed)
Sets whether multiple cells can be selected simultaneously
|
protected void |
sortByX(List<org.eclipse.swt.graphics.Rectangle> selectionRectanglesInRow) |
protected void |
sortByY(List<org.eclipse.swt.graphics.Rectangle> selectionRectanglesInColumn) |
String |
toString() |
protected final SelectionLayer selectionLayer
public SelectionModel(SelectionLayer selectionLayer)
public SelectionModel(SelectionLayer selectionLayer, boolean multipleSelectionAllowed)
public 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 ISelectionModelprotected Set<Range> internalGetSelectedColumnPositions()
public 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 boolean contains(org.eclipse.swt.graphics.Rectangle containerRectangle,
org.eclipse.swt.graphics.Rectangle rectangle)
protected void sortByX(List<org.eclipse.swt.graphics.Rectangle> selectionRectanglesInRow)
protected void sortByY(List<org.eclipse.swt.graphics.Rectangle> selectionRectanglesInColumn)
public void handleLayerEvent(IStructuralChangeEvent event)
handleLayerEvent in interface ILayerEventHandler<IStructuralChangeEvent>public void setClearSelectionOnChange(boolean clearSelectionOnChange)
clearSelectionOnChange - true to simply clear the selection on structural
changes, false to keep the valid selection
(selection of cells that still exist)public Class<IStructuralChangeEvent> getLayerEventClass()
getLayerEventClass in interface ILayerEventHandler<IStructuralChangeEvent>Copyright © 2017. All rights reserved.