net.sf.jlayercheck.util.modeltree
Class DefaultModelTree

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by net.sf.jlayercheck.util.modeltree.DefaultModelTree
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode, ModelTree
Direct Known Subclasses:
DependentModelTree

public class DefaultModelTree
extends DefaultMutableTreeNode
implements ModelTree

Author:
webmaster@earth3d.org
See Also:
ModelTree, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DefaultModelTree()
           
 
Method Summary
protected  TreeNode findNode(TreeNode node, Class<? extends NamedTreeNode> clazz, String name)
          Searches for the first occurence of a node that is an instance of the given class and has the given name.
 ClassNode getClassNode(String classname)
          Returns the first ClassNode node for the given classname.
 ModuleNode getModule(String modulename)
          Searches for the ModuleNode with the given name.
 Vector<ModuleNode> getModules()
           
 ModuleNode getUnassignedModule()
          Finds and returns the ModuleNode that is named "unassigned" and contains all packages that do not belong to any module.
 void merge(ModelTree additionalModelTree)
          Merges the given tree into this one.
 void sortNodes()
          Sorts nodes and sorts the "unassigned" node to the end.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
 

Constructor Detail

DefaultModelTree

public DefaultModelTree()
Method Detail

getModules

public Vector<ModuleNode> getModules()
Specified by:
getModules in interface ModelTree

getModule

public ModuleNode getModule(String modulename)
Searches for the ModuleNode with the given name.

Parameters:
modulename -
Returns:

getClassNode

public ClassNode getClassNode(String classname)
Returns the first ClassNode node for the given classname.

Specified by:
getClassNode in interface ModelTree
Parameters:
classname -
Returns:

findNode

protected TreeNode findNode(TreeNode node,
                            Class<? extends NamedTreeNode> clazz,
                            String name)
Searches for the first occurence of a node that is an instance of the given class and has the given name.

Parameters:
node - root node of the tree
clazz - to search for
name - name that the NamedTreeNode should have
Returns:
NamedTreeNode

sortNodes

public void sortNodes()
Sorts nodes and sorts the "unassigned" node to the end.


getUnassignedModule

public ModuleNode getUnassignedModule()
Finds and returns the ModuleNode that is named "unassigned" and contains all packages that do not belong to any module. If it is not found, null is returned.

Specified by:
getUnassignedModule in interface ModelTree
Returns:
"unassigned" ModuleNode or null

merge

public void merge(ModelTree additionalModelTree)
Description copied from interface: ModelTree
Merges the given tree into this one.

Specified by:
merge in interface ModelTree


Copyright © 2007. All Rights Reserved.