com.tensegrity.gui.swing.control.attributetree
Class AttributeTreeNode

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended bycom.tensegrity.gui.swing.control.attributetree.AttributeTreeNode
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class AttributeTreeNode
extends javax.swing.tree.DefaultMutableTreeNode

TreeNode implementation containing the data like AttributeTreeCategorys, AttributeSets and Attributes. It also contains status information like expanded/collapsed, visible and enabled which is used by the AttributeTreeModel.

Version:
$Id: AttributeTreeNode.java,v 1.22 2005/12/07 17:34:47 BurkhardWick Exp $
Author:
BurkhardWick
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
AttributeTreeNode(Attribute attrib)
          Constructor for an attribute node
AttributeTreeNode(AttributeTreeCategory cat)
          Constructor for a category node
 
Method Summary
 void add(javax.swing.tree.MutableTreeNode newChild)
           
 AttributeTreeNode findChild(java.lang.String name)
          This method finds a child node identified by the parameter name.
 Attribute getAttribute()
          Returns the attribute of this node A call should only be done, if isAttribute() returned true.
 AttributeSet getAttributePath()
          Returns the full qualified path of this node
 AttributeTreeCategory getCategory()
          Returns the category contained in this node.
 AttributeTreeNode getChildNode(int index)
          Returns the child at the given index.
 int getLevel()
          Returns the level this node is in
 java.lang.String getName()
          Returns the name of this node, which will be either the name of the category or the name of the attribute
 AttributeTreeNode getParentNode()
          Returns the parent node of this node
 java.lang.String getPathName()
          Returns the full qualified path of this node
protected  java.lang.String getPathName(boolean includeSubSetPostFix)
          Returns the full qualified path of this node
 int getRow()
          Returns the row index of this node
protected  int getRowCount()
          Returns the number of rows that lie in this subtree, depending on the expanded and enabled state of the child nodes.
 boolean hasVisibleChildren()
          Returns true, if this node contains visible children
 boolean isAttribute()
          Returns true, if this node is an attribute
 boolean isCategory()
          Returns true, if this node is a category
 boolean isEnabled()
          Returns true, if this node is enabled
 boolean isExpanded()
          Returns true, if this node is currently expanded in the tree
protected  boolean isVisible()
          Returns whether this node is visible or not
 void remove(javax.swing.tree.MutableTreeNode aChild)
           
 void setEnabled(boolean enabled)
          Sets the enabled state of this node
 void setExpanded(boolean expanded)
          Sets the expanded state of this node in the tree
 void setParent(javax.swing.tree.MutableTreeNode newParent)
           
protected  void setVisible(boolean visible)
          Sets the node's visibility
 java.lang.String toString()
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, removeAllChildren, removeFromParent, setAllowsChildren, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeTreeNode

public AttributeTreeNode(AttributeTreeCategory cat)
Constructor for a category node

Parameters:
cat - The category, this node will represent

AttributeTreeNode

public AttributeTreeNode(Attribute attrib)
Constructor for an attribute node

Parameters:
attrib - The attribute this node will represent
Method Detail

isCategory

public boolean isCategory()
Returns true, if this node is a category

Returns:
true, if this node is a category

isAttribute

public boolean isAttribute()
Returns true, if this node is an attribute

Returns:
true, if this node is an attribute

getCategory

public AttributeTreeCategory getCategory()
Returns the category contained in this node. A call should only be done, if isCategory() returned true.

Returns:
the category contained in this node.

getAttribute

public Attribute getAttribute()
Returns the attribute of this node A call should only be done, if isAttribute() returned true.

Returns:
the attribute of this node

getName

public java.lang.String getName()
Returns the name of this node, which will be either the name of the category or the name of the attribute

Returns:
the name of this node

toString

public java.lang.String toString()

isExpanded

public boolean isExpanded()
Returns true, if this node is currently expanded in the tree

Returns:
true, if this node is currently expanded in the tree

setExpanded

public void setExpanded(boolean expanded)
Sets the expanded state of this node in the tree

Parameters:
expanded - the new expanded state of this node in the tree

add

public void add(javax.swing.tree.MutableTreeNode newChild)

remove

public void remove(javax.swing.tree.MutableTreeNode aChild)

setParent

public void setParent(javax.swing.tree.MutableTreeNode newParent)

getLevel

public int getLevel()
Returns the level this node is in

Returns:
Returns the level.

findChild

public AttributeTreeNode findChild(java.lang.String name)
This method finds a child node identified by the parameter name.

Parameters:
name - The name of the child node to look for.
Returns:
an instance of AttributeTreeNode or null if no such child is found.

getChildNode

public AttributeTreeNode getChildNode(int index)
Returns the child at the given index.

Parameters:
index - The index of the child to retrieve
Returns:
The child at the given index

getParentNode

public AttributeTreeNode getParentNode()
Returns the parent node of this node

Returns:
the parent node of this node

getAttributePath

public AttributeSet getAttributePath()
Returns the full qualified path of this node

Returns:
the full qualified path of this node

getPathName

public java.lang.String getPathName()
Returns the full qualified path of this node

Returns:
The full qualified path of this node

getPathName

protected java.lang.String getPathName(boolean includeSubSetPostFix)
Returns the full qualified path of this node

Parameters:
includeSubSetPostFix - If true, the subset prefixes are added to complex attributes
Returns:
The full qualified path of this node

isVisible

protected boolean isVisible()
Returns whether this node is visible or not

Returns:
True, if this node is visible

hasVisibleChildren

public boolean hasVisibleChildren()
Returns true, if this node contains visible children

Returns:
true, if this node contains visible children

setVisible

protected void setVisible(boolean visible)
Sets the node's visibility

Parameters:
visible - The visibility to set

getRow

public int getRow()
Returns the row index of this node

Returns:
the row index of this node

getRowCount

protected int getRowCount()
Returns the number of rows that lie in this subtree, depending on the expanded and enabled state of the child nodes.

Returns:
The number of rows in the subtree

isEnabled

public boolean isEnabled()
Returns true, if this node is enabled

Returns:
true, if this node is enabled

setEnabled

public void setEnabled(boolean enabled)
Sets the enabled state of this node

Parameters:
enabled - The new state to set


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.