All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class xg.xg_Node

java.lang.Object
   |
   +----com.sun.java.swing.tree.DefaultMutableTreeNode
           |
           +----xg.xg_Node

public abstract class xg_Node
extends DefaultMutableTreeNode
implements Element
Base class for all types of XML entity.


Variable Index

 o EndPosition
The position of the end of this node relative to the start of the document it is in.
 o NodeName
The name of this node.
 o ParentNode
This node's parent.
 o PrecedingWhitespace
If this node was preceded by whitespace in the source, this is it.
 o StartPosition
The position of the start of this node relative to the start of the document it is in.

Constructor Index

 o xg_Node()
Default constructor.
 o xg_Node(String)
Construct a node with a name.

Method Index

 o addChild(xg_Node)
Add a child.
 o getAncestorOfType(String)
Get the first ancestor of this node whose NodeName is InputTypeName (or null if it doesn't have an ancestor of this type).
 o getAttributes()
Get a collection of attributes this node contains.
 o getChild(int)
Get the child element with the given index.
 o getChildrenOfType(int)
Get all the child nodes of a particular type code.
 o getChildrenOfType(String)
Get all the child nodes of a particular named type.
 o getDocument()
Get the swing.text.Document associated with this node.
 o getElement(int)
Get the child element at the given index.
 o getElementCount()
Get the number of child elements contained by this element.
 o getElementIndex(int)
Get the child element index closest to the given offset.
 o getEndOffset()
Get the offset from the beginning of the document at which this element ends.
 o getFirstChildOfType(String)
Get the first child element of a particular named type.
 o getName()
Get the name of this node.
 o getNodeName()
Get the name of this node.
 o getNodeType()
Get the type of this node, using only type values defined for the DOM.
 o getParentElement()
Get this node's parent (as an Element).
 o getParentNode()
Get this node's parent.
 o getPrecedingWhitespace()
Get the value of the preceding whitespace.
 o getPrecedingWhitespaceLength()
Get the length of the preceding whitespace.
 o getRootNode()
Get the top-level node of the tree to which this node belongs.
 o getStartOffset()
Get the offset from the beginning of the document at which this element begins.
 o getSummaryString()
Get a summary descriptive string suitable for display in the tree view or elsewhere.
 o getType()
Get the type of this node.
 o hasChildNodes()
Indicate whether this node has children.
 o insertChild(xg_Node, int)
Insert a child at a specified position.
 o reset()
Clear out the contents of this node.
 o save(Writer)
Save this node (and its children) as an XML source in InputWriter.
 o saveChildren(Writer)
Save this node's children in XML source form in InputWriter.
 o setEndPosition(Position)
Set the position of the end of this node relative to the start of the document it is in.
 o setName(String)
Set the name of this node.
 o setParentNode(xg_Node)
Set the parent of this node.
 o setPrecedingWhitespace(String)
Set the value of the preceding whitespace.
 o setStartPosition(Position)
Set the position of the start of this node relative to the start of the document it is in.
 o toString()
Return a string representation of the node (intended for use as debug output).
 o validate()
Validate this node.
 o verify()
Verify that this node is correct (ie.
 o writeContent(Writer)
Write this node's content (and its children) to InputWriter.
 o writePrecedingWhitespace(Writer)
Write this node's content (and its children) to InputWriter.

Variables

 o NodeName
 protected String NodeName
The name of this node.

 o PrecedingWhitespace
 protected String PrecedingWhitespace
If this node was preceded by whitespace in the source, this is it.

 o ParentNode
 protected xg_Node ParentNode
This node's parent. Note that attribute 'parent' is inherited from DefaultMutableTreeNode, so ParentNode is not really necessary and is probably doomed to removal in due course.

 o StartPosition
 protected Position StartPosition
The position of the start of this node relative to the start of the document it is in.

 o EndPosition
 protected Position EndPosition
The position of the end of this node relative to the start of the document it is in.

Constructors

 o xg_Node
 public xg_Node()
Default constructor.

 o xg_Node
 public xg_Node(String InputNodeName)
Construct a node with a name.

Parameters:
InputNodeName - The name of the node

Methods

 o reset
 public void reset()
Clear out the contents of this node.

 o save
 public void save(Writer InputWriter) throws IOException
Save this node (and its children) as an XML source in InputWriter.

Parameters:
InputWriter - The writer to which the XML will be written
 o saveChildren
 public void saveChildren(Writer InputWriter) throws IOException
Save this node's children in XML source form in InputWriter.

Parameters:
InputWriter - The writer to which the XML will be written
 o writeContent
 public void writeContent(Writer InputWriter) throws IOException
Write this node's content (and its children) to InputWriter. This implementation writes nothing, and derived classes which wish to write content must override it.

Parameters:
InputWriter - The writer to which the content will be written
 o writePrecedingWhitespace
 public void writePrecedingWhitespace(Writer InputWriter) throws IOException
Write this node's content (and its children) to InputWriter. This implementation writes nothing, and derived classes which wish to write content must override it.

Parameters:
InputWriter - The writer to which the content will be written
 o addChild
 public void addChild(xg_Node InputChildNode)
Add a child.

Parameters:
InputChildEntity - The child to be added
 o insertChild
 public void insertChild(xg_Node InputChildNode,
                         int InputChildPosition)
Insert a child at a specified position.

Parameters:
InputChildEntity - The child to be added
InputChildPosition - The position in the list of children at which to add the child
 o verify
 public void verify() throws xg_VerificationException
Verify that this node is correct (ie. internally correct and/or consistent with other nodes - such as its parent). This constitutes semantic checking on this node. Verification of this sort is meaningful only in special derived classes, since the classes for handling standard XML have no semantic knowledge (and therefore never return an error).

This method also provides derived classes with an opportunity to perform processing once they have been fully parsed (say, to compute the values of derivative attribute).

Throws: xg_VerificationException
Error in verification
 o validate
 public void validate() throws xg_ValidationException
Validate this node.

Throws: xg_ValidationException
Error in validation
 o setName
 public void setName(String InputNodeName)
Set the name of this node.

Parameters:
NodeName - The name of this node
 o setParentNode
 public void setParentNode(xg_Node InputParentNode)
Set the parent of this node.

Parameters:
ParentNode - The parent of this node
 o setPrecedingWhitespace
 public void setPrecedingWhitespace(String InputPrecedingWhitespace)
Set the value of the preceding whitespace.

Parameters:
InputPrecedingWhitespace - Value of the preceding whitespace
 o setStartPosition
 public void setStartPosition(Position InputStartPosition)
Set the position of the start of this node relative to the start of the document it is in.

Parameters:
InputStartPosition - Offset of start of node
 o setEndPosition
 public void setEndPosition(Position InputEndPosition)
Set the position of the end of this node relative to the start of the document it is in.

Parameters:
InputEndPosition - Offset of end of node
 o getPrecedingWhitespace
 public String getPrecedingWhitespace()
Get the value of the preceding whitespace.

Returns:
String value or null
 o getPrecedingWhitespaceLength
 public int getPrecedingWhitespaceLength()
Get the length of the preceding whitespace.

Returns:
The length of the preceding whitespace, or 0 if there is none
 o getChildrenOfType
 public Vector getChildrenOfType(String InputNodeType)
Get all the child nodes of a particular named type.

Parameters:
InputNodeType - The name of the type required
Returns:
A vector of all the child nodes of the given type; it is empty if there are no such children.
 o getChildrenOfType
 public Vector getChildrenOfType(int InputNodeType)
Get all the child nodes of a particular type code.

Parameters:
InputNodeType - The ID of the type required
Returns:
A vector of all the child nodes of the given type; it is empty if there are no such children.
 o getFirstChildOfType
 public xg_Node getFirstChildOfType(String InputNodeType)
Get the first child element of a particular named type.

Parameters:
InputNodeType - The name of the type required
Returns:
The first child node of the given type (or null if there isn't one).
 o getChild
 public xg_Node getChild(int InputChildIndex)
Get the child element with the given index.

Parameters:
InputChildIndex - The index of the child required
Returns:
The child of the given number
 o getParentNode
 public xg_Node getParentNode()
Get this node's parent.

Returns:
The parent of the node
 o getRootNode
 public xg_Node getRootNode()
Get the top-level node of the tree to which this node belongs.

Returns:
The root node of this tree
 o getAncestorOfType
 public xg_Node getAncestorOfType(String InputNodeName)
Get the first ancestor of this node whose NodeName is InputTypeName (or null if it doesn't have an ancestor of this type).

Returns:
The first ancestor of this node which is of the requested type
 o getSummaryString
 public String getSummaryString()
Get a summary descriptive string suitable for display in the tree view or elsewhere. To be overridden in each sub-class.

Returns:
A description suitable for display in the tree view
 o toString
 public String toString()
Return a string representation of the node (intended for use as debug output).

Returns:
String representing the node type
Overrides:
toString in class DefaultMutableTreeNode
 o getDocument
 public Document getDocument()
Get the swing.text.Document associated with this node.

Returns:
The swing.text.Document to which this node belongs
 o getParentElement
 public Element getParentElement()
Get this node's parent (as an Element). If the element is a root level element, null is returned.

Returns:
the parent element
 o getName
 public String getName()
Get the name of this node. If the node is used to represent some type of structure, this is its type name.

Returns:
The name of this node
 o getType
 public abstract int getType()
Get the type of this node.

Returns:
The type of this node
 o getNodeType
 public int getNodeType()
Get the type of this node, using only type values defined for the DOM. (Implements org.w3c.dom.Node.getNodeType.)

Returns:
The DOM type of this node
 o getAttributes
 public AttributeSet getAttributes()
Get a collection of attributes this node contains. This method may be overridden by derived classes, but a raw node itself has no attributes of its own and thus the AttributeSet returned contains no attributes itself - although attributes may be obtained via resolve parent.

Returns:
The attributes for the node
 o getStartOffset
 public int getStartOffset()
Get the offset from the beginning of the document at which this element begins. If this element has children, this will be the offset of the first child.

Returns:
The starting offset
 o getEndOffset
 public int getEndOffset()
Get the offset from the beginning of the document at which this element ends. If this element has children, this will be the end offset of the last child.

Returns:
The ending offset
 o getElementIndex
 public int getElementIndex(int InputOffset)
Get the child element index closest to the given offset. The offset is specified relative to the beginning of the document.

Parameters:
InputOffset - The offset from the start of the document
Returns:
The index of the element which resides at this offset
 o getElementCount
 public int getElementCount()
Get the number of child elements contained by this element. If this element is a leaf, a count of zero is returned.

Returns:
The number of child elements
 o getElement
 public Element getElement(int InputChildIndex)
Get the child element at the given index.

Parameters:
InputChildIndex - The index of the required child
Returns:
The child element
 o getNodeName
 public String getNodeName()
Get the name of this node. If the node is used to represent some type of structure, this is its type name.

Returns:
The name of this node
 o hasChildNodes
 public boolean hasChildNodes()
Indicate whether this node has children.

Returns:
true if this node has children; false if not

All Packages  Class Hierarchy  This Package  Previous  Next  Index