did.xml
Class DIDNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--did.xml.DIDNode

public class DIDNode
extends javax.swing.tree.DefaultMutableTreeNode

File:         DIDNode.java
Version:      1.1
Description:  This class extends the DefaultMutableTreeNode class and therefore fits nicely
into the Swing MVC concept. Used in conjuction with the TreeModel and JTree (and the proper
listeners) this class provides the basis for displaying and editing the DOM tree and 
underlying XML data.  For every Node in the DOM (built from the XML data file) there is a 
corresponding DIDNode.  Since the DOM can not be directly used in the Swing MVC 
architecture this parralleling of tree structures allows the application to use existing
swing components (JTree, DefaultTreeModel, various TreeListeners) to view and manipulate
DOM (XML) specific data.

Modification Log:
Date          Name    Comment
xx-xx-xxxx    XXX	   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

See Also:
Serialized Form

Field Summary
static java.lang.String CHARACTER
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
static java.lang.String DOCUMENT
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
static java.lang.String LINE
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
static java.lang.String OTHER
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
static java.lang.String PAGE
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
static java.lang.String VERTEX
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
static java.lang.String WORD
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
static java.lang.String ZONE
          Contant(s) that denote the type of data this Node represents as it pertains to the application.
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DIDNode(org.w3c.dom.Node newNode, DIDDefaultTreeModel newModel)
          Method used to instantiate this class.
 
Method Summary
static java.lang.String decodeString(java.lang.String uniStr)
          Method used to convert the unicode values into unicode string
 void deleteDomNode()
          Method used to remove the userObject from the TreeModels DOM Tree.
 java.lang.String getDataType()
          Method used to deterime the type of data this node userObject contains as is pertains to this application.
 org.w3c.dom.Node getDomNode()
          Method used to return the DOM node this node is mirroring.
 DIDDefaultTreeModel getModel()
          Method used to return a reference to the TreeModel to which this Node belongs.
 java.lang.String getNodeName()
          Method used to return the name of the DOM node in the userObject.
 int getNodeType()
          Method used to return the type of Node the userOject represents.
 java.lang.String getNodeValue()
          Method used to return the value of the DOM node in the userObject.
 DIDRoiIFC getRoi()
          Method used to return a reference to the ROI which is representing this Node in the ImageCanvas.
 void setDomNode(org.w3c.dom.Node newNode)
          Method used to set the userObject attribute to the DOM node this node is mirroring.
 void setModel(DIDDefaultTreeModel newModel)
          Convenience method used to set a reference to the TreeModel to which this Node belongs.
 void setNodeValue(java.lang.String newValue)
          Method used to set the value of the userObject(DOM Node).
 void setRoi(DIDRoiIFC newRoi)
          Method used to set a reference to ROI which represents this node.
 java.lang.String toString()
          Method used to return a Java String representation of this object.
 
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, getPathToRoot, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DOCUMENT

public static java.lang.String DOCUMENT
Contant(s) that denote the type of data this Node represents as it pertains to the application.

PAGE

public static java.lang.String PAGE
Contant(s) that denote the type of data this Node represents as it pertains to the application.

ZONE

public static java.lang.String ZONE
Contant(s) that denote the type of data this Node represents as it pertains to the application.

WORD

public static java.lang.String WORD
Contant(s) that denote the type of data this Node represents as it pertains to the application.

LINE

public static java.lang.String LINE
Contant(s) that denote the type of data this Node represents as it pertains to the application.

CHARACTER

public static java.lang.String CHARACTER
Contant(s) that denote the type of data this Node represents as it pertains to the application.

VERTEX

public static java.lang.String VERTEX
Contant(s) that denote the type of data this Node represents as it pertains to the application.

OTHER

public static java.lang.String OTHER
Contant(s) that denote the type of data this Node represents as it pertains to the application.
Constructor Detail

DIDNode

public DIDNode(org.w3c.dom.Node newNode,
               DIDDefaultTreeModel newModel)
Method used to instantiate this class. This method sets the user object to the DOM Node this node is responsible for displaying as well as setting a refernce to the TreeModel this node is a part of.
Parameters:
newNode - New W3C Node object this node is to display.
newModel - TreeModel which this node is a part of.
Method Detail

setDomNode

public void setDomNode(org.w3c.dom.Node newNode)
Method used to set the userObject attribute to the DOM node this node is mirroring.
Parameters:
newNode - A W3C node to be place in the userObject attribute.

getDomNode

public org.w3c.dom.Node getDomNode()
Method used to return the DOM node this node is mirroring.
Returns:
A W3C Node object which this class is parralleling .

getNodeName

public java.lang.String getNodeName()
Method used to return the name of the DOM node in the userObject.
Returns:
The name of the DOM node as a String.

getNodeValue

public java.lang.String getNodeValue()
Method used to return the value of the DOM node in the userObject.
Returns:
The value of the DOM node as a String

setNodeValue

public void setNodeValue(java.lang.String newValue)
Method used to set the value of the userObject(DOM Node). This method also messages the data model for which this node is a part of so that any viewers(DIDTree) that are using the data model can update themselves accordingly.
Parameters:
newValue - A String representing the new value of the DOM Node(userObject).

getNodeType

public int getNodeType()
Method used to return the type of Node the userOject represents. The integer return is specific to the DOM, i.e. ELEMENT, ATTRIBUTE, etc. Note: This method is provided for completeness and convience.
Returns:
An integer representing the type of DOM Node the userObject belongs to. For example: ELEMENT, ATTRIBUTE, etc.

getDataType

public java.lang.String getDataType()
Method used to deterime the type of data this node userObject contains as is pertains to this application. The method returns the value stored in the dataType attribute.
Returns:
A String representing the type of data this node's userObject contains.
See Also:
#setDataType, PAGE

toString

public java.lang.String toString()
Method used to return a Java String representation of this object. In this implementation the representation of this object is derived from the contents of it's userObject. This works well since the Java DefaultTreeCellRenderer uses toString() method of the nodes in a JTree to construct a visual representation of the object. Thus this object is represented visually by the userObject's(DOM Node) name and value if it has one.
Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode
Returns:
A String object representing this object. In this implmentation that string consists of the userObject's name and the userObject's value (if it has one).

setRoi

public void setRoi(DIDRoiIFC newRoi)
Method used to set a reference to ROI which represents this node.
Parameters:
newRoi - New reference to an ROI.

getRoi

public DIDRoiIFC getRoi()
Method used to return a reference to the ROI which is representing this Node in the ImageCanvas.
Returns:
An implementation of the DIDRoiIFC which represents this Node.

getModel

public DIDDefaultTreeModel getModel()
Method used to return a reference to the TreeModel to which this Node belongs.
Returns:
A DIDDefaultTreeModel object which refrences the TreeModel to which this Node belongs.

setModel

public void setModel(DIDDefaultTreeModel newModel)
Convenience method used to set a reference to the TreeModel to which this Node belongs.
Parameters:
newModel - A DIDDefaultTreeModel object which refrences the TreeModel to which this Node belongs.

deleteDomNode

public void deleteDomNode()
Method used to remove the userObject from the TreeModels DOM Tree.

decodeString

public static java.lang.String decodeString(java.lang.String uniStr)
Method used to convert the unicode values into unicode string