fbench.tree
Class DOMTreeNode

java.lang.Object
  extended by fbench.dom.ElementModel
      extended by fbench.tree.DOMTreeNode
All Implemented Interfaces:
javax.swing.tree.TreeNode, org.w3c.dom.events.EventListener
Direct Known Subclasses:
Algorithm, AlgorithmList, Application, Compiler, CompilerInfo, DeviceType, ECC, FBNetwork, FBType, Identification, Resource, ResourceType, Service, ServiceSequence, System, VersionInfo, VersionList

public class DOMTreeNode
extends ElementModel
implements javax.swing.tree.TreeNode, org.w3c.dom.events.EventListener

A TreeNode encapsulating an Element of the DOM tree of an IEC 61499 XML document that has been "scrubbed" of all but Element nodes.

Version:
20051027/JHC - Redefined default icon., 20050801/JHC - Modified from DOMTreeElement., 20050419/JHC
Author:
JHC

Constructor Summary
DOMTreeNode()
           
 
Method Summary
 void add(javax.swing.tree.TreeNode newNode)
           
 java.util.Enumeration children()
           
static DOMTreeNode forElement(org.w3c.dom.Element el)
          Returns a DOMTreeNode encapsulating the given DOM Element, or null if no such DOMTreeNode exists.
 boolean getAllowsChildren()
          Returns true if the receiver allows children.
 DOMTreeNode getChildAt(int childIndex)
           
 int getChildCount()
          Returns the count of displayable children.
 java.util.Vector<DOMTreeNode> getChildren()
          Returns a Vector of the receiver's children.
 javax.swing.Icon getIcon()
          Returns the icon to be used for display of this element.
 int getIndex(javax.swing.tree.TreeNode node)
           
 javax.swing.tree.TreeNode getParent()
           
 java.lang.String getText()
          Returns the string to be used to display the tree node.
 void handleEvent(org.w3c.dom.events.Event evt)
           
static boolean hasInterface(java.lang.String nname)
          Returns true if the given string is the name of an IEC 61499 LibraryElement with an interface.
 boolean isLeaf()
           
 void removeAllChildren()
           
 void setElement(org.w3c.dom.Element el)
           
 void setParent(DOMTreeNode p)
           
 
Methods inherited from class fbench.dom.ElementModel
equals, forElement, getComment, getElement, getName, getType, isDigit, isLetter, isName, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DOMTreeNode

public DOMTreeNode()
Method Detail

setElement

public void setElement(org.w3c.dom.Element el)
Overrides:
setElement in class ElementModel

getChildCount

public int getChildCount()
Returns the count of displayable children.

Specified by:
getChildCount in interface javax.swing.tree.TreeNode

getText

public java.lang.String getText()
Returns the string to be used to display the tree node. Default is the result of the ElementModel getName() method.


getIcon

public javax.swing.Icon getIcon()
Returns the icon to be used for display of this element. Default is the icon identified by the element's tag name in lower case, or null if no icon is to be used.


hasInterface

public static boolean hasInterface(java.lang.String nname)
Returns true if the given string is the name of an IEC 61499 LibraryElement with an interface.


getChildAt

public DOMTreeNode getChildAt(int childIndex)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode

setParent

public void setParent(DOMTreeNode p)

getParent

public javax.swing.tree.TreeNode getParent()
Specified by:
getParent in interface javax.swing.tree.TreeNode

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Specified by:
getIndex in interface javax.swing.tree.TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Returns true if the receiver allows children. Default return value is false . Extending classes may choose to return true

Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface javax.swing.tree.TreeNode

children

public java.util.Enumeration children()
Specified by:
children in interface javax.swing.tree.TreeNode

forElement

public static DOMTreeNode forElement(org.w3c.dom.Element el)
Returns a DOMTreeNode encapsulating the given DOM Element, or null if no such DOMTreeNode exists.


add

public void add(javax.swing.tree.TreeNode newNode)

getChildren

public java.util.Vector<DOMTreeNode> getChildren()
Returns a Vector of the receiver's children. Default is a Vector of TreeNodes encapsulating the Elements in the DOM element's list of children.


handleEvent

public void handleEvent(org.w3c.dom.events.Event evt)
Specified by:
handleEvent in interface org.w3c.dom.events.EventListener

removeAllChildren

public void removeAllChildren()