com.jaxfront.core.ui
Class TreeModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by com.jaxfront.core.ui.TreeModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.tree.TreeModel

public class TreeModel
extends javax.swing.tree.DefaultTreeModel

A tree representation to use with JTree to visualize a JAXFront Type hierarchy based on one root type.

Version:
1.60
See Also:
Serialized Form

Constructor Summary
TreeModel(javax.swing.tree.DefaultMutableTreeNode node, Type rootType, Type xuiRootType)
           
TreeModel(Type root)
          Creates a TreeModel based on a JAXFront root type.
TreeModel(Type rootType, Type xuiRootType)
          Creates a TreeModel based on a JAXFront root type, the xui root type and a flag indicating if the whole JAXFront type tree should be built or not.
 
Method Summary
 void buildTree(TreeNode startNode, Type startType)
          Builds the tree according to the underlying JAXFront type tree.
 boolean buildTree(TreeNode node, Type type, Type parentType, boolean addable, boolean checkRepresentedAsTreeNode, int position)
          Builds the tree model based on the parent node, a JAXFront type and its parent.
 java.lang.Integer[] getDepthStatistic()
           
 TreeNode getNode(Type type)
          Returns the treeNode for the passing type.
 XMLSchemaPositionSorter getSorter()
           
 void insertNode(Type type)
          Insert a tree entry as a child node based on the submitted types' parent tree representation.
 void moveNode(Type sourceType, Type targetType)
          Moves the source type in front of the target type
 void release()
           
 void removeNode(Type type)
          Removes the submitted type from the tree.
 void removeNodeFromParent(javax.swing.tree.DefaultMutableTreeNode node)
           
 void removeNodeFromParent(javax.swing.tree.DefaultMutableTreeNode node, boolean release)
           
 void setIcon(Type type, java.lang.String gifName)
          Changes the icon of the submitted type.
 void swapNode(Type sourceType, Type targetType)
          Swaps the sourceType with the targetType.
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeModel

public TreeModel(Type root)
Creates a TreeModel based on a JAXFront root type.

Parameters:
root - root type

TreeModel

public TreeModel(javax.swing.tree.DefaultMutableTreeNode node,
                 Type rootType,
                 Type xuiRootType)

TreeModel

public TreeModel(Type rootType,
                 Type xuiRootType)
Creates a TreeModel based on a JAXFront root type, the xui root type and a flag indicating if the whole JAXFront type tree should be built or not.

Parameters:
root - root type
xuiRootType - xui root type
showAll - indicates if the whole JAXFront tree should be built.
Method Detail

buildTree

public void buildTree(TreeNode startNode,
                      Type startType)
Builds the tree according to the underlying JAXFront type tree.


buildTree

public boolean buildTree(TreeNode node,
                         Type type,
                         Type parentType,
                         boolean addable,
                         boolean checkRepresentedAsTreeNode,
                         int position)
Builds the tree model based on the parent node, a JAXFront type and its parent.

Parameters:
node - holder node in the tree model
type - current JAXFront type to build tree
parentType - parent JAXFront type
addable - indicates if current JAXFront type is allowed to add children nodes
checkRepresentedAsTreeNode - indicates if XUI definitions sould be checked

getNode

public TreeNode getNode(Type type)
Returns the treeNode for the passing type.

Parameters:
type - to lookUp in this treeModel

insertNode

public void insertNode(Type type)
Insert a tree entry as a child node based on the submitted types' parent tree representation.

Parameters:
type - type to insert

moveNode

public void moveNode(Type sourceType,
                     Type targetType)
Moves the source type in front of the target type

Parameters:
sourceType - source type
targetType - target type

removeNode

public void removeNode(Type type)
Removes the submitted type from the tree.

Parameters:
type - type to remove

removeNodeFromParent

public void removeNodeFromParent(javax.swing.tree.DefaultMutableTreeNode node)

removeNodeFromParent

public void removeNodeFromParent(javax.swing.tree.DefaultMutableTreeNode node,
                                 boolean release)

setIcon

public void setIcon(Type type,
                    java.lang.String gifName)
Changes the icon of the submitted type.

Parameters:
type - type to change the icon
gifName - name of a gif (loaded through classpath)

swapNode

public void swapNode(Type sourceType,
                     Type targetType)
Swaps the sourceType with the targetType.

Parameters:
sourceType - source type
targetType - target type

getDepthStatistic

public java.lang.Integer[] getDepthStatistic()

release

public void release()

getSorter

public XMLSchemaPositionSorter getSorter()