com.jstatcom.project
Class ProjectTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.jstatcom.project.ProjectTreeNode
All Implemented Interfaces:
SettingsElement, java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public final class ProjectTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements SettingsElement

A tree node that represents a project. It is used as element for the ProjectTree.

Author:
Markus Kraetzig
See Also:
Serialized Form

Field Summary
static javolution.xml.XmlFormat<ProjectTreeNode> ProjectTreeNode_XML
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
ProjectTreeNode(Project project, java.io.File projectFile, boolean isCurrent)
          Creates a tree node for a project.
 
Method Summary
 boolean equals(java.lang.Object o)
          Overwritessuperclass method to make sure that two project nodes are considered equal if they reference the same project file.
 int hashCode()
          Overwritten because equals was overwritten.
 void setElement()
          Interface method from SettingsElement to restore a setting.
 java.lang.String toString()
          Gets a string representation of this node.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ProjectTreeNode_XML

public static final javolution.xml.XmlFormat<ProjectTreeNode> ProjectTreeNode_XML
Constructor Detail

ProjectTreeNode

public ProjectTreeNode(Project project,
                       java.io.File projectFile,
                       boolean isCurrent)
Creates a tree node for a project.

Parameters:
project - the project that this node stands for
projectFile - the file where the project is stored
isCurrent - whether this node is the currently loaded project
Throws:
java.lang.IllegalArgumentException - if (project == null || projectFile == null)
Method Detail

equals

public final boolean equals(java.lang.Object o)
Overwritessuperclass method to make sure that two project nodes are considered equal if they reference the same project file.

Overrides:
equals in class java.lang.Object
Parameters:
o - object to compare
Returns:
true if o is a ProjectTreeNode that points to the same project file, false otherwise

hashCode

public int hashCode()
Overwritten because equals was overwritten.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode of the project file

toString

public java.lang.String toString()
Gets a string representation of this node.

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode
Returns:
descriptive string

setElement

public void setElement()
Interface method from SettingsElement to restore a setting. It adds this node to the project tree if the project file still exists.

Specified by:
setElement in interface SettingsElement