Class ColumnHideShowLayer
java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
org.eclipse.nebula.widgets.nattable.hideshow.AbstractColumnHideShowLayer
org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer
- All Implemented Interfaces:
IColumnHideShowLayer,ILayer,ILayerListener,IUniqueIndexLayer,IPersistable
- Direct Known Subclasses:
ColumnHideShowLayerFixture
public class ColumnHideShowLayer
extends AbstractColumnHideShowLayer
implements IColumnHideShowLayer
Layer to add support for column hide/show feature to a NatTable. Technically
the columns are hidden by this layer which leads to a index-position
transformation. With percentage sizing this this leads to gaps for hidden
columns as the size of the other columns is not re-calculated. For percentage
sizing and size increase use the
ResizeColumnHideShowLayer.- See Also:
-
Field Summary
FieldsFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetConfigLabelsByPosition(int columnPosition, int rowPosition) Returns the config labels for the cell at the given coordinates.Will collect and return all indexes of the columns that are hidden in this layer.int[]Will collect and return all indexes of the columns that are hidden in this layer.voidhandleLayerEvent(ILayerEvent event) Handle layer event notification.booleanCheck if this layer actively hides columns.voidhideColumnIndexes(int... columnIndexes) Hide the columns with the given indexes.voidhideColumnIndexes(Collection<Integer> columnIndexes) Hide the columns with the given indexes.voidhideColumnPositions(int... columnPositions) Hide the columns at the specified positions.voidhideColumnPositions(Collection<Integer> columnPositions) Hide the columns at the specified positions.booleanisColumnIndexHidden(int columnIndex) Will check if the column at the specified index is hidden or not.voidloadState(String prefix, Properties properties) Underlying layers must load state first.voidsaveState(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.voidShow all hidden columns again.voidshowColumnIndexes(int... columnIndexes) Show the columns with the given indexes again if they are hidden by this layer.voidshowColumnIndexes(Collection<Integer> columnIndexes) Show the columns with the given indexes again if they are hidden by this layer.voidshowColumnPosition(int columnPosition, boolean showToLeft, boolean showAll) Show the column(s) that are hidden next to the given column position.Methods inherited from class org.eclipse.nebula.widgets.nattable.hideshow.AbstractColumnHideShowLayer
cacheVisibleColumnIndexes, doCommand, getCellByPosition, getColumnCount, getColumnIndexByPosition, getColumnPositionByIndex, getColumnPositionByX, getColumnPositionsByIndexes, getColumnPositionsByIndexes, getRowPositionByIndex, getStartXOfColumnPosition, getUnderlyingLayer, getWidth, invalidateCache, localToUnderlyingColumnPosition, underlyingToLocalColumnPosition, underlyingToLocalColumnPositionsMethods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, getCellPainter, getColumnWidthByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingRowPosition, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalRowPosition, underlyingToLocalRowPositionsMethods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, hasLayerListener, registerCommandHandler, registerCommandHandlers, 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, fireLayerEvent, getBoundsByPosition, getCellPainter, getClientAreaProvider, getColumnWidthByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingRowPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalRowPosition, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
-
Field Details
-
PERSISTENCE_KEY_HIDDEN_COLUMN_INDEXES
- See Also:
-
-
Constructor Details
-
ColumnHideShowLayer
-
-
Method Details
-
handleLayerEvent
Description copied from class:AbstractLayerHandle layer event notification. Convert it to your context and propagate UP. If you override this method you MUST NOT FORGET to raise the event up the layer stack by callingsuper.fireLayerEvent(event)- unless you plan to eat the event yourself.- Specified by:
handleLayerEventin interfaceILayerListener- Overrides:
handleLayerEventin classAbstractColumnHideShowLayer- Parameters:
event- the event
-
saveState
Description copied from interface:IPersistableSaves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.- Specified by:
saveStatein interfaceIPersistable- Overrides:
saveStatein classAbstractLayerTransform- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to save the state to.
-
loadState
Description copied from class:AbstractLayerTransformUnderlying layers must load state first. If this is not done,IStructuralChangeEventfrom underlying layers will reset caches after state has been loaded- Specified by:
loadStatein interfaceIPersistable- Overrides:
loadStatein classAbstractLayerTransform- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to load the state from.
-
getConfigLabelsByPosition
Description copied from interface:ILayerReturns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry.- Specified by:
getConfigLabelsByPositionin interfaceILayer- Overrides:
getConfigLabelsByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
- The
LabelStackwith the config labels for the cell at the given coordinates.
-
isColumnIndexHidden
public boolean isColumnIndexHidden(int columnIndex) Description copied from class:AbstractColumnHideShowLayerWill check if the column at the specified index is hidden or not.- Specified by:
isColumnIndexHiddenin classAbstractColumnHideShowLayer- Parameters:
columnIndex- The column index of the column whose visibility state should be checked.- Returns:
trueif the column at the specified index is hidden,falseif it is visible.
-
getHiddenColumnIndexes
Description copied from class:AbstractColumnHideShowLayerWill collect and return all indexes of the columns that are hidden in this layer.Note: It is not intended that it also collects the column indexes of underlying layers. This would cause issues on calculating positions, as every layer is responsible for those calculations itself.
Since 2.0 it is recommended to use
AbstractColumnHideShowLayer.getHiddenColumnIndexesArray()to avoid unnecessary autoboxing operations.- Specified by:
getHiddenColumnIndexesin interfaceIColumnHideShowLayer- Specified by:
getHiddenColumnIndexesin classAbstractColumnHideShowLayer- Returns:
- Collection of all column indexes that are hidden in this layer.
-
getHiddenColumnIndexesArray
public int[] getHiddenColumnIndexesArray()Description copied from class:AbstractColumnHideShowLayerWill collect and return all indexes of the columns that are hidden in this layer.Note: It is not intended that it also collects the column indexes of underlying layers. This would cause issues on calculating positions, as every layer is responsible for those calculations itself.
- Specified by:
getHiddenColumnIndexesArrayin interfaceIColumnHideShowLayer- Specified by:
getHiddenColumnIndexesArrayin classAbstractColumnHideShowLayer- Returns:
- All column indexes that are hidden in this layer.
-
hasHiddenColumns
public boolean hasHiddenColumns()Description copied from class:AbstractColumnHideShowLayerCheck if this layer actively hides columns.- Specified by:
hasHiddenColumnsin classAbstractColumnHideShowLayer- Returns:
trueif columns are hidden by this layer,falseif not.
-
hideColumnPositions
public void hideColumnPositions(int... columnPositions) Hide the columns at the specified positions. Note that the positions are required as this method might get called via user interaction in a transformed table (e.g. reordered).- Specified by:
hideColumnPositionsin interfaceIColumnHideShowLayer- Parameters:
columnPositions- The column positions to hide.- Since:
- 1.6
-
hideColumnPositions
Description copied from interface:IColumnHideShowLayerHide the columns at the specified positions. Note that the positions are required as this method might get called via user interaction in a transformed table (e.g. reordered).- Specified by:
hideColumnPositionsin interfaceIColumnHideShowLayer- Parameters:
columnPositions- The column positions to hide.
-
hideColumnIndexes
public void hideColumnIndexes(int... columnIndexes) Description copied from interface:IColumnHideShowLayerHide the columns with the given indexes.- Specified by:
hideColumnIndexesin interfaceIColumnHideShowLayer- Parameters:
columnIndexes- The indexes of the columns to hide.
-
hideColumnIndexes
Description copied from interface:IColumnHideShowLayerHide the columns with the given indexes.- Specified by:
hideColumnIndexesin interfaceIColumnHideShowLayer- Parameters:
columnIndexes- The indexes of the columns to hide.
-
showColumnIndexes
public void showColumnIndexes(int... columnIndexes) Show the columns with the given indexes again if they are hidden by this layer. Note that the indexes are needed and not the positions. This is because a user is not able to select the hidden column in the NatTable and therefore the position is not available anymore.- Specified by:
showColumnIndexesin interfaceIColumnHideShowLayer- Parameters:
columnIndexes- The column indexes to show again.- Since:
- 1.6
-
showColumnIndexes
Description copied from interface:IColumnHideShowLayerShow the columns with the given indexes again if they are hidden by this layer. Note that the indexes are needed and not the positions. This is because a user is not able to select the hidden column in the NatTable and therefore the position is not available anymore.- Specified by:
showColumnIndexesin interfaceIColumnHideShowLayer- Parameters:
columnIndexes- The column indexes to show again.
-
showColumnPosition
public void showColumnPosition(int columnPosition, boolean showToLeft, boolean showAll) Description copied from interface:IColumnHideShowLayerShow the column(s) that are hidden next to the given column position.- Specified by:
showColumnPositionin interfaceIColumnHideShowLayer- Parameters:
columnPosition- The column position whose neighbors should be shown again.showToLeft- Whether the column positions to the left or the right of the given column position should be shown again.showAll- Whether all hidden adjacent columns should be shown again or only the single direct adjacent column.
-
showAllColumns
public void showAllColumns()Description copied from interface:IColumnHideShowLayerShow all hidden columns again.- Specified by:
showAllColumnsin interfaceIColumnHideShowLayer
-
getProvidedLabels
- Specified by:
getProvidedLabelsin interfaceILayer- Overrides:
getProvidedLabelsin classAbstractLayer- Returns:
- The collection of labels that are provided by this layer.
-