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
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 AbstractRowHideShowLayer(IUniqueIndexLayer underlyingLayer)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
cacheVisibleRowIndexes()
Build up the row caches.ILayerCell
getCellByPosition(int columnPosition, int rowPosition)
Returns the cell for the given coordinates on this layer.int
getColumnPositionByIndex(int columnIndex)
int
getHeight()
Returns the total height in pixels of this layer.abstract Collection<Integer>
getHiddenRowIndexes()
Will collect and return all indexes of the rows that are hidden in this layer.abstract int[]
getHiddenRowIndexesArray()
Will collect and return all indexes of the rows that are hidden in this layer.int
getRowCount()
int
getRowIndexByPosition(int rowPosition)
Gets the underlying non-transformed row index for the given row position on this layer.int
getRowPositionByIndex(int rowIndex)
int
getRowPositionByY(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.Collection<Integer>
getRowPositionsByIndexes(Collection<Integer> rowIndexes)
Get the local row positions for the given row indexes.int
getStartYOfRowPosition(int localRowPosition)
Returns the y offset in pixels of the given row.protected IUniqueIndexLayer
getUnderlyingLayer()
void
handleLayerEvent(ILayerEvent event)
Handle layer event notification.abstract boolean
hasHiddenRows()
Check if this layer actively hides rows.protected void
invalidateCache()
Invalidate the cache to ensure that information is rebuild.abstract boolean
isRowIndexHidden(int rowIndex)
Will check if the row at the specified index is hidden or not.int
localToUnderlyingRowPosition(int localRowPosition)
Convert a row position to the coordinates of the underlying layer.int
underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
Transforms the row position relative to the given underlying layer to this layer coordinates.Collection<Range>
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, doCommand, 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, underlyingToLocalColumnPositions
-
Methods 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, 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, 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, unregisterPersistable
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
loadState, saveState
-
-
-
-
Constructor Detail
-
AbstractRowHideShowLayer
public AbstractRowHideShowLayer(IUniqueIndexLayer underlyingLayer)
Constructor.- Parameters:
underlyingLayer
- The underlying layer.
-
-
Method Detail
-
getUnderlyingLayer
protected IUniqueIndexLayer getUnderlyingLayer()
- Overrides:
getUnderlyingLayer
in classAbstractLayerTransform
- Returns:
- The underlying layer.
- Since:
- 2.0
-
handleLayerEvent
public void handleLayerEvent(ILayerEvent event)
Description copied from class:AbstractLayer
Handle 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:
handleLayerEvent
in interfaceILayerListener
- Overrides:
handleLayerEvent
in classAbstractLayer
- Parameters:
event
- the event
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex)
- Specified by:
getColumnPositionByIndex
in interfaceIUniqueIndexLayer
-
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interfaceILayer
- Overrides:
getRowCount
in classAbstractLayerTransform
- Returns:
- The number of rows in this layer.
-
getRowIndexByPosition
public int getRowIndexByPosition(int rowPosition)
Description copied from interface:ILayer
Gets the underlying non-transformed row index for the given row position on this layer.- Specified by:
getRowIndexByPosition
in interfaceILayer
- Overrides:
getRowIndexByPosition
in 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:
getRowPositionByIndex
in interfaceIUniqueIndexLayer
-
getRowPositionsByIndexes
public Collection<Integer> getRowPositionsByIndexes(Collection<Integer> 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.
-
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:ILayer
Convert a row position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingRowPosition
in interfaceILayer
- Overrides:
localToUnderlyingRowPosition
in classAbstractLayerTransform
- Parameters:
localRowPosition
- row position in local (the layer's own) coordinates- Returns:
- row position in the underlying layer's coordinates
-
underlyingToLocalRowPosition
public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
Description copied from interface:ILayer
Transforms the row position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPosition
in interfaceILayer
- Overrides:
underlyingToLocalRowPosition
in 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:ILayer
Transforms the row position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPositions
in interfaceILayer
- Overrides:
underlyingToLocalRowPositions
in 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:ILayer
Returns the total height in pixels of this layer.- Specified by:
getHeight
in interfaceILayer
- Overrides:
getHeight
in classAbstractLayerTransform
- Returns:
- The total height in pixels of this layer.
-
getRowPositionByY
public int getRowPositionByY(int y)
Description copied from interface:ILayer
Returns the row position that contains the given y coordinate.- Specified by:
getRowPositionByY
in interfaceILayer
- Overrides:
getRowPositionByY
in 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:ILayer
Returns the y offset in pixels of the given row.- Specified by:
getStartYOfRowPosition
in interfaceILayer
- Overrides:
getStartYOfRowPosition
in 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:
true
if the row at the specified index is hidden,false
if it is visible.
-
getHiddenRowIndexes
public abstract Collection<Integer> 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:
true
if rows are hidden by this layer,false
if not.- Since:
- 2.0
-
getCellByPosition
public ILayerCell getCellByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayer
Returns the cell for the given coordinates on this layer.- Specified by:
getCellByPosition
in interfaceILayer
- Overrides:
getCellByPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position of the requested cell.rowPosition
- The row position of the requested cell.- Returns:
- The
ILayerCell
for the given coordinates in this layer ornull
if 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.
-
-