T - The actual implementing TreeNode classL - The actual implementing ListRow classpublic interface TreeModel<T extends TreeNode,L extends ListRow>
TreeNode is used to represent nodes. Each node
contains a ListRow as its data representation. When setting a state or
property on a node, the state or property is propagated to the nodes statemap
and the ListRow's PropertyManager. The tree model has a list of root nodes.
The tree model maintains two lists of root TreeNodes:
getTreeData() method.
getTreeView() method.
| Modifier and Type | Interface and Description |
|---|---|
static class |
TreeModel.Grouping
Enumerates the various grouping modes.
|
static class |
TreeModel.SelectionModel
Enumerates the various node selection models.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRowFilter(RowFilter<?,ListRow> rowFilter)
Add the row filter to this tree model.
|
void |
addRowFilters(Collection<RowFilter<?,ListRow>> rowFilters)
Add the row filters to this tree model.
|
void |
addTreeNodeComparator(DialogObjectConstant nodeConst,
TreeNodeComparator comparator)
Set the TreeNodeComparator to use when sorting this tree model.
|
void |
clear()
Clears this tree model by removing all root nodes.
|
void |
filterTree(List<T> srcList,
List<T> dstList)
Filter the tree, given a list of root nodes.
|
<U> U |
getCellProperty(T node,
DialogObjectConstant columnIdentifier,
Property<U> propertyName)
Get the property value for the specified cell.
|
Object |
getDataModel()
Get the concrete data model.
|
List<T> |
getExpanded()
Returns a list of all nodes that are expanded.
|
List<T> |
getSelected()
Returns a list of all nodes that are selected.
|
TreeModel.SelectionModel |
getSelectionModel()
Returns the current selection model - none, single or multi selection.
|
List<T> |
getTreeData()
Get the tree root node data list.
|
int |
getTreeDataNodeCount()
Get the number of nodes in this tree data model.
|
List<T> |
getTreeView()
Get the tree root node view list.
|
int |
getTreeViewNodeCount()
Get the number of nodes in this tree view model.
|
Object |
getValueAt(T node,
DialogObjectConstant columnIdentifier)
Get the cell value at the specified node and column.
|
boolean |
isCellEnabled(T node,
DialogObjectConstant columnIdentifier)
Get the enabled property value of the specified cell.
|
boolean |
isCellShown(T node,
DialogObjectConstant columnIdentifier)
Get the shown property value of the specified cell.
|
boolean |
isEmpty()
Test if this model contains any nodes.
|
boolean |
isExpanded(T node)
Return the 'expanded' state for a given node.
|
boolean |
isSelected(T node)
Return the 'selected' state for a given node.
|
void |
removeRowFilter(RowFilter<?,ListRow> rowFilter)
Remove the row filter from this tree model.
|
void |
removeRowFilters(Collection<RowFilter<?,ListRow>> rowFilters)
Remove the row filters from this tree model.
|
void |
setCellEnabled(T node,
DialogObjectConstant columnIdentifier,
boolean enabled)
Set the enabled property the specified cell.
|
<U> void |
setCellProperty(T node,
DialogObjectConstant columnIdentifier,
Property<U> propertyName,
U propertyValue)
Set the specified property on the specified cell.
|
void |
setCellShown(T node,
DialogObjectConstant columnIdentifier,
boolean shown)
Set the shown property the specified cell.
|
void |
setColumnEnabled(DialogObjectConstant columnIdentifier,
boolean enabled)
Set the enabled property for all cells in the specified column.
|
<U> void |
setColumnProperty(DialogObjectConstant columnIdentifier,
Property<U> propertyName,
U value)
Set the specified property on all cells in the column.
|
void |
setColumnShown(DialogObjectConstant columnIdentifier,
boolean shown)
Set the shown property for all cells in the specified column.
|
void |
setEnabled(boolean enabled)
Set the enabled property for all cells in the entire tree.
|
void |
setExpanded(boolean expanded)
Sets all nodes to the 'expanded' state.
|
void |
setExpanded(T node,
boolean expanded)
Sets the 'expanded' state on a single node.
|
void |
setNodeEnabled(T node,
boolean enabled)
Set the enabled property for all cells in the specified node.
|
<U> void |
setNodeProperty(T node,
Property<U> property,
U propertyValue)
Set the specified property on all cells in the node.
|
void |
setNodeShown(T node,
boolean shown)
Set the shown property for all cells in the specified node.
|
<U> void |
setProperty(Property<U> property,
U propertyValue)
Set the specified property on all cells in the tree.
|
void |
setRootNodes(List<T> nodeList)
Sets the root nodes of this model data tree.
|
void |
setSelected(boolean selected)
Sets all nodes to the 'selected' state.
|
void |
setSelected(T node,
boolean selected)
Sets the 'selected' state on a single node.
|
void |
setSelectionModel(TreeModel.SelectionModel selectionModel)
Sets the current selection model.
|
void |
setShown(boolean shown)
Set the shown property for all cells in the entire tree.
|
void |
setValueAt(T node,
DialogObjectConstant columnIdentifier,
Object value)
Set the specified cell value.
|
void |
sortTree(List<T> nodeList)
Sort all nodes in list of root nodes .
|
List<T> getTreeView()
Note that any changes made directly to this list will not be detected by the tree model. Thus adding or removing rows to this list might not yield the desired result.
List<T> getTreeData()
Note that any changes made directly to this list will be detected by the tree model and trigger and update of the tree view list.
Object getDataModel()
void addRowFilter(RowFilter<?,ListRow> rowFilter)
rowFilter - row filter(s) to addvoid addRowFilters(Collection<RowFilter<?,ListRow>> rowFilters)
rowFilters - row filter(s) to addvoid removeRowFilter(RowFilter<?,ListRow> rowFilter)
rowFilter - row filter(s) to removevoid removeRowFilters(Collection<RowFilter<?,ListRow>> rowFilters)
rowFilters - row filters to removevoid filterTree(List<T> srcList, List<T> dstList)
srcList - source list of root nodesdstList - destination list of root nodesObject getValueAt(T node, DialogObjectConstant columnIdentifier)
node - tree data nodecolumnIdentifier - constant denoting the columnvoid setValueAt(T node, DialogObjectConstant columnIdentifier, Object value)
Note: The tree view is not updated as a result of invoking this method.
node - tree data's nodecolumnIdentifier - constant denoting the columnvalue - cell valuefilterTree(List, List)int getTreeDataNodeCount()
int getTreeViewNodeCount()
void setRootNodes(List<T> nodeList)
nodeList - the list of root nodesvoid clear()
boolean isEmpty()
true if this model is empty<U> void setProperty(Property<U> property, U propertyValue)
U - The property value typeproperty - the propertypropertyValue - value of the property<U> void setNodeProperty(T node, Property<U> property, U propertyValue)
U - The property value typenode - tree data's nodeproperty - the propertypropertyValue - value of the property<U> void setColumnProperty(DialogObjectConstant columnIdentifier, Property<U> propertyName, U value)
U - The property value typecolumnIdentifier - constant denoting the columnpropertyName - name identifying the propertyvalue - value of the property<U> void setCellProperty(T node, DialogObjectConstant columnIdentifier, Property<U> propertyName, U propertyValue)
U - The property value typenode - tree data's nodecolumnIdentifier - constant denoting the columnpropertyName - name identifying the propertypropertyValue - value of the property<U> U getCellProperty(T node, DialogObjectConstant columnIdentifier, Property<U> propertyName)
U - The property value typenode - tree data's nodecolumnIdentifier - constant denoting the columnpropertyName - name identifying the propertyTreeModel.SelectionModel getSelectionModel()
TreeModel.SelectionModelvoid setSelectionModel(TreeModel.SelectionModel selectionModel)
TreeModel.SelectionModel.selectionModel - the selection model to setvoid setSelected(boolean selected)
selected - boolean indicating wheather to set selected or unselected statevoid setSelected(T node, boolean selected)
node - the node to set the 'selected' state uponselected - boolean indicating wheather to set selected or unselected stateboolean isSelected(T node)
node - the node the check state forList<T> getSelected()
void setExpanded(T node, boolean expanded)
node - the node to set the 'expanded' state uponexpanded - boolean indicating wheather to set expanded or contracted statevoid setExpanded(boolean expanded)
expanded - boolean indicating wheather to set selected or unselected stateboolean isExpanded(T node)
node - the node the check state forList<T> getExpanded()
void setEnabled(boolean enabled)
enabled - if true, all cells in the tree will be enabledisCellEnabled(TreeNode, DialogObjectConstant)void setNodeEnabled(T node, boolean enabled)
node - the node to set editableenabled - if true, all cells in the node will be enabledisCellEnabled(TreeNode, DialogObjectConstant)void setColumnEnabled(DialogObjectConstant columnIdentifier, boolean enabled)
columnIdentifier - constant denoting the columnenabled - if true, all cells in the column will be enabledNoSuchElementException - if the specified column is not part of this tree modelisCellEnabled(TreeNode, DialogObjectConstant)void setCellEnabled(T node, DialogObjectConstant columnIdentifier, boolean enabled)
node - the nodecolumnIdentifier - constant denoting the columnenabled - if true, the cells will be editableisCellEnabled(TreeNode, DialogObjectConstant)boolean isCellEnabled(T node, DialogObjectConstant columnIdentifier)
false the cell will not be able to
receive focus. If the cell is visible and enabled the
cell will be able to receive focus.node - the nodecolumnIdentifier - constant denoting the columntrue if the cell is enabledvoid setShown(boolean shown)
shown - if true, all cells in the node will be renderedisCellShown(TreeNode, DialogObjectConstant)void setNodeShown(T node, boolean shown)
node - the node to set shownshown - if true, all cells in the node will be renderedisCellShown(TreeNode, DialogObjectConstant)void setColumnShown(DialogObjectConstant columnIdentifier, boolean shown)
columnIdentifier - constant denoting the columnshown - if true, all cells in the column will be renderedisCellEnabled(TreeNode, DialogObjectConstant)void setCellShown(T node, DialogObjectConstant columnIdentifier, boolean shown)
node - the nodecolumnIdentifier - constant denoting the columnshown - if true, the cell will be renderedisCellEnabled(TreeNode, DialogObjectConstant)boolean isCellShown(T node, DialogObjectConstant columnIdentifier)
true the cell will be rendered.node - the nodecolumnIdentifier - constant denoting the columntrue if the cell is shownvoid sortTree(List<T> nodeList)
nodeList - list of root nodesaddTreeNodeComparator(DialogObjectConstant, TreeNodeComparator)void addTreeNodeComparator(DialogObjectConstant nodeConst, TreeNodeComparator comparator)
nodeConst - the dialog object constant denoting the tree nodecomparator - the comparator to use for a particular type of nodeCopyright © 2006–2017 Esito AS. All rights reserved.