public class ExternalKTreeModel extends DefaultKTreeModel
KTreeModel
that obtains its data from
an external data source.DefaultKTreeModel.TreeNode
Modifier and Type | Field and Description |
---|---|
protected TreeDataSource |
source
The data source for this model.
|
emptyList, nodeMap, rootNode, support
COLUMN_NAMES_PROPERTY, COLUMN_TYPES_PROPERTY
Constructor and Description |
---|
ExternalKTreeModel(TreeDataSource source)
Construct a new
DefaultKTreeModel with the given
data source. |
Modifier and Type | Method and Description |
---|---|
void |
addChild(Object parent,
Object node)
Add a new child node to the given parent node.
|
void |
addChild(Object parent,
Object node,
int index)
Add a new child node to the given parent node.
|
Icon |
getIcon(Object node,
boolean isExpanded)
May be overridden by subclasses to provide custom icons.
|
String |
getLabel(Object node)
May be overridden by subclasses to provide custom labels.
|
Object |
getValueForProperty(Object node,
String property)
Get the value of an arbitrary property for a given node.
|
boolean |
isExpandable(Object node)
Determine if a node is expandable.
|
protected void |
loadChildren(DefaultKTreeModel.TreeNode node)
Load the children for a given node.
|
void |
releaseChildren(Object parent)
Release the children of a given parent node.
|
void |
reload(Object node)
Reload the subtree rooted at the given node from the data source.
|
void |
removeChild(Object parent,
int index)
Remove a child node of a given parent node.
|
void |
removeChildren(Object parent)
Remove all of the children of a given parent node.
|
void |
setRoot(Object root)
Set the root node.
|
void |
updateChildren(Object parent)
Indicate to listeners that the list of children of the specified node
has changed.
|
void |
updateNode(Object node)
Indicate to listeners that the specified node has changed.
|
addTreeModelListener, destroyNode, getChild, getChildCount, getChildren, getIndexOfChild, getParent, getRoot, makeNode, nodeForObject, preloadChildren, removeTreeModelListener
protected TreeDataSource source
public ExternalKTreeModel(TreeDataSource source)
DefaultKTreeModel
with the given
data source.source
- The data source that will provide nodes for this model.public void reload(Object node)
node
- The root node of the subtree to reload, or null to
reload the entire tree.public void setRoot(Object root)
KTreeModel
setRoot
in interface KTreeModel
setRoot
in class DefaultKTreeModel
root
- The new root node.public void removeChildren(Object parent)
KTreeModel
removeChildren
in interface KTreeModel
removeChildren
in class DefaultKTreeModel
parent
- The parent node.public void removeChild(Object parent, int index)
KTreeModel
removeChild
in interface KTreeModel
removeChild
in class DefaultKTreeModel
parent
- The parent node.index
- The index of the child to remove within the parent's list of
children.public void addChild(Object parent, Object node)
KTreeModel
addChild
in interface KTreeModel
addChild
in class DefaultKTreeModel
parent
- The parent node.node
- The new child node.public void addChild(Object parent, Object node, int index)
KTreeModel
addChild
in interface KTreeModel
addChild
in class DefaultKTreeModel
parent
- The parent node.node
- The new child node.index
- The offset in the list of children at which the new node
should be inserted.public void updateNode(Object node)
KTreeModel
updateNode
in interface KTreeModel
updateNode
in class DefaultKTreeModel
node
- The node.public void updateChildren(Object parent)
KTreeModel
updateChildren
in interface KTreeModel
updateChildren
in class DefaultKTreeModel
parent
- The parent node.public Icon getIcon(Object node, boolean isExpanded)
DefaultKTreeModel
getIcon
in interface KTreeModel
getIcon
in class DefaultKTreeModel
node
- The node.isExpanded
- The current expanded state for the node.public boolean isExpandable(Object node)
KTreeModel
isExpandable
in interface KTreeModel
isExpandable
in class DefaultKTreeModel
node
- The node to test.true
if the node is expandable, false
otherwise.public String getLabel(Object node)
DefaultKTreeModel
getLabel
in interface KTreeModel
getLabel
in class DefaultKTreeModel
node
- The node.public void releaseChildren(Object parent)
KTreeModel
releaseChildren
in interface KTreeModel
releaseChildren
in class DefaultKTreeModel
parent
- The root node of the subtree that should be released.public Object getValueForProperty(Object node, String property)
DefaultKTreeModel
getValueForProperty
in interface KTreeModel
getValueForProperty
in class DefaultKTreeModel
node
- The node.property
- The name of the property.null
if
there is no value for this property.protected void loadChildren(DefaultKTreeModel.TreeNode node)
DefaultKTreeModel
loadChildren
in class DefaultKTreeModel
node
- The parent node.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses