public class SelectionLayer extends AbstractIndexLayerTransform
ISelectionModel
to track the selection state.Modifier and Type | Class and Description |
---|---|
static class |
SelectionLayer.MoveDirectionEnum |
Modifier and Type | Field and Description |
---|---|
protected PositionCoordinate |
lastSelectedCell |
protected org.eclipse.swt.graphics.Rectangle |
lastSelectedRegion |
static int |
MOVE_ALL |
static int |
NO_SELECTION |
protected PositionCoordinate |
selectionAnchor |
protected ISelectionModel |
selectionModel |
protected IUniqueIndexLayer |
underlyingLayer |
layerPainter
DOT, VALUE_SEPARATOR
Constructor and Description |
---|
SelectionLayer(IUniqueIndexLayer underlyingLayer) |
SelectionLayer(IUniqueIndexLayer underlyingLayer,
boolean useDefaultConfiguration) |
SelectionLayer(IUniqueIndexLayer underlyingLayer,
ISelectionModel selectionModel,
boolean useDefaultConfiguration) |
SelectionLayer(IUniqueIndexLayer underlyingLayer,
ISelectionModel selectionModel,
boolean useDefaultConfiguration,
boolean registerDefaultEventHandler) |
Modifier and Type | Method and Description |
---|---|
void |
addSelection(org.eclipse.swt.graphics.Rectangle selection) |
void |
clear() |
void |
clear(boolean fireSelectionEvent) |
void |
clearSelection(int columnPosition,
int rowPosition) |
void |
clearSelection(org.eclipse.swt.graphics.Rectangle selection) |
boolean |
doCommand(ILayerCommand command)
Opportunity to respond to a command as it flows down the stack.
|
void |
fireCellSelectionEvent(int columnPosition,
int rowPosition,
boolean forcingEntireCellIntoViewport,
boolean withShiftMask,
boolean withControlMask) |
protected PositionCoordinate |
getCellPositionToMoveFrom(boolean withShiftMask,
boolean withControlMask)
When extending a selected area we need to start adding cells from the last selected cell.
|
LabelStack |
getConfigLabelsByPosition(int columnPosition,
int rowPosition) |
String |
getDisplayModeByPosition(int columnPosition,
int rowPosition) |
int[] |
getFullySelectedColumnPositions() |
int[] |
getFullySelectedRowPositions() |
PositionCoordinate |
getLastSelectedCellPosition() |
org.eclipse.swt.graphics.Rectangle |
getLastSelectedRegion() |
ILayerPainter |
getLayerPainter() |
PositionCoordinate[] |
getSelectedCellPositions() |
int[] |
getSelectedColumnPositions() |
int |
getSelectedRowCount() |
Set<Range> |
getSelectedRowPositions() |
PositionCoordinate |
getSelectionAnchor() |
ISelectionModel |
getSelectionModel() |
protected boolean |
handleColumnHideCommand(ColumnHideCommand command)
Will check if there are fully selected column positions.
|
protected boolean |
handleColumnResizeCommand(ColumnResizeCommand command)
Will check if there are fully selected column positions.
|
protected boolean |
handleMultiColumnHideCommand(MultiColumnHideCommand command)
Previous to processing the given
MultiColumnHideCommand down the layer stack, the
fully selected column positions selection state will be cleared. |
protected boolean |
handleMultiRowHideCommand(MultiRowHideCommand command)
Previous to processing the given
MultiRowHideCommand down the layer stack, the
fully selected row positions selection state will be cleared. |
protected boolean |
handleRowHideCommand(RowHideCommand command)
Will check if there are fully selected row positions.
|
protected boolean |
handleRowResizeCommand(RowResizeCommand command)
Will check if there are fully selected row positions.
|
boolean |
hasColumnSelection() |
boolean |
hasRowSelection() |
boolean |
isCellPositionSelected(int columnPosition,
int rowPosition) |
boolean |
isColumnPositionFullySelected(int columnPosition) |
boolean |
isColumnPositionSelected(int columnPosition) |
boolean |
isRowPositionFullySelected(int rowPosition) |
boolean |
isRowPositionSelected(int rowPosition) |
void |
moveSelectionAnchor(int startColumnPositionInRegion,
int startRowPosition) |
protected void |
registerCommandHandlers()
Layers should use this method to register their command handlers
and call it from their constructor.
|
void |
selectAll() |
void |
selectCell(int columnPosition,
int rowPosition,
boolean withShiftMask,
boolean withControlMask)
Calculates the selected cells - taking into account Shift and Ctrl key presses.
|
void |
selectColumn(int columnPosition,
int rowPosition,
boolean withShiftMask,
boolean withControlMask) |
void |
selectRegion(int startColumnPosition,
int startRowPosition,
int regionWidth,
int regionHeight) |
void |
selectRow(int columnPosition,
int rowPosition,
boolean withShiftMask,
boolean withControlMask) |
void |
setLastSelectedCell(int columnPosition,
int rowPosition) |
void |
setSelectedCell(int columnPosition,
int rowPosition) |
void |
setSelectionModel(ISelectionModel selectionModel) |
configure, dispose, getCellByPosition, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByIndex, getColumnPositionByX, getColumnWidthByPosition, getDataValueByPosition, getHeight, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByIndex, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterPersistable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLayerListener, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, hasLayerListener, registerCommandHandler, registerPersistable, removeLayerListener, unregisterCommandHandler, unregisterPersistable
handleLayerEvent
public static final int MOVE_ALL
public static final int NO_SELECTION
protected ISelectionModel selectionModel
protected IUniqueIndexLayer underlyingLayer
protected final PositionCoordinate lastSelectedCell
protected final PositionCoordinate selectionAnchor
protected org.eclipse.swt.graphics.Rectangle lastSelectedRegion
public SelectionLayer(IUniqueIndexLayer underlyingLayer)
public SelectionLayer(IUniqueIndexLayer underlyingLayer, boolean useDefaultConfiguration)
public SelectionLayer(IUniqueIndexLayer underlyingLayer, ISelectionModel selectionModel, boolean useDefaultConfiguration)
public SelectionLayer(IUniqueIndexLayer underlyingLayer, ISelectionModel selectionModel, boolean useDefaultConfiguration, boolean registerDefaultEventHandler)
public ISelectionModel getSelectionModel()
public void setSelectionModel(ISelectionModel selectionModel)
public ILayerPainter getLayerPainter()
getLayerPainter
in interface ILayer
getLayerPainter
in class AbstractIndexLayerTransform
ILayerPainter
. Defaults to GridLineCellLayerPainter
public void addSelection(org.eclipse.swt.graphics.Rectangle selection)
public void clear()
public void clear(boolean fireSelectionEvent)
public void clearSelection(int columnPosition, int rowPosition)
public void clearSelection(org.eclipse.swt.graphics.Rectangle selection)
public void selectAll()
public boolean isCellPositionSelected(int columnPosition, int rowPosition)
public void setSelectedCell(int columnPosition, int rowPosition)
protected PositionCoordinate getCellPositionToMoveFrom(boolean withShiftMask, boolean withControlMask)
public PositionCoordinate[] getSelectedCellPositions()
public void selectCell(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask)
public void selectRegion(int startColumnPosition, int startRowPosition, int regionWidth, int regionHeight)
public PositionCoordinate getSelectionAnchor()
public void moveSelectionAnchor(int startColumnPositionInRegion, int startRowPosition)
public PositionCoordinate getLastSelectedCellPosition()
public void setLastSelectedCell(int columnPosition, int rowPosition)
public org.eclipse.swt.graphics.Rectangle getLastSelectedRegion()
public boolean hasColumnSelection()
public int[] getSelectedColumnPositions()
public boolean isColumnPositionSelected(int columnPosition)
public int[] getFullySelectedColumnPositions()
public boolean isColumnPositionFullySelected(int columnPosition)
public void selectColumn(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask)
public boolean hasRowSelection()
public int getSelectedRowCount()
public boolean isRowPositionSelected(int rowPosition)
public int[] getFullySelectedRowPositions()
public boolean isRowPositionFullySelected(int rowPosition)
public void selectRow(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask)
public String getDisplayModeByPosition(int columnPosition, int rowPosition)
getDisplayModeByPosition
in interface ILayer
getDisplayModeByPosition
in class AbstractIndexLayerTransform
columnPosition
- the column position of the cellrowPosition
- the row position of the cellDisplayMode
for the cell at the given position.
The DisplayMode
affects the settings out of the ConfigRegistry
.
Display mode is NORMAL by default.
Example: SelectionLayer
overrides this to return the SELECT
label for cells which are selected.
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
getConfigLabelsByPosition
in interface ILayer
getConfigLabelsByPosition
in class AbstractIndexLayerTransform
protected void registerCommandHandlers()
AbstractLayer
registerCommandHandlers
in class AbstractLayer
public boolean doCommand(ILayerCommand command)
ILayer
ILayerCommand.convertToTargetLayer(ILayer)
doCommand
in interface ILayer
doCommand
in class AbstractIndexLayerTransform
command
- the command to performpublic void fireCellSelectionEvent(int columnPosition, int rowPosition, boolean forcingEntireCellIntoViewport, boolean withShiftMask, boolean withControlMask)
protected boolean handleColumnHideCommand(ColumnHideCommand command)
ColumnHideCommand
will be consumed and a
MultiColumnHideCommand
will be created and executed further down the layer stack,
that contains all fully selected column positions. Otherwise the given command will be
executed further.ColumnHideCommand
is aware of the presence of the SelectionLayer
.
Without this transformation, only the column on which the action was called will be hidden instead
of all selected ones.command
- The ColumnHideCommand
to processtrue
if the command has been handled, false
otherwiseprotected boolean handleMultiColumnHideCommand(MultiColumnHideCommand command)
MultiColumnHideCommand
down the layer stack, the
fully selected column positions selection state will be cleared. This is necessary so the
selection also disappears for the selected columns. Otherwise after hiding the selection
will be showed for different columns.command
- The MultiColumnHideCommand
to processtrue
if the command has been handled, false
otherwiseprotected boolean handleRowHideCommand(RowHideCommand command)
RowHideCommand
will be consumed and a
MultiRowHideCommand
will be created and executed further down the layer stack,
that contains all fully selected row positions. Otherwise the given command will be
executed further.RowHideCommand
is aware of the presence of the SelectionLayer
.
Without this transformation, only the row on which the action was called will be hidden instead
of all selected ones.command
- The RowHideCommand
to processtrue
if the command has been handled, false
otherwiseprotected boolean handleMultiRowHideCommand(MultiRowHideCommand command)
MultiRowHideCommand
down the layer stack, the
fully selected row positions selection state will be cleared. This is necessary so the
selection also disappears for the selected rows. Otherwise after hiding the selection
will be showed for different rows.command
- The MultiRowHideCommand
to processtrue
if the command has been handled, false
otherwiseprotected boolean handleColumnResizeCommand(ColumnResizeCommand command)
ColumnResizeCommand
will be consumed and a
MultiColumnResizeCommand
will be created and executed further down the layer stack,
that contains all fully selected column positions. Otherwise the given command will be
executed further.SelectionLayer
. Without this transformation, only the column on which the action was
called will be resized instead of all selected ones.command
- The ColumnResizeCommand
to processtrue
if the command has been handled, false
otherwiseprotected boolean handleRowResizeCommand(RowResizeCommand command)
RowResizeCommand
will be consumed and a
MultiRowResizeCommand
will be created and executed further down the layer stack,
that contains all fully selected row positions. Otherwise the given command will be
executed further.SelectionLayer
. Without this transformation, only the row on which the action was
called will be resized instead of all selected ones.command
- The RowResizeCommand
to processtrue
if the command has been handled, false
otherwiseCopyright © 2013. All Rights Reserved.