Class RowIdHideShowLayer<T>
java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
org.eclipse.nebula.widgets.nattable.hideshow.AbstractRowHideShowLayer
org.eclipse.nebula.widgets.nattable.hideshow.RowIdHideShowLayer<T>
- All Implemented Interfaces:
IRowHideShowLayer,ILayer,ILayerListener,IUniqueIndexLayer,IPersistable
ILayer that supports hiding of rows based on the row id. This way the
hidden row is identified even on sorting and filtering. This is different to
the RowHideShowLayer that handles row hiding via row index.- Since:
- 1.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<Serializable,T> protected IDisplayConverterstatic final Stringprotected final IRowDataProvider<T>protected final IRowIdAccessor<T>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
ConstructorsConstructorDescriptionRowIdHideShowLayer(IUniqueIndexLayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor) -
Method Summary
Modifier and TypeMethodDescriptionbooleandoCommand(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.getConfigLabelsByPosition(int columnPosition, int rowPosition) Returns the config labels for the cell at the given coordinates.Will collect and return all indexes of the rows that are hidden in this layer.int[]Will collect and return all indexes of the rows that are hidden in this layer.intbooleanCheck if this layer actively hides rows.voidhideRowIndexes(int... rowIndexes) Hide the rows with the given indexes.voidhideRowIndexes(Collection<Integer> rowIndexes) Hide the rows with the given indexes.voidhideRowPositions(int... rowPositions) Hide the rows at the given positions.voidhideRowPositions(Collection<Integer> rowPositions) Hide the rows at the given positions.booleanisRowIndexHidden(int rowIndex) Will check if the row 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.voidsetIdConverter(IDisplayConverter idConverter) Set theIDisplayConverterthat is used for conversion of the row id needed onloadState(String, Properties)andsaveState(String, Properties).voidShow all rows that where previously hidden.voidshowRowIndexes(int... rowIndexes) Show the rows with the given indexes again.voidshowRowIndexes(Collection<Integer> rowIndexes) Show the rows with the given indexes again.voidshowRowPosition(int rowPosition, boolean showToTop, boolean showAll) Show the row(s) that are hidden next to the given row position.Methods inherited from class org.eclipse.nebula.widgets.nattable.hideshow.AbstractRowHideShowLayer
cacheVisibleRowIndexes, getCellByPosition, getColumnPositionByIndex, getHeight, getRowIndexByPosition, getRowPositionByIndex, getRowPositionByY, getRowPositionsByIndexes, getRowPositionsByIndexes, getStartYOfRowPosition, getUnderlyingLayer, handleLayerEvent, invalidateCache, localToUnderlyingRowPosition, underlyingToLocalRowPosition, underlyingToLocalRowPositionsMethods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowHeightByPosition, getStartXOfColumnPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingColumnPosition, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositionsMethods 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, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowHeightByPosition, getStartXOfColumnPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingColumnPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, unregisterCommandHandler, unregisterPersistable
-
Field Details
-
PERSISTENCE_KEY_HIDDEN_ROW_IDS
- See Also:
-
rowDataProvider
-
rowIdAccessor
-
idConverter
-
-
Constructor Details
-
RowIdHideShowLayer
public RowIdHideShowLayer(IUniqueIndexLayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor) - Parameters:
underlyingLayer- The underlying layer.rowDataProvider- The body data provider needed to get the row object by index to determine the row id.rowIdAccessor- TheIRowIdAccessorneeded to extract the row id of a row object.
-
-
Method Details
-
doCommand
Description copied from interface:ILayerOpportunity to respond to a command as it flows down the stack. If the layer is not interested in the command it should allow the command to keep traveling down the stack.Note: Before the layer can process a command it must convert the command to its local coordinates using
ILayerCommand.convertToTargetLayer(ILayer)- Specified by:
doCommandin interfaceILayer- Overrides:
doCommandin classAbstractRowHideShowLayer- Parameters:
command- The command to execute.- Returns:
trueif the command has been handled and was therefore consumed,falseotherwise.
-
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.
-
getRowCount
public int getRowCount()- Specified by:
getRowCountin interfaceILayer- Overrides:
getRowCountin classAbstractRowHideShowLayer- Returns:
- The number of rows in this layer.
-
isRowIndexHidden
public boolean isRowIndexHidden(int rowIndex) Description copied from class:AbstractRowHideShowLayerWill check if the row at the specified index is hidden or not. Checks this layer and also the sublayers for the visibility.- Specified by:
isRowIndexHiddenin classAbstractRowHideShowLayer- Parameters:
rowIndex- The row index of the row whose visibility state should be checked.- Returns:
trueif the row at the specified index is hidden,falseif it is visible.
-
getHiddenRowIndexes
Description copied from class:AbstractRowHideShowLayerWill collect and return all indexes of the rows that are hidden in this layer.Note: It is not intended that it also collects the row 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
AbstractRowHideShowLayer.getHiddenRowIndexesArray()to avoid unnecessary autoboxing operations.- Specified by:
getHiddenRowIndexesin classAbstractRowHideShowLayer- Returns:
- Collection of all row indexes that are hidden in this layer.
-
getHiddenRowIndexesArray
public int[] getHiddenRowIndexesArray()Description copied from class:AbstractRowHideShowLayerWill collect and return all indexes of the rows that are hidden in this layer.Note: It is not intended that it also collects the row indexes of underlying layers. This would cause issues on calculating positions, as every layer is responsible for those calculations itself.
- Specified by:
getHiddenRowIndexesArrayin classAbstractRowHideShowLayer- Returns:
- All row indexes that are hidden in this layer.
-
hasHiddenRows
public boolean hasHiddenRows()Description copied from class:AbstractRowHideShowLayerCheck if this layer actively hides rows.- Specified by:
hasHiddenRowsin classAbstractRowHideShowLayer- Returns:
trueif rows are hidden by this layer,falseif not.
-
hideRowPositions
public void hideRowPositions(int... rowPositions) Description copied from interface:IRowHideShowLayerHide the rows at the given positions.- Specified by:
hideRowPositionsin interfaceIRowHideShowLayer- Parameters:
rowPositions- The positions of the rows to hide.
-
hideRowPositions
Description copied from interface:IRowHideShowLayerHide the rows at the given positions.- Specified by:
hideRowPositionsin interfaceIRowHideShowLayer- Parameters:
rowPositions- The positions of the rows to hide.
-
hideRowIndexes
public void hideRowIndexes(int... rowIndexes) Description copied from interface:IRowHideShowLayerHide the rows with the given indexes.- Specified by:
hideRowIndexesin interfaceIRowHideShowLayer- Parameters:
rowIndexes- The indexes of the rows to hide.
-
hideRowIndexes
Description copied from interface:IRowHideShowLayerHide the rows with the given indexes.- Specified by:
hideRowIndexesin interfaceIRowHideShowLayer- Parameters:
rowIndexes- The indexes of the rows to hide.
-
showRowIndexes
public void showRowIndexes(int... rowIndexes) Description copied from interface:IRowHideShowLayerShow the rows with the given indexes again.- Specified by:
showRowIndexesin interfaceIRowHideShowLayer- Parameters:
rowIndexes- The indexes of the rows that should be showed again.
-
showRowIndexes
Description copied from interface:IRowHideShowLayerShow the rows with the given indexes again.- Specified by:
showRowIndexesin interfaceIRowHideShowLayer- Parameters:
rowIndexes- The indexes of the rows that should be showed again.
-
showRowPosition
public void showRowPosition(int rowPosition, boolean showToTop, boolean showAll) Description copied from interface:IRowHideShowLayerShow the row(s) that are hidden next to the given row position.- Specified by:
showRowPositionin interfaceIRowHideShowLayer- Parameters:
rowPosition- The row position whose neighbors should be shown again.showToTop- Whether the row positions to the top or the bottom of the given row position should be shown again.showAll- Whether all hidden adjacent rows should be shown again or only the single direct adjacent row.
-
showAllRows
public void showAllRows()Description copied from interface:IRowHideShowLayerShow all rows that where previously hidden.- Specified by:
showAllRowsin interfaceIRowHideShowLayer
-
getProvidedLabels
- Specified by:
getProvidedLabelsin interfaceILayer- Overrides:
getProvidedLabelsin classAbstractLayer- Returns:
- The collection of labels that are provided by this layer.
-
getIdConverter
- Returns:
- The converter used for id conversion.
-
setIdConverter
Set theIDisplayConverterthat is used for conversion of the row id needed onloadState(String, Properties)andsaveState(String, Properties).- Parameters:
idConverter- The converter that should be used for id conversion.
-