proper.xml
Class Node

java.lang.Object
  extended by proper.xml.Node
All Implemented Interfaces:
javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
Comment, Element

public abstract class Node
extends java.lang.Object
implements javax.swing.tree.MutableTreeNode

This class represents an abstract XML node, ancestor to Comment and Element.

Version:
$Revision: 1.2 $
Author:
FracPete

Constructor Summary
Node()
          initializes an empty comment with no parent
Node(Node parent)
          initializes an empty comment with the given parent
 
Method Summary
abstract  java.util.Enumeration children()
          Returns the children of the receiver as an Enumeration.
abstract  boolean getAllowsChildren()
          Returns true if the receiver allows children.
abstract  javax.swing.tree.TreeNode getChildAt(int childIndex)
          Returns the child TreeNode at index childIndex.
abstract  int getChildCount()
          Returns the number of children TreeNodes the receiver contains.
 int getDepth()
          returns the depth of this element in the tree
 int getIndention()
          returns the current indention
abstract  int getIndex(javax.swing.tree.TreeNode node)
          Returns the index of node in the receivers children.
 javax.swing.tree.TreeNode getParent()
          returns the parent of this element
 javax.swing.tree.TreeNode getRoot()
          returns the root of this node
abstract  void insert(javax.swing.tree.MutableTreeNode child, int index)
          Adds child to the receiver at index.
 boolean isContainer()
          whether it is just a container or a real XML tag
abstract  boolean isLeaf()
          Returns true if the receiver is a leaf.
abstract  void remove(int index)
          Removes the child at index from the receiver.
abstract  void remove(javax.swing.tree.MutableTreeNode node)
          Removes node from the receiver.
 void removeFromParent()
          Removes the receiver from its parent.
 void setIndention(int indention)
          sets the indention of this element and all children (recursively)
 void setIsContainer(boolean container)
          whether this Element is just a container or a real XML tag
 void setParent(javax.swing.tree.MutableTreeNode newParent)
          sets the new parent.
 void setUserObject(java.lang.Object object)
          Resets the user object of the receiver to object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node()
initializes an empty comment with no parent


Node

public Node(Node parent)
initializes an empty comment with the given parent

Method Detail

getRoot

public javax.swing.tree.TreeNode getRoot()
returns the root of this node


children

public abstract java.util.Enumeration children()
Returns the children of the receiver as an Enumeration.

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

getAllowsChildren

public abstract boolean getAllowsChildren()
Returns true if the receiver allows children.

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

getChildAt

public abstract javax.swing.tree.TreeNode getChildAt(int childIndex)
Returns the child TreeNode at index childIndex.

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

getChildCount

public abstract int getChildCount()
Returns the number of children TreeNodes the receiver contains.

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

getIndex

public abstract int getIndex(javax.swing.tree.TreeNode node)
Returns the index of node in the receivers children.

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

getParent

public javax.swing.tree.TreeNode getParent()
returns the parent of this element

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

isLeaf

public abstract boolean isLeaf()
Returns true if the receiver is a leaf.

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

insert

public abstract void insert(javax.swing.tree.MutableTreeNode child,
                            int index)
Adds child to the receiver at index.

Specified by:
insert in interface javax.swing.tree.MutableTreeNode

remove

public abstract void remove(int index)
Removes the child at index from the receiver.

Specified by:
remove in interface javax.swing.tree.MutableTreeNode

remove

public abstract void remove(javax.swing.tree.MutableTreeNode node)
Removes node from the receiver.

Specified by:
remove in interface javax.swing.tree.MutableTreeNode

removeFromParent

public void removeFromParent()
Removes the receiver from its parent.

Specified by:
removeFromParent in interface javax.swing.tree.MutableTreeNode

setParent

public void setParent(javax.swing.tree.MutableTreeNode newParent)
sets the new parent. the child is not automatically removed in its former parent list!

Specified by:
setParent in interface javax.swing.tree.MutableTreeNode

setUserObject

public void setUserObject(java.lang.Object object)
Resets the user object of the receiver to object. (ignored!)

Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode

getDepth

public int getDepth()
returns the depth of this element in the tree


setIndention

public void setIndention(int indention)
sets the indention of this element and all children (recursively)


getIndention

public int getIndention()
returns the current indention


setIsContainer

public void setIsContainer(boolean container)
whether this Element is just a container or a real XML tag


isContainer

public boolean isContainer()
whether it is just a container or a real XML tag