Class HierarchicalTreeLayer
- All Implemented Interfaces:
ILayer,ILayerListener,IUniqueIndexLayer,IPersistable
- Since:
- 1.6
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSimple node for remembering collapsed nodes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringLabel that gets applied to child cells of a collapsed parent object.protected final Set<HierarchicalTreeLayer.HierarchicalTreeNode>Set of tree node coordinates based on indexes that are collapsed.static final StringLabel that gets applied to cells in the level header columns.static final StringLabel that gets applied to child level cells if the row object does not contain an object for that level.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
ConstructorsConstructorDescriptionHierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames) HierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames, boolean useDefaultConfiguration) HierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames, SelectionLayer selectionLayer) HierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames, SelectionLayer selectionLayer, boolean useDefaultConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoidIfretainRemovedRowObjectNodesis set totrue, thecollapsedNodescould contain references to row objects that were deleted meanwhile.voidcleanupRetainedCollapsedNodes(HierarchicalWrapper rowObject) IfretainRemovedRowObjectNodesis set totrue, thecollapsedNodescould contain references to row objects that were deleted meanwhile.voidCollapses all tree nodes.booleandoCommand(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.voidExpands all tree nodes.voidexpandAllToLevel(int toLevel) Expands all tree nodes starting from the first level to the specified level.voidexpandOrCollapse(int columnIndex, int rowIndex) Expands or collapses the node at the given index coordinates according to its current state.voidexpandOrCollapse(int columnIndex, int rowIndex, int toLevel) Expands or collapses the node at the given index coordinates according to its current state.intfindTopRowIndex(int columnIndex, HierarchicalWrapper rowObject) Find the top row index for the given row object and the given column index.getCellByPosition(int columnPosition, int rowPosition) Returns the cell for the given coordinates on this layer.getCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry) Return theICellPainterfor the givenILayerCellat the given coordinates out of the givenIConfigRegistry.protected int[]getChildIndexes(int columnIndex, int rowIndex) Calculates the child row indexes for the node at the given coordinates.intintgetColumnIndexByPosition(int columnPosition) Gets the underlying non-transformed column index for the given column position on this layer.getColumnIndexesForLevel(int level) Returns all column indexes for a given level.intgetColumnPositionByIndex(int columnIndex) intgetColumnPositionByX(int x) Returns the column position that contains the given x coordinate.intgetColumnWidthByPosition(int columnPosition) Returns the width in pixels of the given column.getConfigLabelsByPosition(int columnPosition, int rowPosition) Returns the config labels for the cell at the given coordinates.getDataValueByPosition(int columnPosition, int rowPosition) Returns the data value for the cell at the given coordinates.getDisplayModeByPosition(int columnPosition, int rowPosition) Returns the activeDisplayModefor the cell at the given coordinates.Will collect and return all indexes of the rows that are hidden in this layer.int[]Will collect and return all indexes of the rows that are hidden in this layer.intgetLevelByColumnIndex(int columnIndex) Returns the level to which a given column index belongs to.intprotected intgetNumberOfColumnsToSelect(int levelHeaderPosition) Calculates the number of header columns to the right of a given level header column position.intprotected intintgetStartXOfColumnPosition(int columnPosition) Returns the x offset in pixels of the given column.protected IUniqueIndexLayerintgetWidth()Returns the total width in pixels of this layer.voidhandleLayerEvent(ILayerEvent event) Handle layer event notification.booleanCheck if this layer actively hides rows.protected booleanhasLevelObject(int columnPosition, int rowPosition) Test if the cell at the given coordinates belongs to a cell with an object for the corresponding level or not.booleanisCollapsed(int columnPosition, int rowPosition) Returns whether the cell at the given position is a collapsed node.booleanbooleanbooleanbooleanisLevelHeaderColumn(int columnPosition) Test if the column at the given position is a level header column.booleanbooleanisRowIndexHidden(int rowIndex) Will check if the row at the specified index is hidden or not.protected booleanisRowPositionInLevelSelected(int levelHeaderColumnPosition, int rowPosition) Test if a cell in the given row and a column belonging to the level of the given level header position is selected.booleanReturn whether columns in sub levels should be selected when selecting a level header cell or if only the cells in the same level should be selected.booleanprotected booleanisTreeColumn(int columnPosition) Test if the column at the given position is a tree column.booleanbooleanisValidTargetColumnPosition(int fromColumnPosition, int toColumnPosition) Checks if the column at the given from position can be reordered to the given to position.intlocalToUnderlyingColumnPosition(int localColumnPosition) Convert a column position to the coordinates of the underlying layer.voidsetExpandOnSearch(boolean expandOnSearch) Configure whether collapsed nodes should be expanded if they contain rows that are found on search or only the found row should be made visible by still keeping the nodes collapsed.voidsetHandleCollapsedChildren(boolean handleCollapsedChildren) Configure whethergetConfigLabelsByPosition(int, int)should add theCOLLAPSED_CHILDlabel to theLabelStack.voidsetHandleNoObjectsInLevel(boolean handleNoObjectsInLevel) Configure whethergetConfigLabelsByPosition(int, int)should add theNO_OBJECT_IN_LEVELlabel to theLabelStack.voidsetLevelHeaderWidth(int width) Set the column width for the level header columns.voidsetRetainRemovedRowObjectNodes(boolean retainRemovedRowObjectNodes) Configure whether collapsed nodes should be retained in thecollapsedNodeseven if the row object is not contained in the underlying list anymore.voidsetSelectSubLevels(boolean selectSubLevels) Configure whether columns in sub levels should be selected when selecting a level header cell or if only the cells in the same level should be selected.voidsetShowTreeLevelHeader(boolean show) Configure whether the tree level header should be shown or not.voidsetUseTreeColumnIndex(boolean useTreeColumnIndex) Configure whether (column index == 0) or (column position == 0) should be performed to identify the tree column.intunderlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) Transforms the column position relative to the given underlying layer to this layer coordinates.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.hideshow.AbstractRowHideShowLayer
cacheVisibleRowIndexes, getHeight, getRowCount, getRowIndexByPosition, getRowPositionByIndex, getRowPositionByY, getRowPositionsByIndexes, getRowPositionsByIndexes, getStartYOfRowPosition, invalidateCache, localToUnderlyingRowPosition, underlyingToLocalRowPosition, underlyingToLocalRowPositionsMethods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getRegionLabelsByXY, getRowHeightByPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, loadState, saveState, setClientAreaProvider, setUnderlyingLayerMethods 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, 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, getClientAreaProvider, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getRegionLabelsByXY, getRowHeightByPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, unregisterCommandHandler, unregisterPersistableMethods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
loadState, saveState
-
Field Details
-
LEVEL_HEADER_CELL
Label that gets applied to cells in the level header columns.- See Also:
-
COLLAPSED_CHILD
Label that gets applied to child cells of a collapsed parent object.- See Also:
-
NO_OBJECT_IN_LEVEL
Label that gets applied to child level cells if the row object does not contain an object for that level.- See Also:
-
collapsedNodes
Set of tree node coordinates based on indexes that are collapsed.
-
-
Constructor Details
-
HierarchicalTreeLayer
public HierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames) - Parameters:
underlyingLayer- The underlying layer this layer is stacked on.underlyingList- The collection with theHierarchicalWrapperobjects that is shown in the table. Needed to perform expand/collapse actions.propertyNames- The property names to access the object properties of the wrapped objects inside theHierarchicalWrapper. Needed to determine the levels.
-
HierarchicalTreeLayer
public HierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames, boolean useDefaultConfiguration) - Parameters:
underlyingLayer- The underlying layer this layer is stacked on.underlyingList- The collection with theHierarchicalWrapperobjects that is shown in the table. Needed to perform expand/collapse actions.propertyNames- The property names to access the object properties of the wrapped objects inside theHierarchicalWrapper. Needed to determine the levels.useDefaultConfiguration-trueif theDefaultHierarchicalTreeLayerConfigurationshould be added,falseif not.
-
HierarchicalTreeLayer
public HierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames, SelectionLayer selectionLayer) - Parameters:
underlyingLayer- The underlying layer this layer is stacked on.underlyingList- The collection with theHierarchicalWrapperobjects that is shown in the table. Needed to perform expand/collapse actions.propertyNames- The property names to access the object properties of the wrapped objects inside theHierarchicalWrapper. Needed to determine the levels.selectionLayer- TheSelectionLayerneeded to calculate selections for the level header column. Can benullwhich leads to not showing selections in the level header.
-
HierarchicalTreeLayer
public HierarchicalTreeLayer(IUniqueIndexLayer underlyingLayer, List<HierarchicalWrapper> underlyingList, String[] propertyNames, SelectionLayer selectionLayer, boolean useDefaultConfiguration) - Parameters:
underlyingLayer- The underlying layer this layer is stacked on.underlyingList- The collection with theHierarchicalWrapperobjects that is shown in the table. Needed to perform expand/collapse actions.propertyNames- The property names to access the object properties of the wrapped objects inside theHierarchicalWrapper. Needed to determine the levels.selectionLayer- TheSelectionLayerneeded to calculate selections for the level header column. Can benullwhich leads to not showing selections in the level header.useDefaultConfiguration-trueif theDefaultHierarchicalTreeLayerConfigurationshould be added,falseif not.
-
-
Method Details
-
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 classAbstractRowHideShowLayer- Parameters:
command- The command to execute.- Returns:
trueif the command has been handled and was therefore consumed,falseotherwise.
-
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 classAbstractRowHideShowLayer- Parameters:
event- the event
-
getConfigLabelsByPosition
Description copied from interface:ILayerReturns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry.- Specified by:
getConfigLabelsByPositionin interfaceILayer- Overrides:
getConfigLabelsByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
- The
LabelStackwith the config labels for the cell at the given coordinates.
-
getCellPainter
public ICellPainter getCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry) Description copied from interface:ILayerReturn theICellPainterfor the givenILayerCellat the given coordinates out of the givenIConfigRegistry.- Specified by:
getCellPainterin interfaceILayer- Overrides:
getCellPainterin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.cell- TheILayerCellfor which theICellPainteris requested.configRegistry- TheIConfigRegistryto retrieve the painter from.- Returns:
- The
ICellPainterfor the given cell at the given coordinates ornullif no painter is configured.
-
getCellByPosition
Description copied from interface:ILayerReturns the cell for the given coordinates on this layer.- Specified by:
getCellByPositionin interfaceILayer- Overrides:
getCellByPositionin classAbstractRowHideShowLayer- 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.
-
getDataValueByPosition
Description copied from interface:ILayerReturns the data value for the cell at the given coordinates.- Specified by:
getDataValueByPositionin interfaceILayer- Overrides:
getDataValueByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
- The data value for the cell at the given coordinates.
-
getDisplayModeByPosition
Description copied from interface:ILayerReturns the activeDisplayModefor the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry. The default value isDisplayMode.NORMAL. The SelectionLayer for example overrides this to returnDisplayMode.SELECTfor cells that are currently selected.- Specified by:
getDisplayModeByPositionin interfaceILayer- Overrides:
getDisplayModeByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
DisplayModefor the cell at the given coordinates.
-
isRowPositionInLevelSelected
protected boolean isRowPositionInLevelSelected(int levelHeaderColumnPosition, int rowPosition) Test if a cell in the given row and a column belonging to the level of the given level header position is selected.- Parameters:
levelHeaderColumnPosition- The column position of the level header column.rowPosition- The row position.- Returns:
trueif a cell in the given row is selected in the level of the level header position,falseif not.
-
getNumberOfColumnsToSelect
protected int getNumberOfColumnsToSelect(int levelHeaderPosition) Calculates the number of header columns to the right of a given level header column position.- Parameters:
levelHeaderPosition- The column position of a level header column.- Returns:
- The number of columns to select when a level header column is selected.
-
isTreeColumn
protected boolean isTreeColumn(int columnPosition) Test if the column at the given position is a tree column.- Parameters:
columnPosition- The column position to check.- Returns:
trueif the given position is a tree column,falseif it is a content column.
-
isLevelHeaderColumn
public boolean isLevelHeaderColumn(int columnPosition) Test if the column at the given position is a level header column.- Parameters:
columnPosition- The column position to check.- Returns:
trueif the given position is a level header column,falseif it is a content column.
-
hasLevelObject
protected boolean hasLevelObject(int columnPosition, int rowPosition) Test if the cell at the given coordinates belongs to a cell with an object for the corresponding level or not.- Parameters:
columnPosition- The column position to check.rowPosition- The row position to check.- Returns:
trueif there is a level object for the corresponding level,falseif there is no level object.
-
getLevelByColumnIndex
public int getLevelByColumnIndex(int columnIndex) Returns the level to which a given column index belongs to.- Parameters:
columnIndex- The column index for which the level is requested.- Returns:
- The level to which the given column index belongs to or -1 if the columnIndex is invalid.
-
getColumnIndexesForLevel
Returns all column indexes for a given level.- Parameters:
level- The level for which the column indexes are requested.- Returns:
- The column indexes of the columns that belong to the given level.
-
getLevelIndexMapping
- Returns:
- Mapping of the level to the list of the columns belonging to the level.
-
isRowIndexHidden
public boolean isRowIndexHidden(int rowIndex) Description copied from class:AbstractRowHideShowLayerWill check if the row at the specified index is hidden or not. Checks this layer and also the sublayers for the visibility.- Specified by:
isRowIndexHiddenin classAbstractRowHideShowLayer- 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
Description copied from class:AbstractRowHideShowLayerWill 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
AbstractRowHideShowLayer.getHiddenRowIndexesArray()to avoid unnecessary autoboxing operations.- Specified by:
getHiddenRowIndexesin classAbstractRowHideShowLayer- Returns:
- Collection of all row indexes that are hidden in this layer.
-
getHiddenRowIndexesArray
public int[] getHiddenRowIndexesArray()Description copied from class:AbstractRowHideShowLayerWill 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.
- Specified by:
getHiddenRowIndexesArrayin classAbstractRowHideShowLayer- Returns:
- All row indexes that are hidden in this layer.
-
hasHiddenRows
public boolean hasHiddenRows()Description copied from class:AbstractRowHideShowLayerCheck if this layer actively hides rows.- Specified by:
hasHiddenRowsin classAbstractRowHideShowLayer- Returns:
trueif rows are hidden by this layer,falseif not.
-
expandOrCollapse
public void expandOrCollapse(int columnIndex, int rowIndex) Expands or collapses the node at the given index coordinates according to its current state.- Parameters:
columnIndex- The column index of the node to handle.rowIndex- The row index of the node to handle.
-
expandOrCollapse
public void expandOrCollapse(int columnIndex, int rowIndex, int toLevel) Expands or collapses the node at the given index coordinates according to its current state. Expands to the given level, e.g. if toLevel 0 is given, only the first level of a row is expanded, given toLevel is 1 and a node in the first level should be expanded, that node will be expanded as well as all collapsed nodes in the second level for this object.- Parameters:
columnIndex- The column index of the node to handle.rowIndex- The row index of the node to handle.toLevel- 0 based hierarchy level to expand to. Will be ignored on collapse or if value is -1.Note: This is the level to expand to, not the number of levels to expand from the expanded level.
-
collapseAll
public void collapseAll()Collapses all tree nodes. -
expandAll
public void expandAll()Expands all tree nodes. -
expandAllToLevel
public void expandAllToLevel(int toLevel) Expands all tree nodes starting from the first level to the specified level.- Parameters:
toLevel- 0 based hierarchy level to expand to. A negative value will be defaulted to 0 to at least expand the first level.
-
getChildIndexes
protected int[] getChildIndexes(int columnIndex, int rowIndex) Calculates the child row indexes for the node at the given coordinates.- Parameters:
columnIndex- The column index of the node whose children are requested.rowIndex- The row index of the node whose children are requested.- Returns:
- The row indexes for the children of the node at the given coordinates.
- Since:
- 2.0
-
findTopRowIndex
Find the top row index for the given row object and the given column index. Used to determine the row index of the top row so the node coordinates can be correctly calculated.- Parameters:
columnIndex- The column index to determine the level for the necessary level object checks.rowObject- The row object that builds a node.- Returns:
- The row index of the top most row of a spanned cell that determines a node.
-
isCollapsed
public boolean isCollapsed(int columnPosition, int rowPosition) Returns whether the cell at the given position is a collapsed node.- Parameters:
columnPosition- The column position of the cell to check.rowPosition- The row position of the cell to check.- Returns:
trueif the cell at the given coordinates is a collapsed node,falseif not.
-
getCollapsedNodes
- Returns:
- The set of tree node coordinates based on indexes that are collapsed.
-
isUseTreeColumnIndex
public boolean isUseTreeColumnIndex()- Returns:
trueif the column index is used to determine the tree column,falseif the column position is used. Default isfalse.
-
setUseTreeColumnIndex
public void setUseTreeColumnIndex(boolean useTreeColumnIndex) Configure whether (column index == 0) or (column position == 0) should be performed to identify the tree column.- Parameters:
useTreeColumnIndex-trueif the column index should be used to determine the tree column,falseif the column position should be used.
-
isShowTreeLevelHeader
public boolean isShowTreeLevelHeader()- Returns:
trueif the tree level header is shown,falseif not.
-
setShowTreeLevelHeader
public void setShowTreeLevelHeader(boolean show) Configure whether the tree level header should be shown or not.- Parameters:
show-trueif the tree level header should be shown,falseif not.
-
isHandleCollapsedChildren
public boolean isHandleCollapsedChildren()- Returns:
trueifgetConfigLabelsByPosition(int, int)adds theCOLLAPSED_CHILDlabel to theLabelStack,falseif that processing is not performed.
-
setHandleCollapsedChildren
public void setHandleCollapsedChildren(boolean handleCollapsedChildren) Configure whethergetConfigLabelsByPosition(int, int)should add theCOLLAPSED_CHILDlabel to theLabelStack. Enabling this configuration allows a different configuration for child cells of collapsed rows, e.g. different styles like no content painter or different background.- Parameters:
handleCollapsedChildren-trueifgetConfigLabelsByPosition(int, int)should add theCOLLAPSED_CHILDlabel to theLabelStack,falseif that processing should not be performed.
-
isHandleNoObjectsInLevel
public boolean isHandleNoObjectsInLevel()- Returns:
trueifgetConfigLabelsByPosition(int, int)adds theNO_OBJECT_IN_LEVELlabel to theLabelStack,falseif that processing is not performed.
-
setHandleNoObjectsInLevel
public void setHandleNoObjectsInLevel(boolean handleNoObjectsInLevel) Configure whethergetConfigLabelsByPosition(int, int)should add theNO_OBJECT_IN_LEVELlabel to theLabelStack. Enabling this configuration allows a different configuration for child cells of row objects that have no object for a child level, e.g. making those cells not editable and different styles like no content painter or different background.Note: To identify level cells without a level object a deep inspection needs to be performed, which might cause a negative effect on the rendering performance. The handling is enabled by default, but if the underlying data model does not support empty level objects or the table configuration supports editing of such cells by automatically adding level objects on edit, it is recommended to disable this feature.
- Parameters:
handleNoObjectsInLevel-trueifgetConfigLabelsByPosition(int, int)should add theNO_OBJECT_IN_LEVELlabel to theLabelStack,falseif that processing should not be performed.
-
isRetainRemovedRowObjectNodes
public boolean isRetainRemovedRowObjectNodes()- Returns:
trueif collapsed nodes are retained even if the corresponding row object is removed from the underlying list.falseif the collapsed nodes are removed if the referenced row object is not contained anymore. Default istrue.
-
setRetainRemovedRowObjectNodes
public void setRetainRemovedRowObjectNodes(boolean retainRemovedRowObjectNodes) Configure whether collapsed nodes should be retained in thecollapsedNodeseven if the row object is not contained in the underlying list anymore. This can for example happen when using a FilterList, as filtering will remove the row objects from that list. Without using a FilterList or supporting deleting rows, it is suggested to set this flag tofalseto avoid memory leaks on deleting an object.- Parameters:
retainRemovedRowObjectNodes-trueto keep collapse nodes even if the corresponding row object is removed from the underlying list.falseif the collapsed nodes should not contain references to removed row objects. Default istrue.
-
cleanupRetainedCollapsedNodes
public void cleanupRetainedCollapsedNodes()IfretainRemovedRowObjectNodesis set totrue, thecollapsedNodescould contain references to row objects that were deleted meanwhile. To deal with this and avoid memory leaks, this method can be called to remove any collapsed node that has a reference to a non existing row object. -
cleanupRetainedCollapsedNodes
IfretainRemovedRowObjectNodesis set totrue, thecollapsedNodescould contain references to row objects that were deleted meanwhile. To deal with this and avoid memory leaks, this method can be called to remove a collapsed node that references the given row object which for example is removed from the underlying collection.- Parameters:
rowObject- The row object that was removed from the underlying list, to be able to cleanup a collapsed node reference.
-
isExpandOnSearch
public boolean isExpandOnSearch()- Returns:
trueif collapsed nodes are expanded if they contain rows that are found on search.falseif only the found row is made visible by still keeping the nodes collapsed. Default istrue.
-
setExpandOnSearch
public void setExpandOnSearch(boolean expandOnSearch) Configure whether collapsed nodes should be expanded if they contain rows that are found on search or only the found row should be made visible by still keeping the nodes collapsed.- Parameters:
expandOnSearch-trueif collapsed nodes should be expanded if they contain rows that are found on search.falseif only the found row should be made visible by still keeping the nodes collapsed.
-
isSelectSubLevels
public boolean isSelectSubLevels()Return whether columns in sub levels should be selected when selecting a level header cell or if only the cells in the same level should be selected. Default isfalse.- Returns:
trueif columns in sub levels are selected when selecting a level header cell,falseif only the cells in the same level are selected.
-
setSelectSubLevels
public void setSelectSubLevels(boolean selectSubLevels) Configure whether columns in sub levels should be selected when selecting a level header cell or if only the cells in the same level should be selected. Default isfalse.- Parameters:
selectSubLevels-trueif columns in sub levels should be selected when selecting a level header cell,falseif only the cells in the same level should be selected.
-
getUnderlyingLayer
- Overrides:
getUnderlyingLayerin classAbstractRowHideShowLayer- Returns:
- The underlying layer.
-
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- Overrides:
getColumnPositionByIndexin classAbstractRowHideShowLayer
-
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.
-
isValidTargetColumnPosition
public boolean isValidTargetColumnPosition(int fromColumnPosition, int toColumnPosition) Checks if the column at the given from position can be reordered to the given to position. Mainly performs a check if the column at the given from position is a level header (which can not be reordered) or if the reordering would mean to move a column into a different level, which is also forbidden.- Parameters:
fromColumnPosition- The position of the column to reorder.toColumnPosition- The position to move the column to.- Returns:
trueif reordering would be valid,falsein case the column at the from position is a level header column or the move would be a level change.
-
getLevelHeaderWidth
public int getLevelHeaderWidth()- Returns:
- The column width of the level header columns in pixel.
-
setLevelHeaderWidth
public void setLevelHeaderWidth(int width) Set the column width for the level header columns.- Parameters:
width- The column width in pixels that should be used for the level header columns.
-
getScaledLevelHeaderWidth
protected int getScaledLevelHeaderWidth()- Returns:
- The level header width in DPI.
-
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.
-
getPreferredWidth
public int getPreferredWidth()- Specified by:
getPreferredWidthin interfaceILayer- Overrides:
getPreferredWidthin classAbstractLayerTransform
-
getColumnWidthByPosition
public int getColumnWidthByPosition(int columnPosition) Description copied from interface:ILayerReturns the width in pixels of the given column. The width of invisible and non-existing columns is 0.- Specified by:
getColumnWidthByPositionin interfaceILayer- Overrides:
getColumnWidthByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position in this layer.- Returns:
- The width of the column.
-
getStartXOfColumnPosition
public int getStartXOfColumnPosition(int columnPosition) Description copied from interface:ILayerReturns the x offset in pixels of the given column.- Specified by:
getStartXOfColumnPositionin interfaceILayer- Overrides:
getStartXOfColumnPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position in this layer.- Returns:
- The x offset of the column, or -1.
-
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.
-
getProvidedLabels
- Specified by:
getProvidedLabelsin interfaceILayer- Overrides:
getProvidedLabelsin classAbstractLayer- Returns:
- The collection of labels that are provided by this layer.
-