public class HierarchicalSpanningDataProvider extends Object implements ISpanningDataProvider
ISpanningDataProvider will span cells if the
level objects of the HierarchicalWrapper row objects are actually the
same in the same column. With this spanning the hierarchical object graph can
be visually represented as the parent objects will be shown in a single
spanned cell for all child rows.
It wraps the IRowDataProvider that is used for providing the
normalized hierarchical object data to the NatTable.
| Constructor and Description |
|---|
HierarchicalSpanningDataProvider(IRowDataProvider<HierarchicalWrapper> underlyingDataProvider,
List<String> propertyNames) |
HierarchicalSpanningDataProvider(IRowDataProvider<HierarchicalWrapper> underlyingDataProvider,
String... propertyNames) |
| Modifier and Type | Method and Description |
|---|---|
DataCell |
getCellByPosition(int columnPosition,
int rowPosition) |
int |
getColumnCount() |
Object |
getDataValue(int columnIndex,
int rowIndex)
Gets the value at the given column and row index.
|
protected Object |
getLevelObject(int rowPosition,
int level)
Returns the level object for the specified level out of the
HierarchicalWrapper object at the given row position. |
int |
getRowCount() |
protected int |
getRowSpan(int rowPosition,
int level)
Calculates the number of rows to span regarding the data of the cells.
|
protected int |
getStartRowPosition(int rowPosition,
int level)
Checks if the row above the given row position contains the same value.
|
void |
setDataValue(int columnIndex,
int rowIndex,
Object newValue)
Sets the value at the given column and row index.
|
protected boolean |
valuesEqual(Object value1,
Object value2)
Check if the given values are equal, where two
null values
are not considered to be equal. |
public HierarchicalSpanningDataProvider(IRowDataProvider<HierarchicalWrapper> underlyingDataProvider, String... propertyNames)
underlyingDataProvider - The IRowDataProvider that should be wrapped by this
HierarchicalSpanningDataProvider. Needed to access the
level object via the row object to determine if spanning
should be applied.propertyNames - The property names that are used to access the data. Needed to
determine the level object inside the
HierarchicalWrapper.public HierarchicalSpanningDataProvider(IRowDataProvider<HierarchicalWrapper> underlyingDataProvider, List<String> propertyNames)
underlyingDataProvider - The IRowDataProvider that should be wrapped by this
HierarchicalSpanningDataProvider. Needed to access the
level object via the row object to determine if spanning
should be applied.propertyNames - The property names that are used to access the data. Needed to
determine the level object inside the
HierarchicalWrapper.public Object getDataValue(int columnIndex, int rowIndex)
IDataProvidergetDataValue in interface IDataProvidercolumnIndex - The column index of the cell whose value is requested.rowIndex - The row index of the cell whose value is requested.public void setDataValue(int columnIndex,
int rowIndex,
Object newValue)
IDataProvidersetDataValue in interface IDataProvidercolumnIndex - The column index of the cell whose value should be changed.rowIndex - The row index of the cell whose value should be changed.newValue - The new value that should be set.public int getColumnCount()
getColumnCount in interface IDataProviderIDataProvider handles.public int getRowCount()
getRowCount in interface IDataProviderIDataProvider handles.public DataCell getCellByPosition(int columnPosition, int rowPosition)
getCellByPosition in interface ISpanningDataProviderprotected int getStartRowPosition(int rowPosition,
int level)
rowPosition - The row position whose spanning state should be checked.level - The hierarchy level of the object to check.protected int getRowSpan(int rowPosition,
int level)
rowPosition - The row position to start the check for spanning.level - The hierarchy level to check.protected Object getLevelObject(int rowPosition, int level)
HierarchicalWrapper object at the given row position.rowPosition - The row position of the object for which the level object is
requested.level - The hierarchy level to get the object for.HierarchicalWrapper object at the given row position.protected boolean valuesEqual(Object value1, Object value2)
null values
are not considered to be equal.value1 - The first value to check for equality with the second valuevalue2 - The second value to check for equality with the first value.true if the given values are equal.Copyright © 2019. All rights reserved.