public abstract class TreeNode
extends Object
implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
FOLDER_TYPE
FOLDER
|
static int |
ITEM_TYPE
ITEM which is not FOLDER
|
Constructor and Description |
---|
TreeNode()
Instantiates a new empty TreeNode.
|
Modifier and Type | Method and Description |
---|---|
int |
addNode(TreeNode node)
Adds the child node to the end of the list
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds the property change listener.
|
Object |
clone() |
abstract TreeNode |
createNode(TreeNode node)
Creates the node from the specified node
|
int |
deleteNode()
Deletes this node from the parent.
|
List<TreeNode> |
getChildren()
Gets the list of the children nodes.
|
abstract String |
getDisplayValue()
Gets the display value of the node.
|
abstract String |
getIconPath()
Gets the icon path.
|
TreeNode |
getNode(int index)
Gets the child TreeNode located at the index.
|
TreeNode |
getParent()
Gets the parent TreeNode if any.
|
PropertyChangeSupport |
getPropertyChangeSupport()
Gets the PropertyChangeSupport object.
|
TreeNode |
getRoot()
Gets the root node of the tree.
|
int |
getType()
Gets the type of the node.
|
int |
indexOf()
Gets the index of this node in the list of the parents children.
|
int |
insertNode(TreeNode node,
int index)
Inserts child node at the specified index.
|
boolean |
isFolder()
Checks if is this node is a FOLDER.
|
boolean |
isItem()
Checks if this node is an ITEM.
|
void |
propertyChange(PropertyChangeEvent event)
Notifies all attached listeners when tree's current node has changed.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes the PropertyChangeListener from the list of attached listeners.
|
void |
setChildren(List<TreeNode> value)
Sets the list of the children to this node.
|
void |
setCurrentNode(TreeNode treeNode)
Sets the current node for the tree.
|
void |
setNode(TreeNode node)
Replaces this node with a new node.
|
void |
setParent(TreeNode value)
Sets the parent node for this node.
|
void |
setPropertyChangeSupport(PropertyChangeSupport value)
Sets the PropertyChangeSupport object for the node.
|
void |
setType(int value)
Sets the type of the node.
|
public static int FOLDER_TYPE
public static int ITEM_TYPE
public int addNode(TreeNode node)
node
- the child node to addpublic void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the listenerpublic Object clone()
clone
in class Object
public abstract TreeNode createNode(TreeNode node)
node
- the TreeNode which used to create new nodepublic int deleteNode()
public List<TreeNode> getChildren()
public abstract String getDisplayValue()
public abstract String getIconPath()
public TreeNode getNode(int index)
index
- the index of the child nodepublic TreeNode getParent()
public PropertyChangeSupport getPropertyChangeSupport()
public TreeNode getRoot()
public int getType()
public int indexOf()
public int insertNode(TreeNode node, int index)
node
- the child node to insertindex
- the position to insert child node atpublic boolean isFolder()
public boolean isItem()
public void propertyChange(PropertyChangeEvent event)
event
- the eventpublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the listener to removepublic void setChildren(List<TreeNode> value)
value
- the new children listpublic void setCurrentNode(TreeNode treeNode)
treeNode
- the new current nodepublic void setNode(TreeNode node)
node
- the new nodepublic void setParent(TreeNode value)
value
- the new parent nodepublic void setPropertyChangeSupport(PropertyChangeSupport value)
value
- the new PropertyChangeSupport objectpublic void setType(int value)
value
- the new type of the node.Copyright © 2010-2020 Toolsverse. All Rights Reserved.