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
Adds functionality allowing the reordering of the the column groups.
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
underlyingLayerFields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainterFields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionColumnGroupReorderLayer(IUniqueIndexLayer underlyingLayer, ColumnGroupModel model) -
Method Summary
Modifier and TypeMethodDescriptiongetColumnGroupPositions(int fromColumnIndex) protected int[]getColumnIndexesForPositions(List<Integer> fromColumnPositions) Transforms the given collection of column positions to an array of column indexes.intgetColumnPositionByIndex(int columnIndex) getModel()intUsed to support column reordering via drag and drop.intgetRowPositionByIndex(int rowIndex) protected voidLayers should use this method to register their command handlers and call it from their constructor.booleanreorderColumnGroup(int fromColumnPosition, int toColumnPosition) voidsetReorderFromColumnPosition(int fromColumnPosition) Used to support column reordering via drag and drop.booleanupdateColumnGroupModel(int fromColumnPosition, int toColumnPosition, boolean reorderToLeftEdge) Updates theColumnGroupModelwith respect to a column reordering operation.booleanupdateColumnGroupModel(int fromColumnPosition, int toColumnPosition, boolean reorderToLeftEdge, List<Integer> fromColumnPositions) Updates theColumnGroupModelwith respect to a column reordering operation.booleanupdateColumnGroupModel(List<Integer> fromColumnPositions, int toColumnPosition, boolean reorderToLeftEdge) Updates theColumnGroupModelwith 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, underlyingToLocalRowPositionsMethods 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, unregisterPersistableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, unregisterPersistableMethods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayerListener
handleLayerEventMethods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
loadState, saveState
-
Constructor Details
-
ColumnGroupReorderLayer
-
-
Method Details
-
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:
trueif the reorder command was executed and consumed successfully
-
getModel
- Returns:
- The
ColumnGroupModelthat is used to specify the column groups.
-
getUnderlyingLayer
- Overrides:
getUnderlyingLayerin classAbstractLayerTransform- Since:
- 1.3
-
registerCommandHandlers
protected void registerCommandHandlers()Description copied from class:AbstractLayerLayers 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:
registerCommandHandlersin classAbstractLayer
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex) - Specified by:
getColumnPositionByIndexin interfaceIUniqueIndexLayer
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex) - Specified by:
getRowPositionByIndexin interfaceIUniqueIndexLayer
-
getColumnGroupPositions
- 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 theColumnGroupModelwith 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:
trueif only aColumnGroupModelmodification was triggered and no column reordering is necessary,falseif additionally a column reordering needs to be performed.- Since:
- 1.3
-
updateColumnGroupModel
public boolean updateColumnGroupModel(int fromColumnPosition, int toColumnPosition, boolean reorderToLeftEdge) Updates theColumnGroupModelwith 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:
trueif only aColumnGroupModelmodification was triggered and no column reordering is necessary,falseif additionally a column reordering needs to be performed.- Since:
- 1.3
-
getColumnIndexesForPositions
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 theColumnGroupModelwith 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:
trueif only aColumnGroupModelmodification was triggered and no column reordering is necessary,falseif additionally a column reordering needs to be performed.- Since:
- 1.3
-