Package com.sun.interview
Interface TreeQuestion.Model
- Enclosing class:
TreeQuestion
public static interface TreeQuestion.Model
An interface that provides the model for the tree whose nodes
are selected by a TreeQuestion.
-
Method Summary
Modifier and TypeMethodDescriptionGet a child of a specified node, or null if no such child exists.int
getChildCount
(Object node) Get the number of children of a specified node.Get the name of a specified node.Get the full path from the root node of a specified node.getRoot()
Get the root node of the tree.boolean
Determine if this a node is a leaf node.
-
Method Details
-
getRoot
Object getRoot()Get the root node of the tree.- Returns:
- the root node of the tree.
-
getChildCount
Get the number of children of a specified node.- Parameters:
node
- the node for which to get the number of children- Returns:
- the number of children of the specified node
-
getChild
Get a child of a specified node, or null if no such child exists.- Parameters:
node
- the node for which to get the childindex
- the index of the child; this should be a number greater than or equal to zero and less than the number of children of the node.- Returns:
- the specified child, or null if index does not identify a valid child.
- See Also:
-
getName
Get the name of a specified node. The name will be used to construct paths. At a minimum, it should not contain '/'.- Parameters:
node
- the node whose name is required- Returns:
- the name of the specified node
-
getPath
Get the full path from the root node of a specified node.- Parameters:
node
- the node whose path is required- Returns:
- the path of the specified node from the root node, as composed from the names of this node and its ancestors, using '/' to separate the individual names.
-
isLeaf
Determine if this a node is a leaf node. This is primarily an attribute of the node's actual type, and is not necessarily the same as having zero children. (A leaf node implies zero children, but zero children does not imply a node is a leaf.)- Parameters:
node
- the node to check for being a leaf- Returns:
- true if the specified node is a leaf node, and false otherwise.
-