|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--widgets.awt.TreeNode
This class represents a node in a tree that can be displayed by the Tree widget.
TreeNode objects support ActionListeners that will be notified when the node has been double-clicked in a Tree widget.
TreeNodes also supports popup menus. Registered PopupMenuListeners will be notified when a popup menu was requested for a node.
Tree
Constructor Summary | |
TreeNode(TreeNode parent,
java.lang.String name)
Create a tree node with the given parent and name, but with no icon nor associated content. |
|
TreeNode(TreeNode parent,
java.lang.String name,
java.awt.Image icon)
Create a tree node with given parent, name and icon, but no associated content. |
|
TreeNode(TreeNode parent,
java.lang.String name,
java.lang.Object content)
Create a tree node with the given parent, name and content but no icon. |
|
TreeNode(TreeNode parent,
java.lang.String name,
java.lang.Object content,
java.awt.Image icon)
Create a tree node with the given parent, name, content and icon. |
Method Summary | |
void |
addActionListener(java.awt.event.ActionListener l)
|
TreeNode |
addChild(TreeNode node)
Add a node to the end of the list of children of this node. |
void |
addPopupMenuListener(PopupMenuListener l)
|
TreeNode |
childByName(java.lang.String name)
Return the child node of this node with the given name or null if there is no such child. |
int |
countChildren()
Return the number of direct children of this node. |
int |
countVisibleChildren()
Return the number of children (direct or indirect) of this node that are 'visible'. |
TreeNode |
firstChild()
Returns this node's first child, or null if none. |
java.lang.Object |
getContent()
|
boolean |
getDirectory()
Does this node represent a directory? |
boolean |
getExpanded()
|
java.awt.Image |
getIcon()
|
java.lang.String |
getName()
|
TreeNode |
getParent()
|
TreeNode |
insertSibling(TreeNode node)
Insert the given node directely after this node in the parent's list of children. |
boolean |
isFirstChild()
Is this node the first child of its parent? |
boolean |
isLastChild()
Is this node the last child of its parent? |
int |
level()
Return the level of this node in a tree. |
TreeNode |
next()
Get this node's successor within the list of children of this node's parent. |
TreeNode |
previous()
Get this node's predecessor within the list of children of this node's parent. |
protected void |
processActionEvent(java.awt.event.ActionEvent e)
|
protected void |
processPopupMenuEvent(PopupMenuEvent e)
|
void |
remove()
Remove this node from its parent's list of children. |
void |
removeActionListener(java.awt.event.ActionListener l)
|
void |
removePopupMenuListener(PopupMenuListener l)
|
void |
setContent(java.lang.Object content)
|
void |
setDirectory(boolean b)
Specify whether or not this node represents a directory. |
void |
setExpanded(boolean b)
Set whether this node is expanded or collapsed. |
void |
setIcon(java.awt.Image icon)
|
void |
setName(java.lang.String newname)
|
void |
setParent(TreeNode parent)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public TreeNode(TreeNode parent, java.lang.String name, java.lang.Object content, java.awt.Image icon)
Create a tree node with the given parent, name, content and icon.
public TreeNode(TreeNode parent, java.lang.String name, java.awt.Image icon)
Create a tree node with given parent, name and icon, but no associated content.
public TreeNode(TreeNode parent, java.lang.String name, java.lang.Object content)
Create a tree node with the given parent, name and content but no icon.
public TreeNode(TreeNode parent, java.lang.String name)
Create a tree node with the given parent and name, but with no icon nor associated content.
Method Detail |
protected void processActionEvent(java.awt.event.ActionEvent e)
public void addActionListener(java.awt.event.ActionListener l)
public void removeActionListener(java.awt.event.ActionListener l)
protected void processPopupMenuEvent(PopupMenuEvent e)
public void addPopupMenuListener(PopupMenuListener l)
public void removePopupMenuListener(PopupMenuListener l)
public void setParent(TreeNode parent)
public TreeNode getParent()
public void setName(java.lang.String newname)
public java.lang.String getName()
public void setContent(java.lang.Object content)
public java.lang.Object getContent()
public void setIcon(java.awt.Image icon)
public java.awt.Image getIcon()
public void setExpanded(boolean b)
Set whether this node is expanded or collapsed. Note that a node with no children cannot be expanded and thus a getExpanded() on a leaf node will always return false!
public boolean getExpanded()
public void setDirectory(boolean b)
Specify whether or not this node represents a directory.
public boolean getDirectory()
Does this node represent a directory?
public TreeNode next()
Get this node's successor within the list of children of this node's parent. Returns null if this node is the last child of its parent.
public TreeNode previous()
Get this node's predecessor within the list of children of this node's parent. Returns null if this node is the first child of its parent.
public TreeNode firstChild()
Returns this node's first child, or null if none.
public TreeNode childByName(java.lang.String name)
Return the child node of this node with the given name or null if there is no such child.
public int level()
Return the level of this node in a tree. The level of the root is 0, it's children have level 1 and so on.
public int countChildren()
Return the number of direct children of this node. Possible offspring of those children are not included in the count!
public boolean isLastChild()
Is this node the last child of its parent?
public boolean isFirstChild()
Is this node the first child of its parent?
public int countVisibleChildren()
Return the number of children (direct or indirect) of this node that are 'visible'. A child is visible if all its parents are expanded.
public void remove()
Remove this node from its parent's list of children. Since a root cannot remove itself, nothing will happen in this case.
public TreeNode addChild(TreeNode node)
Add a node to the end of the list of children of this node.
public TreeNode insertSibling(TreeNode node)
Insert the given node directely after this node in the parent's list of children.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |