Class AbstractRowHideShowLayer
java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
org.eclipse.nebula.widgets.nattable.hideshow.AbstractRowHideShowLayer
- All Implemented Interfaces:
ILayer,ILayerListener,IUniqueIndexLayer,IPersistable
- Direct Known Subclasses:
HierarchicalTreeLayer,RowGroupExpandCollapseLayer,RowGroupExpandCollapseLayer,RowHideShowLayer,RowIdHideShowLayer,TreeLayer
public abstract class AbstractRowHideShowLayer
extends AbstractLayerTransform
implements IUniqueIndexLayer
Abstract implementation for row hide/show operations.
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBuild up the row caches.booleandoCommand(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.getCellByPosition(int columnPosition, int rowPosition) Returns the cell for the given coordinates on this layer.intgetColumnPositionByIndex(int columnIndex) intReturns the total height in pixels of this layer.abstract Collection<Integer>Will collect and return all indexes of the rows that are hidden in this layer.abstract int[]Will collect and return all indexes of the rows that are hidden in this layer.intintgetRowIndexByPosition(int rowPosition) Gets the underlying non-transformed row index for the given row position on this layer.intgetRowPositionByIndex(int rowIndex) intgetRowPositionByY(int y) Returns the row position that contains the given y coordinate.int[]getRowPositionsByIndexes(int... rowIndexes) Get the local row positions for the given row indexes.getRowPositionsByIndexes(Collection<Integer> rowIndexes) Get the local row positions for the given row indexes.intgetStartYOfRowPosition(int localRowPosition) Returns the y offset in pixels of the given row.protected IUniqueIndexLayervoidhandleLayerEvent(ILayerEvent event) Handle layer event notification.abstract booleanCheck if this layer actively hides rows.protected voidInvalidate the cache to ensure that information is rebuild.abstract booleanisRowIndexHidden(int rowIndex) Will check if the row at the specified index is hidden or not.intlocalToUnderlyingRowPosition(int localRowPosition) Convert a row position to the coordinates of the underlying layer.intunderlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) Transforms the row position relative to the given underlying layer to this layer coordinates.underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges) Transforms the row position ranges relative to the given underlying layer to this layer coordinates.Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowHeightByPosition, getStartXOfColumnPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositionsMethods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getProvidedLabels, 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, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getProvidedLabels, getRegionLabelsByXY, getRowHeightByPosition, getStartXOfColumnPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingColumnPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, unregisterCommandHandler, unregisterPersistableMethods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
loadState, saveState
-
Constructor Details
-
AbstractRowHideShowLayer
Constructor.- Parameters:
underlyingLayer- The underlying layer.
-
-
Method Details
-
getUnderlyingLayer
- Overrides:
getUnderlyingLayerin classAbstractLayerTransform- Returns:
- The underlying layer.
- Since:
- 2.0
-
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 classAbstractLayer- Parameters:
event- the event
-
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 classAbstractLayerTransform- Parameters:
command- The command to execute.- Returns:
trueif the command has been handled and was therefore consumed,falseotherwise.
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex) - Specified by:
getColumnPositionByIndexin interfaceIUniqueIndexLayer
-
getRowCount
public int getRowCount()- Specified by:
getRowCountin interfaceILayer- Overrides:
getRowCountin classAbstractLayerTransform- Returns:
- The number of rows in this layer.
-
getRowIndexByPosition
public int getRowIndexByPosition(int rowPosition) Description copied from interface:ILayerGets the underlying non-transformed row index for the given row position on this layer.- Specified by:
getRowIndexByPositionin interfaceILayer- Overrides:
getRowIndexByPositionin classAbstractLayerTransform- Parameters:
rowPosition- The row position relative to this layer.- Returns:
- An underlying non-transformed row index, or -1 if the given row position does not exist within this coordinate system.
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex) - Specified by:
getRowPositionByIndexin interfaceIUniqueIndexLayer
-
getRowPositionsByIndexes
Get the local row positions for the given row indexes.- Parameters:
rowIndexes- The row indexes for which the local row positions are requested.- Returns:
- The local row positions for the given row indexes.
-
getRowPositionsByIndexes
public int[] getRowPositionsByIndexes(int... rowIndexes) Get the local row positions for the given row indexes.- Parameters:
rowIndexes- The row indexes for which the local row positions are requested.- Returns:
- The local row positions for the given row indexes.
- Since:
- 2.0
-
localToUnderlyingRowPosition
public int localToUnderlyingRowPosition(int localRowPosition) Description copied from interface:ILayerConvert a row position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingRowPositionin interfaceILayer- Overrides:
localToUnderlyingRowPositionin classAbstractLayerTransform- Parameters:
localRowPosition- row position in local (the layer's own) coordinates- Returns:
- row position in the underlying layer's coordinates
-
underlyingToLocalRowPosition
Description copied from interface:ILayerTransforms the row position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPositionin interfaceILayer- Overrides:
underlyingToLocalRowPositionin classAbstractLayerTransform- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given row position matches.underlyingRowPosition- The row position in the given underlying layer that should be converted to a local row position.- Returns:
- The given row position transformed to be local to this layer.
-
underlyingToLocalRowPositions
public Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges) Description copied from interface:ILayerTransforms the row position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPositionsin interfaceILayer- Overrides:
underlyingToLocalRowPositionsin classAbstractLayerTransform- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given row positions match.underlyingRowPositionRanges- The row position ranges relative to the given underlying layer that should be converted to local row positions.- Returns:
- The given row position ranges transformed to this layer.
-
getHeight
public int getHeight()Description copied from interface:ILayerReturns the total height in pixels of this layer.- Specified by:
getHeightin interfaceILayer- Overrides:
getHeightin classAbstractLayerTransform- Returns:
- The total height in pixels of this layer.
-
getRowPositionByY
public int getRowPositionByY(int y) Description copied from interface:ILayerReturns the row position that contains the given y coordinate.- Specified by:
getRowPositionByYin interfaceILayer- Overrides:
getRowPositionByYin classAbstractLayerTransform- Parameters:
y- a vertical pixel location relative to the pixel boundary of this layer- Returns:
- a row position relative to the associated coordinate system, or -1 if there is no row that contains y
-
getStartYOfRowPosition
public int getStartYOfRowPosition(int localRowPosition) Description copied from interface:ILayerReturns the y offset in pixels of the given row.- Specified by:
getStartYOfRowPositionin interfaceILayer- Overrides:
getStartYOfRowPositionin classAbstractLayerTransform- Parameters:
localRowPosition- the row position in this layer- Returns:
- the y offset of the row, or -1
-
isRowIndexHidden
public abstract boolean isRowIndexHidden(int rowIndex) Will check if the row at the specified index is hidden or not. Checks this layer and also the sublayers for the visibility.- 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
Will 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
getHiddenRowIndexesArray()to avoid unnecessary autoboxing operations.- Returns:
- Collection of all row indexes that are hidden in this layer.
-
getHiddenRowIndexesArray
public abstract int[] getHiddenRowIndexesArray()Will 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.
- Returns:
- All row indexes that are hidden in this layer.
- Since:
- 2.0
-
hasHiddenRows
public abstract boolean hasHiddenRows()Check if this layer actively hides rows.- Returns:
trueif rows are hidden by this layer,falseif not.- Since:
- 2.0
-
getCellByPosition
Description copied from interface:ILayerReturns the cell for the given coordinates on this layer.- Specified by:
getCellByPositionin interfaceILayer- Overrides:
getCellByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the requested cell.rowPosition- The row position of the requested cell.- Returns:
- The
ILayerCellfor the given coordinates in this layer ornullif the coordinates are invalid on this layer.
-
invalidateCache
protected void invalidateCache()Invalidate the cache to ensure that information is rebuild. -
cacheVisibleRowIndexes
protected void cacheVisibleRowIndexes()Build up the row caches.
-