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

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.AbstractColumnHideShowLayer
All Implemented Interfaces:
ILayer, ILayerListener, IUniqueIndexLayer, IPersistable
Direct Known Subclasses:
ColumnGroupExpandCollapseLayer, ColumnHideShowLayer

public abstract class AbstractColumnHideShowLayer
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
layerPainter
 
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
 
Constructor Summary
AbstractColumnHideShowLayer(IUniqueIndexLayer underlyingLayer)
           
 
Method Summary
 int getColumnCount()
           
 int getColumnIndexByPosition(int columnPosition)
          Gets the underlying non-transformed column index for the given column position.
 int getColumnPositionByIndex(int columnIndex)
           
 int getColumnPositionByX(int x)
          Returns the column position that contains the given x coordinate.
 Collection<Integer> getColumnPositionsByIndexes(Collection<Integer> columnIndexes)
           
abstract  Collection<Integer> getHiddenColumnIndexes()
          Will collect and return all indexes of the columns that are hidden in this layer.
 int getRowPositionByIndex(int rowIndex)
           
 int getStartXOfColumnPosition(int localColumnPosition)
          Returns the x offset in pixels of the given column.
 int getWidth()
          Returns the total width in pixels of this layer.
 void handleLayerEvent(ILayerEvent event)
          Handle layer event notification.
protected  void invalidateCache()
          Invalidate the cache to ensure that information is rebuild.
abstract  boolean isColumnIndexHidden(int columnIndex)
          Will check if the column at the specified index is hidden or not.
 int localToUnderlyingColumnPosition(int localColumnPosition)
          Convert a column position to the coordinates of the underlying layer.
 int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)
           
 Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)
           
 
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, doCommand, getCellByPosition, getCellPainter, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, isColumnPositionResizable, isRowPositionResizable, loadState, localToUnderlyingRowPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalRowPosition, underlyingToLocalRowPositions
 
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, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, hasLayerListener, isColumnPositionResizable, isRowPositionResizable, localToUnderlyingRowPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalRowPosition, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
 
Methods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
loadState, saveState
 

Constructor Detail

AbstractColumnHideShowLayer

public AbstractColumnHideShowLayer(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

getColumnCount

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

getColumnIndexByPosition

public int getColumnIndexByPosition(int columnPosition)
Description copied from interface: ILayer
Gets the underlying non-transformed column index for the given column position.

Specified by:
getColumnIndexByPosition in interface ILayer
Overrides:
getColumnIndexByPosition in class AbstractLayerTransform
Parameters:
columnPosition - a column position relative to this coordinate model
Returns:
an underlying non-transformed column index, or -1 if the given column position does not exist within this coordinate system

getColumnPositionByIndex

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

getColumnPositionsByIndexes

public Collection<Integer> getColumnPositionsByIndexes(Collection<Integer> columnIndexes)

localToUnderlyingColumnPosition

public int localToUnderlyingColumnPosition(int localColumnPosition)
Description copied from interface: ILayer
Convert a column position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.

Specified by:
localToUnderlyingColumnPosition in interface ILayer
Overrides:
localToUnderlyingColumnPosition in class AbstractLayerTransform
Parameters:
localColumnPosition - column position in local (the layer's own) coordinates
Returns:
column position in the underlying layer's coordinates

underlyingToLocalColumnPosition

public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer,
                                           int underlyingColumnPosition)
Specified by:
underlyingToLocalColumnPosition in interface ILayer
Overrides:
underlyingToLocalColumnPosition in class AbstractLayerTransform

underlyingToLocalColumnPositions

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

getWidth

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

Specified by:
getWidth in interface ILayer
Overrides:
getWidth in class AbstractLayerTransform
Returns:
the width of this layer

getColumnPositionByX

public int getColumnPositionByX(int x)
Description copied from interface: ILayer
Returns the column position that contains the given x coordinate.

Specified by:
getColumnPositionByX in interface ILayer
Overrides:
getColumnPositionByX in class AbstractLayerTransform
Parameters:
x - a horizontal pixel location relative to the pixel boundary of this layer
Returns:
a column position relative to the associated coordinate system, or -1 if there is no column that contains x

getStartXOfColumnPosition

public int getStartXOfColumnPosition(int localColumnPosition)
Description copied from interface: ILayer
Returns the x offset in pixels of the given column.

Specified by:
getStartXOfColumnPosition in interface ILayer
Overrides:
getStartXOfColumnPosition in class AbstractLayerTransform
Parameters:
localColumnPosition - the column position in this layer
Returns:
the x offset of the column, or -1

getRowPositionByIndex

public int getRowPositionByIndex(int rowIndex)
Specified by:
getRowPositionByIndex in interface IUniqueIndexLayer

isColumnIndexHidden

public abstract boolean isColumnIndexHidden(int columnIndex)
Will check if the column at the specified index is hidden or not. Checks this layer and also the sublayers for the visibility. Note: As the ColumnGroupModel.ColumnGroups are created index based, this method only works correctly with indexes rather than positions.

Parameters:
columnIndex - The column index of the column whose visibility state should be checked.
Returns:
true if the column at the specified index is hidden, false if it is visible.

getHiddenColumnIndexes

public abstract Collection<Integer> getHiddenColumnIndexes()
Will 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.

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

invalidateCache

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



Copyright © 2014. All rights reserved.