edu.cs.ai.kreator.ui.gui.components.models
Class CheckboxTreeModel.Node

java.lang.Object
  extended by edu.cs.ai.kreator.ui.gui.components.models.CheckboxTreeModel.Node
Enclosing class:
CheckboxTreeModel

public class CheckboxTreeModel.Node
extends java.lang.Object

Inner class representing a Node in the custom tree model.

Author:
Tim Janus

Constructor Summary
CheckboxTreeModel.Node(java.lang.Object userData)
          Ctor: Generates a new node with the given userData.
CheckboxTreeModel.Node(java.lang.Object userData, CheckboxTreeModel.Node parent)
          Ctor: Generates a new node with the given user-data and parent.
 
Method Summary
 void addChild(CheckboxTreeModel.Node child)
          Adds a child node to this node.
 CheckboxTreeModel.Node addChild(java.lang.Object userData)
          Adds a child node with the given user-data to this node.
 void check(boolean b)
          check or uncheck the checkbox of this node (not recursively)
 void check(boolean b, boolean rek)
          check or uncheck the checkbox of this node and all children nodes.
 javax.swing.JCheckBox getCheckBox()
           
 java.util.List<CheckboxTreeModel.Node> getChildren()
           
 CheckboxTreeModel.Node getParent()
           
 javax.swing.tree.TreePath getPath()
          Generates a tree-path (used by JTree component)
 java.lang.Object getUserData()
           
 void removeAllChildren()
          Removes all children connected to this node.
 void setUserData(java.lang.Object data)
          changes the user-data of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckboxTreeModel.Node

public CheckboxTreeModel.Node(java.lang.Object userData)
Ctor: Generates a new node with the given userData.

Parameters:
userData - user-data of the node.

CheckboxTreeModel.Node

public CheckboxTreeModel.Node(java.lang.Object userData,
                              CheckboxTreeModel.Node parent)
Ctor: Generates a new node with the given user-data and parent.

Parameters:
userData - user-data of the node.
parent - reference to the parent of the node.
Method Detail

check

public void check(boolean b)
check or uncheck the checkbox of this node (not recursively)

Parameters:
b - true if the checkbox should be select otherwise false.

check

public void check(boolean b,
                  boolean rek)
check or uncheck the checkbox of this node and all children nodes.

Parameters:
b - true if the checkbox should be select otherwise false.
rek - true means also set checkbox states of children, false means only that node.

addChild

public CheckboxTreeModel.Node addChild(java.lang.Object userData)
Adds a child node with the given user-data to this node.

Parameters:
userData -
Returns:
reference to the newly added node object.

addChild

public void addChild(CheckboxTreeModel.Node child)
Adds a child node to this node.

Parameters:
child - the node which should be added as child.

getPath

public javax.swing.tree.TreePath getPath()
Generates a tree-path (used by JTree component)

Returns:
a TreePath object: it consists of an array of objects in the following form: [root, ..., this_node]

removeAllChildren

public void removeAllChildren()
Removes all children connected to this node.


getChildren

public java.util.List<CheckboxTreeModel.Node> getChildren()
Returns:
a list with all children of this node.

setUserData

public void setUserData(java.lang.Object data)
changes the user-data of this node.

Parameters:
data - new user-data.

getUserData

public java.lang.Object getUserData()
Returns:
user-data of this node.

getParent

public CheckboxTreeModel.Node getParent()
Returns:
the parent node.

getCheckBox

public javax.swing.JCheckBox getCheckBox()
Returns:
the checkbox used for de/selecting.