Class HierarchicalTreeLayer
- All Implemented Interfaces:
ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
- Since:
- 1.6
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Simple node for remembering collapsed nodes. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Label 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 String
Label that gets applied to cells in the level header columns.static final String
Label 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
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
ConstructorDescriptionHierarchicalTreeLayer
(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 TypeMethodDescriptionvoid
IfretainRemovedRowObjectNodes
is set totrue
, thecollapsedNodes
could contain references to row objects that were deleted meanwhile.void
cleanupRetainedCollapsedNodes
(HierarchicalWrapper rowObject) IfretainRemovedRowObjectNodes
is set totrue
, thecollapsedNodes
could contain references to row objects that were deleted meanwhile.void
Collapses all tree nodes.boolean
doCommand
(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.void
Expands all tree nodes.void
expandAllToLevel
(int toLevel) Expands all tree nodes starting from the first level to the specified level.void
expandOrCollapse
(int columnIndex, int rowIndex) Expands or collapses the node at the given index coordinates according to its current state.void
expandOrCollapse
(int columnIndex, int rowIndex, int toLevel) Expands or collapses the node at the given index coordinates according to its current state.int
findTopRowIndex
(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 theICellPainter
for the givenILayerCell
at 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.int
int
getColumnIndexByPosition
(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.int
getColumnPositionByIndex
(int columnIndex) int
getColumnPositionByX
(int x) Returns the column position that contains the given x coordinate.int
getColumnWidthByPosition
(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 activeDisplayMode
for 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.int
getLevelByColumnIndex
(int columnIndex) Returns the level to which a given column index belongs to.int
protected int
getNumberOfColumnsToSelect
(int levelHeaderPosition) Calculates the number of header columns to the right of a given level header column position.int
protected int
int
getStartXOfColumnPosition
(int columnPosition) Returns the x offset in pixels of the given column.protected IUniqueIndexLayer
int
getWidth()
Returns the total width in pixels of this layer.void
handleLayerEvent
(ILayerEvent event) Handle layer event notification.boolean
Check if this layer actively hides rows.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.boolean
isCollapsed
(int columnPosition, int rowPosition) Returns whether the cell at the given position is a collapsed node.boolean
boolean
boolean
boolean
isLevelHeaderColumn
(int columnPosition) Test if the column at the given position is a level header column.boolean
boolean
isRowIndexHidden
(int rowIndex) Will check if the row at the specified index is hidden or not.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.boolean
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.boolean
protected boolean
isTreeColumn
(int columnPosition) Test if the column at the given position is a tree column.boolean
boolean
isValidTargetColumnPosition
(int fromColumnPosition, int toColumnPosition) Checks if the column at the given from position can be reordered to the given to position.int
localToUnderlyingColumnPosition
(int localColumnPosition) Convert a column position to the coordinates of the underlying layer.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.void
setHandleCollapsedChildren
(boolean handleCollapsedChildren) Configure whethergetConfigLabelsByPosition(int, int)
should add theCOLLAPSED_CHILD
label to theLabelStack
.void
setHandleNoObjectsInLevel
(boolean handleNoObjectsInLevel) Configure whethergetConfigLabelsByPosition(int, int)
should add theNO_OBJECT_IN_LEVEL
label to theLabelStack
.void
setLevelHeaderWidth
(int width) Set the column width for the level header columns.void
setRetainRemovedRowObjectNodes
(boolean retainRemovedRowObjectNodes) Configure whether collapsed nodes should be retained in thecollapsedNodes
even if the row object is not contained in the underlying list anymore.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.void
setShowTreeLevelHeader
(boolean show) Configure whether the tree level header should be shown or not.void
setUseTreeColumnIndex
(boolean useTreeColumnIndex) Configure whether (column index == 0) or (column position == 0) should be performed to identify the tree column.int
underlyingToLocalColumnPosition
(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, underlyingToLocalRowPositions
Methods 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, setUnderlyingLayer
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, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getRegionLabelsByXY, getRowHeightByPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, unregisterCommandHandler, unregisterPersistable
Methods 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 theHierarchicalWrapper
objects 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 theHierarchicalWrapper
objects 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
-true
if theDefaultHierarchicalTreeLayerConfiguration
should be added,false
if 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 theHierarchicalWrapper
objects 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
- TheSelectionLayer
needed to calculate selections for the level header column. Can benull
which 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 theHierarchicalWrapper
objects 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
- TheSelectionLayer
needed to calculate selections for the level header column. Can benull
which leads to not showing selections in the level header.useDefaultConfiguration
-true
if theDefaultHierarchicalTreeLayerConfiguration
should be added,false
if not.
-
-
Method Details
-
doCommand
Description copied from interface:ILayer
Opportunity 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:
doCommand
in interfaceILayer
- Overrides:
doCommand
in classAbstractRowHideShowLayer
- Parameters:
command
- The command to execute.- Returns:
true
if the command has been handled and was therefore consumed,false
otherwise.
-
handleLayerEvent
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 classAbstractRowHideShowLayer
- Parameters:
event
- the event
-
getConfigLabelsByPosition
Description copied from interface:ILayer
Returns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry
.- Specified by:
getConfigLabelsByPosition
in interfaceILayer
- Overrides:
getConfigLabelsByPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.- Returns:
- The
LabelStack
with 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:ILayer
Return theICellPainter
for the givenILayerCell
at the given coordinates out of the givenIConfigRegistry
.- Specified by:
getCellPainter
in interfaceILayer
- Overrides:
getCellPainter
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.cell
- TheILayerCell
for which theICellPainter
is requested.configRegistry
- TheIConfigRegistry
to retrieve the painter from.- Returns:
- The
ICellPainter
for the given cell at the given coordinates ornull
if no painter is configured.
-
getCellByPosition
Description copied from interface:ILayer
Returns the cell for the given coordinates on this layer.- Specified by:
getCellByPosition
in interfaceILayer
- Overrides:
getCellByPosition
in classAbstractRowHideShowLayer
- 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.
-
getDataValueByPosition
Description copied from interface:ILayer
Returns the data value for the cell at the given coordinates.- Specified by:
getDataValueByPosition
in interfaceILayer
- Overrides:
getDataValueByPosition
in 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:ILayer
Returns the activeDisplayMode
for 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.SELECT
for cells that are currently selected.- Specified by:
getDisplayModeByPosition
in interfaceILayer
- Overrides:
getDisplayModeByPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.- Returns:
DisplayMode
for 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:
true
if a cell in the given row is selected in the level of the level header position,false
if 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:
true
if the given position is a tree column,false
if 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:
true
if the given position is a level header column,false
if 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:
true
if there is a level object for the corresponding level,false
if 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:AbstractRowHideShowLayer
Will check if the row at the specified index is hidden or not. Checks this layer and also the sublayers for the visibility.- Specified by:
isRowIndexHidden
in classAbstractRowHideShowLayer
- 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
Description copied from class:AbstractRowHideShowLayer
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
AbstractRowHideShowLayer.getHiddenRowIndexesArray()
to avoid unnecessary autoboxing operations.- Specified by:
getHiddenRowIndexes
in classAbstractRowHideShowLayer
- Returns:
- Collection of all row indexes that are hidden in this layer.
-
getHiddenRowIndexesArray
public int[] getHiddenRowIndexesArray()Description copied from class:AbstractRowHideShowLayer
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.
- Specified by:
getHiddenRowIndexesArray
in classAbstractRowHideShowLayer
- Returns:
- All row indexes that are hidden in this layer.
-
hasHiddenRows
public boolean hasHiddenRows()Description copied from class:AbstractRowHideShowLayer
Check if this layer actively hides rows.- Specified by:
hasHiddenRows
in classAbstractRowHideShowLayer
- Returns:
true
if rows are hidden by this layer,false
if 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:
true
if the cell at the given coordinates is a collapsed node,false
if not.
-
getCollapsedNodes
- Returns:
- The set of tree node coordinates based on indexes that are collapsed.
-
isUseTreeColumnIndex
public boolean isUseTreeColumnIndex()- Returns:
true
if the column index is used to determine the tree column,false
if 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
-true
if the column index should be used to determine the tree column,false
if the column position should be used.
-
isShowTreeLevelHeader
public boolean isShowTreeLevelHeader()- Returns:
true
if the tree level header is shown,false
if not.
-
setShowTreeLevelHeader
public void setShowTreeLevelHeader(boolean show) Configure whether the tree level header should be shown or not.- Parameters:
show
-true
if the tree level header should be shown,false
if not.
-
isHandleCollapsedChildren
public boolean isHandleCollapsedChildren()- Returns:
true
ifgetConfigLabelsByPosition(int, int)
adds theCOLLAPSED_CHILD
label to theLabelStack
,false
if that processing is not performed.
-
setHandleCollapsedChildren
public void setHandleCollapsedChildren(boolean handleCollapsedChildren) Configure whethergetConfigLabelsByPosition(int, int)
should add theCOLLAPSED_CHILD
label 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
-true
ifgetConfigLabelsByPosition(int, int)
should add theCOLLAPSED_CHILD
label to theLabelStack
,false
if that processing should not be performed.
-
isHandleNoObjectsInLevel
public boolean isHandleNoObjectsInLevel()- Returns:
true
ifgetConfigLabelsByPosition(int, int)
adds theNO_OBJECT_IN_LEVEL
label to theLabelStack
,false
if that processing is not performed.
-
setHandleNoObjectsInLevel
public void setHandleNoObjectsInLevel(boolean handleNoObjectsInLevel) Configure whethergetConfigLabelsByPosition(int, int)
should add theNO_OBJECT_IN_LEVEL
label 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
-true
ifgetConfigLabelsByPosition(int, int)
should add theNO_OBJECT_IN_LEVEL
label to theLabelStack
,false
if that processing should not be performed.
-
isRetainRemovedRowObjectNodes
public boolean isRetainRemovedRowObjectNodes()- Returns:
true
if collapsed nodes are retained even if the corresponding row object is removed from the underlying list.false
if 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 thecollapsedNodes
even 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 tofalse
to avoid memory leaks on deleting an object.- Parameters:
retainRemovedRowObjectNodes
-true
to keep collapse nodes even if the corresponding row object is removed from the underlying list.false
if the collapsed nodes should not contain references to removed row objects. Default istrue
.
-
cleanupRetainedCollapsedNodes
public void cleanupRetainedCollapsedNodes()IfretainRemovedRowObjectNodes
is set totrue
, thecollapsedNodes
could 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
IfretainRemovedRowObjectNodes
is set totrue
, thecollapsedNodes
could 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:
true
if collapsed nodes are expanded if they contain rows that are found on search.false
if 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
-true
if collapsed nodes should be expanded if they contain rows that are found on search.false
if 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:
true
if columns in sub levels are selected when selecting a level header cell,false
if 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
-true
if columns in sub levels should be selected when selecting a level header cell,false
if only the cells in the same level should be selected.
-
getUnderlyingLayer
- Overrides:
getUnderlyingLayer
in classAbstractRowHideShowLayer
- Returns:
- The underlying layer.
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceILayer
- Overrides:
getColumnCount
in classAbstractLayerTransform
- Returns:
- The number of columns in this layer.
-
getColumnIndexByPosition
public int getColumnIndexByPosition(int columnPosition) Description copied from interface:ILayer
Gets the underlying non-transformed column index for the given column position on this layer.- Specified by:
getColumnIndexByPosition
in interfaceILayer
- Overrides:
getColumnIndexByPosition
in 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:
getColumnPositionByIndex
in interfaceIUniqueIndexLayer
- Overrides:
getColumnPositionByIndex
in classAbstractRowHideShowLayer
-
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 interfaceILayer
- Overrides:
localToUnderlyingColumnPosition
in 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:ILayer
Transforms the column position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPosition
in interfaceILayer
- Overrides:
underlyingToLocalColumnPosition
in 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:ILayer
Transforms the column position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPositions
in interfaceILayer
- Overrides:
underlyingToLocalColumnPositions
in 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:
true
if reordering would be valid,false
in 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:ILayer
Returns the total width in pixels of this layer.- Specified by:
getWidth
in interfaceILayer
- Overrides:
getWidth
in classAbstractLayerTransform
- Returns:
- The total width in pixels of this layer.
-
getPreferredWidth
public int getPreferredWidth()- Specified by:
getPreferredWidth
in interfaceILayer
- Overrides:
getPreferredWidth
in classAbstractLayerTransform
-
getColumnWidthByPosition
public int getColumnWidthByPosition(int columnPosition) Description copied from interface:ILayer
Returns the width in pixels of the given column. The width of invisible and non-existing columns is 0.- Specified by:
getColumnWidthByPosition
in interfaceILayer
- Overrides:
getColumnWidthByPosition
in 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:ILayer
Returns the x offset in pixels of the given column.- Specified by:
getStartXOfColumnPosition
in interfaceILayer
- Overrides:
getStartXOfColumnPosition
in 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:ILayer
Returns the column position that contains the given x coordinate.- Specified by:
getColumnPositionByX
in interfaceILayer
- Overrides:
getColumnPositionByX
in 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:
getProvidedLabels
in interfaceILayer
- Overrides:
getProvidedLabels
in classAbstractLayer
- Returns:
- The collection of labels that are provided by this layer.
-