jaxx.runtime.swing.navigation
Class NavigationTreeModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by jaxx.runtime.swing.navigation.NavigationTreeModel
All Implemented Interfaces:
Serializable, TreeModel, NavigationModel

public class NavigationTreeModel
extends DefaultTreeModel
implements NavigationModel

Model of the tree used for a navigation tree.

Il est composé de NavigationTreeNode

Since:
1.7.2
Author:
chemit
See Also:
Serialized Form

Field Summary
protected  String pathSeparator
          The path separator used to build the NavigationTreeNode.fullPath.
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Constructor Summary
NavigationTreeModel(String pathSeparator, JAXXContext context)
           
 
Method Summary
 NavigationTreeNode findNode(NavigationTreeNode root, String path)
          Search from a given root node a node named by his fully path (concatenation of nodes NavigationTreeNode.path valued separated by NavigationModel.getPathSeparator().
 NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex)
          Apply first the regex pattern to obtain the searched node.
 NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex)
          Apply first the regex pattern to obtain the searched node.
 NavigationTreeNode findNode(String path)
          Search from the root node a node named by his fully path (concatenation of nodes NavigationTreeNode.path valued separated by dot.
 NavigationTreeNode findNode(String path, Pattern regex)
          Apply first the regex pattern to obtain the searched node.
 NavigationTreeNode findNode(String path, String regex)
          Apply first the regex pattern to obtain the searched node fi the given regex is not null.
 Object getBean(NavigationTreeNode node)
          Obtain the associated bean value from context corresponding to node
 Object getBean(String navigationPath)
          Obtain the associated bean value from context corresponding to node from given navigation path.
 JAXXContext getContext()
           
 String getPathSeparator()
           
 NavigationTreeNode getRoot()
           
 void nodeChanged(TreeNode node)
           
 void nodeChanged(TreeNode node, boolean deep)
           
 void nodeStructureChanged(TreeNode node)
           
protected  void reload(NavigationTreeNode node)
           
protected  void reload(NavigationTreeNode node, boolean deep)
           
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodesChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jaxx.runtime.swing.navigation.NavigationModel
getPathToRoot
 

Field Detail

pathSeparator

protected final String pathSeparator
The path separator used to build the NavigationTreeNode.fullPath.

See Also:
NavigationTreeNode.getNodePath(), NavigationTreeNode.getFullPath()
Constructor Detail

NavigationTreeModel

public NavigationTreeModel(String pathSeparator,
                           JAXXContext context)
Method Detail

getRoot

public NavigationTreeNode getRoot()
Specified by:
getRoot in interface TreeModel
Specified by:
getRoot in interface NavigationModel
Overrides:
getRoot in class DefaultTreeModel
See Also:
NavigationModel.getRoot()

findNode

public NavigationTreeNode findNode(String path)
Description copied from interface: NavigationModel
Search from the root node a node named by his fully path (concatenation of nodes NavigationTreeNode.path valued separated by dot.

Example :

$root.child1.leaf1

Specified by:
findNode in interface NavigationModel
Parameters:
path - the fully path of the searched node.
Returns:
the node matching the fully context from the root node, or null if not find.
See Also:
NavigationModel.findNode(String)

findNode

public NavigationTreeNode findNode(String path,
                                   String regex)
Description copied from interface: NavigationModel
Apply first the regex pattern to obtain the searched node fi the given regex is not null.

Search then from the root node a node named by his fully path (concatenation of nodes NavigationTreeNode.path valued separated by NavigationModel.getPathSeparator().

Example :

$root.child1.leaf1

Specified by:
findNode in interface NavigationModel
Parameters:
path - the fully path of the searched node.
regex - a optional regex to apply to path before searching
Returns:
the node matching the fully context from the root node, or null if not found.
See Also:
NavigationModel.findNode(String, String)

findNode

public NavigationTreeNode findNode(String path,
                                   Pattern regex)
Description copied from interface: NavigationModel
Apply first the regex pattern to obtain the searched node.

Search then from the root node a node named by his fully path (concatenation of nodes NavigationTreeNode.path valued separated by NavigationModel.getPathSeparator().

Example :

$root.child1.leaf1

Specified by:
findNode in interface NavigationModel
Parameters:
path - the fully path of the searched node.
regex - a optional regex to apply to path before searching
Returns:
the node matching the fully context from the root node, or null if not found.
See Also:
NavigationModel.findNode(String, Pattern)

findNode

public NavigationTreeNode findNode(NavigationTreeNode root,
                                   String path)
Description copied from interface: NavigationModel
Search from a given root node a node named by his fully path (concatenation of nodes NavigationTreeNode.path valued separated by NavigationModel.getPathSeparator().

Specified by:
findNode in interface NavigationModel
Parameters:
root - root node to be used
path - the fully path of the searched node.
Returns:
the node matching the fully context from the given root node, or null if not found.
See Also:
NavigationModel.findNode(NavigationTreeNode, String)

findNode

public NavigationTreeNode findNode(NavigationTreeNode root,
                                   String path,
                                   String regex)
Description copied from interface: NavigationModel
Apply first the regex pattern to obtain the searched node.

Search then from a given root node a node named by his fully path (concatenation of nodes) NavigationTreeNode.path valued separated by NavigationModel.getPathSeparator().

Specified by:
findNode in interface NavigationModel
Parameters:
root - root node to be used
path - the fully path of the searched node.
regex - a previous regex to apply to path : must have a matches
Returns:
the node matching the fully context from the given root node, or null if not found.
See Also:
NavigationModel.findNode(NavigationTreeNode, String, String)

findNode

public NavigationTreeNode findNode(NavigationTreeNode root,
                                   String path,
                                   Pattern regex)
Description copied from interface: NavigationModel
Apply first the regex pattern to obtain the searched node.

Search then from a given root node a node named by his fully path (concatenation of nodes NavigationTreeNode.path valued separated by NavigationModel.getPathSeparator().

Specified by:
findNode in interface NavigationModel
Parameters:
root - root node to be used
path - the fully path of the searched node.
regex - a previous regex to apply to path : must have a matches
Returns:
the node matching the fully context from the given root node, or null if not found.
See Also:
NavigationModel.findNode(NavigationTreeNode, String, Pattern)

getContext

public JAXXContext getContext()
Specified by:
getContext in interface NavigationModel
See Also:
NavigationModel.getContext()

getBean

public Object getBean(String navigationPath)
Description copied from interface: NavigationModel
Obtain the associated bean value from context corresponding to node from given navigation path.

Specified by:
getBean in interface NavigationModel
Parameters:
navigationPath - the current context path of the node
Returns:
the value associated in context with the given navigation path
See Also:
NavigationModel.getBean(String)

getBean

public Object getBean(NavigationTreeNode node)
Description copied from interface: NavigationModel
Obtain the associated bean value from context corresponding to node

Specified by:
getBean in interface NavigationModel
Parameters:
node - the current node
Returns:
the value associated in context with the given node.
See Also:
NavigationModel.getBean(NavigationTreeNode)

nodeChanged

public void nodeChanged(TreeNode node)
Specified by:
nodeChanged in interface NavigationModel
Overrides:
nodeChanged in class DefaultTreeModel
See Also:
NavigationModel.nodeChanged(TreeNode)

nodeStructureChanged

public void nodeStructureChanged(TreeNode node)
Specified by:
nodeStructureChanged in interface NavigationModel
Overrides:
nodeStructureChanged in class DefaultTreeModel
See Also:
NavigationModel.nodeStructureChanged(TreeNode)

nodeChanged

public void nodeChanged(TreeNode node,
                        boolean deep)
Specified by:
nodeChanged in interface NavigationModel
See Also:
NavigationModel.nodeChanged(TreeNode, boolean)

reload

protected void reload(NavigationTreeNode node)

reload

protected void reload(NavigationTreeNode node,
                      boolean deep)

getPathSeparator

public String getPathSeparator()
Specified by:
getPathSeparator in interface NavigationModel
See Also:
NavigationModel.getPathSeparator()


Copyright © 2008-2010 CodeLutin. All Rights Reserved.