Class AbstractColumnHideShowLayer
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
-
- org.eclipse.nebula.widgets.nattable.hideshow.AbstractColumnHideShowLayer
-
- All Implemented Interfaces:
ILayer,ILayerListener,IUniqueIndexLayer,IPersistable
- Direct Known Subclasses:
ColumnGroupExpandCollapseLayer,ColumnGroupExpandCollapseLayer,ColumnHideShowLayer
public abstract class AbstractColumnHideShowLayer extends AbstractLayerTransform implements IUniqueIndexLayer
Abstract implementation for column 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 AbstractColumnHideShowLayer(IUniqueIndexLayer underlyingLayer)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcacheVisibleColumnIndexes()Build up the column caches.ILayerCellgetCellByPosition(int columnPosition, int rowPosition)Returns the cell for the given coordinates on this layer.intgetColumnCount()intgetColumnIndexByPosition(int columnPosition)Gets the underlying non-transformed column index for the given column position on this layer.intgetColumnPositionByIndex(int columnIndex)intgetColumnPositionByX(int x)Returns the column position that contains the given x coordinate.int[]getColumnPositionsByIndexes(int... columnIndexes)Get the local column positions for the given column indexes.Collection<Integer>getColumnPositionsByIndexes(Collection<Integer> columnIndexes)Get the local column positions for the given column indexes.abstract Collection<Integer>getHiddenColumnIndexes()Will collect and return all indexes of the columns that are hidden in this layer.abstract int[]getHiddenColumnIndexesArray()Will collect and return all indexes of the columns that are hidden in this layer.intgetRowPositionByIndex(int rowIndex)intgetStartXOfColumnPosition(int localColumnPosition)Returns the x offset in pixels of the given column.protected IUniqueIndexLayergetUnderlyingLayer()intgetWidth()Returns the total width in pixels of this layer.voidhandleLayerEvent(ILayerEvent event)Handle layer event notification.abstract booleanhasHiddenColumns()Check if this layer actively hides columns.protected voidinvalidateCache()Invalidate the cache to ensure that information is rebuild.abstract booleanisColumnIndexHidden(int columnIndex)Will check if the column at the specified index is hidden or not.intlocalToUnderlyingColumnPosition(int localColumnPosition)Convert a column position to the coordinates of the underlying layer.intunderlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition)Transforms the column position relative to the given underlying layer to this layer coordinates.Collection<Range>underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)Transforms the column 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, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, isColumnPositionResizable, isDynamicSizeLayer, 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, 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, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getProvidedLabels, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, 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)
Constructor.- Parameters:
underlyingLayer- The underlying layer.
-
-
Method Detail
-
getUnderlyingLayer
protected IUniqueIndexLayer getUnderlyingLayer()
- Overrides:
getUnderlyingLayerin classAbstractLayerTransform- Returns:
- The underlying layer.
- Since:
- 2.0
-
handleLayerEvent
public void handleLayerEvent(ILayerEvent event)
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
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCountin interfaceILayer- Overrides:
getColumnCountin classAbstractLayerTransform- Returns:
- The number of columns in this layer.
-
getColumnIndexByPosition
public int getColumnIndexByPosition(int columnPosition)
Description copied from interface:ILayerGets the underlying non-transformed column index for the given column position on this layer.- Specified by:
getColumnIndexByPositionin interfaceILayer- Overrides:
getColumnIndexByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position relative to this layer.- 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:
getColumnPositionByIndexin interfaceIUniqueIndexLayer
-
getColumnPositionsByIndexes
public Collection<Integer> getColumnPositionsByIndexes(Collection<Integer> columnIndexes)
Get the local column positions for the given column indexes.- Parameters:
columnIndexes- The column indexes for which the local column positions are requested.- Returns:
- The local column positions for the given column indexes.
-
getColumnPositionsByIndexes
public int[] getColumnPositionsByIndexes(int... columnIndexes)
Get the local column positions for the given column indexes.- Parameters:
columnIndexes- The column indexes for which the local column positions are requested.- Returns:
- The local column positions for the given column indexes.
- Since:
- 2.0
-
localToUnderlyingColumnPosition
public int localToUnderlyingColumnPosition(int localColumnPosition)
Description copied from interface:ILayerConvert a column position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingColumnPositionin interfaceILayer- Overrides:
localToUnderlyingColumnPositionin classAbstractLayerTransform- 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)
Description copied from interface:ILayerTransforms the column position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPositionin interfaceILayer- Overrides:
underlyingToLocalColumnPositionin classAbstractLayerTransform- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given column position matches.underlyingColumnPosition- The column position in the given underlying layer that should be converted to a local column position.- Returns:
- The given column position transformed to be local to this layer.
-
underlyingToLocalColumnPositions
public Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges)
Description copied from interface:ILayerTransforms the column position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPositionsin interfaceILayer- Overrides:
underlyingToLocalColumnPositionsin classAbstractLayerTransform- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given column positions match.underlyingColumnPositionRanges- The column position ranges relative to the given underlying layer that should be converted to local column positions.- Returns:
- The given column position ranges transformed to this layer.
-
getWidth
public int getWidth()
Description copied from interface:ILayerReturns the total width in pixels of this layer.- Specified by:
getWidthin interfaceILayer- Overrides:
getWidthin classAbstractLayerTransform- Returns:
- The total width in pixels of this layer.
-
getColumnPositionByX
public int getColumnPositionByX(int x)
Description copied from interface:ILayerReturns the column position that contains the given x coordinate.- Specified by:
getColumnPositionByXin interfaceILayer- Overrides:
getColumnPositionByXin classAbstractLayerTransform- 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:ILayerReturns the x offset in pixels of the given column.- Specified by:
getStartXOfColumnPositionin interfaceILayer- Overrides:
getStartXOfColumnPositionin classAbstractLayerTransform- 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:
getRowPositionByIndexin interfaceIUniqueIndexLayer
-
isColumnIndexHidden
public abstract boolean isColumnIndexHidden(int columnIndex)
Will check if the column at the specified index is hidden or not.- Parameters:
columnIndex- The column index of the column whose visibility state should be checked.- Returns:
trueif the column at the specified index is hidden,falseif 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.
Since 2.0 it is recommended to use
getHiddenColumnIndexesArray()to avoid unnecessary autoboxing operations.- Returns:
- Collection of all column indexes that are hidden in this layer.
-
getHiddenColumnIndexesArray
public abstract int[] getHiddenColumnIndexesArray()
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:
- All column indexes that are hidden in this layer.
- Since:
- 2.0
-
hasHiddenColumns
public abstract boolean hasHiddenColumns()
Check if this layer actively hides columns.- Returns:
trueif columns are hidden by this layer,falseif not.- Since:
- 2.0
-
getCellByPosition
public ILayerCell getCellByPosition(int columnPosition, int rowPosition)
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.
-
cacheVisibleColumnIndexes
protected void cacheVisibleColumnIndexes()
Build up the column caches.- Since:
- 2.0
-
-