Class ColumnGroupReorderLayer
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
-
- org.eclipse.nebula.widgets.nattable.group.ColumnGroupReorderLayer
-
- All Implemented Interfaces:
ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
public class ColumnGroupReorderLayer extends AbstractLayerTransform implements IUniqueIndexLayer
Adds functionality allowing the reordering of the the column groups.
-
-
Field Summary
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
underlyingLayer
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainter
-
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description ColumnGroupReorderLayer(IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Integer>
getColumnGroupPositions(int fromColumnIndex)
protected int[]
getColumnIndexesForPositions(List<Integer> fromColumnPositions)
Transforms the given collection of column positions to an array of column indexes.int
getColumnPositionByIndex(int columnIndex)
ColumnGroupModel
getModel()
int
getReorderFromColumnPosition()
Used to support column reordering via drag and drop.int
getRowPositionByIndex(int rowIndex)
IUniqueIndexLayer
getUnderlyingLayer()
protected void
registerCommandHandlers()
Layers should use this method to register their command handlers and call it from their constructor.boolean
reorderColumnGroup(int fromColumnPosition, int toColumnPosition)
void
setReorderFromColumnPosition(int fromColumnPosition)
Used to support column reordering via drag and drop.boolean
updateColumnGroupModel(int fromColumnPosition, int toColumnPosition, boolean reorderToLeftEdge)
Updates theColumnGroupModel
with respect to a column reordering operation.boolean
updateColumnGroupModel(int fromColumnPosition, int toColumnPosition, boolean reorderToLeftEdge, List<Integer> fromColumnPositions)
Updates theColumnGroupModel
with respect to a column reordering operation.boolean
updateColumnGroupModel(List<Integer> fromColumnPositions, int toColumnPosition, boolean reorderToLeftEdge)
Updates theColumnGroupModel
with respect to a column reordering operation.-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, doCommand, getCellByPosition, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getProvidedLabels, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
addLayerListener, configure, dispose, doCommand, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getProvidedLabels, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayerListener
handleLayerEvent
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
loadState, saveState
-
-
-
-
Constructor Detail
-
ColumnGroupReorderLayer
public ColumnGroupReorderLayer(IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
-
-
Method Detail
-
reorderColumnGroup
public boolean reorderColumnGroup(int fromColumnPosition, int toColumnPosition)
- Parameters:
fromColumnPosition
- The column position of a column in the column group that should be reordered.toColumnPosition
- The column position to which a column group should be reordered to.- Returns:
true
if the reorder command was executed and consumed successfully
-
getModel
public ColumnGroupModel getModel()
- Returns:
- The
ColumnGroupModel
that is used to specify the column groups.
-
getUnderlyingLayer
public IUniqueIndexLayer getUnderlyingLayer()
- Overrides:
getUnderlyingLayer
in classAbstractLayerTransform
- Since:
- 1.3
-
registerCommandHandlers
protected void registerCommandHandlers()
Description copied from class:AbstractLayer
Layers should use this method to register their command handlers and call it from their constructor. This allows easy overriding if required of command handlers- Overrides:
registerCommandHandlers
in classAbstractLayer
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex)
- Specified by:
getColumnPositionByIndex
in interfaceIUniqueIndexLayer
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex)
- Specified by:
getRowPositionByIndex
in interfaceIUniqueIndexLayer
-
getColumnGroupPositions
public List<Integer> getColumnGroupPositions(int fromColumnIndex)
- Parameters:
fromColumnIndex
- The column index of a column that is part of a column group.- Returns:
- The column positions for all the columns in the column group specified by the given index.
-
getReorderFromColumnPosition
public int getReorderFromColumnPosition()
Used to support column reordering via drag and drop.- Returns:
- The position from which a column reorder operation was started from.
-
setReorderFromColumnPosition
public void setReorderFromColumnPosition(int fromColumnPosition)
Used to support column reordering via drag and drop.- Parameters:
fromColumnPosition
- The position from which a column reorder operation was started from.
-
updateColumnGroupModel
public boolean updateColumnGroupModel(List<Integer> fromColumnPositions, int toColumnPosition, boolean reorderToLeftEdge)
Updates theColumnGroupModel
with respect to a column reordering operation.- Parameters:
fromColumnPositions
- The column positions that should be reordered.toColumnPosition
- The column position to which a column should be reordered.reorderToLeftEdge
- Whether the toPosition should be calculated for attachment to the left or not.- Returns:
true
if only aColumnGroupModel
modification was triggered and no column reordering is necessary,false
if additionally a column reordering needs to be performed.- Since:
- 1.3
-
updateColumnGroupModel
public boolean updateColumnGroupModel(int fromColumnPosition, int toColumnPosition, boolean reorderToLeftEdge)
Updates theColumnGroupModel
with respect to a column reordering operation.- Parameters:
fromColumnPosition
- The column position that should be reordered.toColumnPosition
- The column position to which a column should be reordered.reorderToLeftEdge
- Whether the toPosition should be calculated for attachment to the left or not.- Returns:
true
if only aColumnGroupModel
modification was triggered and no column reordering is necessary,false
if additionally a column reordering needs to be performed.- Since:
- 1.3
-
getColumnIndexesForPositions
protected int[] getColumnIndexesForPositions(List<Integer> fromColumnPositions)
Transforms the given collection of column positions to an array of column indexes.- Parameters:
fromColumnPositions
- The column positions to transform.- Returns:
- An array that contains the indexes for the given positions.
- Since:
- 1.3
-
updateColumnGroupModel
public boolean updateColumnGroupModel(int fromColumnPosition, int toColumnPosition, boolean reorderToLeftEdge, List<Integer> fromColumnPositions)
Updates theColumnGroupModel
with respect to a column reordering operation.- Parameters:
fromColumnPosition
- The column position that should be used for determining the necessary operation.toColumnPosition
- The column position to which a column should be reordered.reorderToLeftEdge
- Whether the toPosition should be calculated for attachment to the left or not.fromColumnPositions
- The column positions that should be reordered.- Returns:
true
if only aColumnGroupModel
modification was triggered and no column reordering is necessary,false
if additionally a column reordering needs to be performed.- Since:
- 1.3
-
-