This package contains the components of the tree that abstracts the Schema
structure.
First we create an org.w3c.dom.DOM to encapsulate the parent-child
relationships described
by the Schema. Each Element in the DOM has an associated TreeNode,
which encapsulates
the rest of the information about the Element. The TreeNode holds a
reference to the Element's
Attributes and also keeps a link to other classes that describe the
type of data held in the Element
and the type of GUI widget used to display the Element on a screen.
The subclasses of TreeNode
provide for specialized behaviors of different types of Schema descriptions.
TopLevelTreeNode
is the node created at the beginning of a Schema description. ChoiceTreeNode
is a node with
several children, only one of whom may be active at a time. TableTreeNode
is a node that may
have more than one instance, just as a table may have more than one
row.
The reason why we keep a DOM structure instead of simply making a tree
of TreeNodes is
that this allows us to leverage DOM utilities, such as XSLT. We use
the DOM structure for
simple traversal, stopping at each Element to retrieve its TreeNode,
then performing an operation
on the TreeNode. We can display the DOM as a JTree for visual traversal
by a user. We can display
branches of the DOM as JTables to organize the information for the
user. We use XSLT
transformation tools to reorganize the DOM structure so that it can
be traversed in a different
ways to build different types of tables and trees.