org.eclipse.nebula.widgets.nattable.hideshow
Class AbstractRowHideShowLayer

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
      extended by org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
          extended by org.eclipse.nebula.widgets.nattable.hideshow.AbstractRowHideShowLayer
All Implemented Interfaces:
ILayer, ILayerListener, IUniqueIndexLayer, IPersistable
Direct Known Subclasses:
RowGroupExpandCollapseLayer, RowHideShowLayer, TreeLayer

public abstract class AbstractRowHideShowLayer
extends AbstractLayerTransform
implements IUniqueIndexLayer


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, layerPainter
 
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
 
Constructor Summary
AbstractRowHideShowLayer(IUniqueIndexLayer underlyingLayer)
           
 
Method Summary
protected  void cacheVisibleRowIndexes()
           
 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.
 int getRowCount()
           
 int getRowIndexByPosition(int rowPosition)
          Gets the underlying non-transformed row index for the given row position.
 int getRowPositionByIndex(int rowIndex)
           
 int getRowPositionByY(int y)
          Returns the row position that contains the given y coordinate.
 Collection<Integer> getRowPositionsByIndexes(Collection<Integer> rowIndexes)
           
 int getStartYOfRowPosition(int localRowPosition)
          Returns the y offset in pixels of the given row.
 void handleLayerEvent(ILayerEvent event)
          Handle layer event notification.
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)
           
 int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
           
 Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges)
           
 
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, doCommand, getCellByPosition, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowHeightByPosition, getStartXOfColumnPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, 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, 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, getCellByPosition, getCellPainter, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowHeightByPosition, getStartXOfColumnPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, 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)
Method Detail

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 calling super.fireLayerEvent(event) - unless you plan to eat the event yourself.

Specified by:
handleLayerEvent in interface ILayerListener
Overrides:
handleLayerEvent in class AbstractLayer
Parameters:
event - the event

getColumnPositionByIndex

public int getColumnPositionByIndex(int columnIndex)
Specified by:
getColumnPositionByIndex in interface IUniqueIndexLayer

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface ILayer
Overrides:
getRowCount in class AbstractLayerTransform
Returns:
the number of rows in this coordinate model

getRowIndexByPosition

public int getRowIndexByPosition(int rowPosition)
Description copied from interface: ILayer
Gets the underlying non-transformed row index for the given row position.

Specified by:
getRowIndexByPosition in interface ILayer
Overrides:
getRowIndexByPosition in class AbstractLayerTransform
Parameters:
rowPosition - a row position relative to this coordinate model
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 interface IUniqueIndexLayer

getRowPositionsByIndexes

public Collection<Integer> getRowPositionsByIndexes(Collection<Integer> rowIndexes)

localToUnderlyingRowPosition

public int localToUnderlyingRowPosition(int localRowPosition)
Specified by:
localToUnderlyingRowPosition in interface ILayer
Overrides:
localToUnderlyingRowPosition in class AbstractLayerTransform

underlyingToLocalRowPosition

public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer,
                                        int underlyingRowPosition)
Specified by:
underlyingToLocalRowPosition in interface ILayer
Overrides:
underlyingToLocalRowPosition in class AbstractLayerTransform

underlyingToLocalRowPositions

public Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer,
                                                       Collection<Range> underlyingRowPositionRanges)
Specified by:
underlyingToLocalRowPositions in interface ILayer
Overrides:
underlyingToLocalRowPositions in class AbstractLayerTransform

getHeight

public int getHeight()
Description copied from interface: ILayer
Returns the total height in pixels of this layer.

Specified by:
getHeight in interface ILayer
Overrides:
getHeight in class AbstractLayerTransform
Returns:
the height 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 interface ILayer
Overrides:
getRowPositionByY in class AbstractLayerTransform
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 interface ILayer
Overrides:
getStartYOfRowPosition in class AbstractLayerTransform
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.

Returns:
Collection of all row indexes that are hidden in this layer.

invalidateCache

protected void invalidateCache()
Invalidate the cache to ensure that information is rebuild.


cacheVisibleRowIndexes

protected void cacheVisibleRowIndexes()


Copyright © 2015. All rights reserved.