wt.templateutil.navigationbar
Class NavigationTreeModel

java.lang.Object
  extended bywt.templateutil.navigationbar.NavigationTreeModel
All Implemented Interfaces:
TreeModel

public class NavigationTreeModel
extends Object
implements TreeModel

Implementation of the TreeModel interface that works with the NavigationTreeNode class. The implementation of methods of the TreeModel interface are straight forward and intuitively what would be expected. The only idiosyncrasy is that the nodes passed in need to be an instance of NavigationTreeNode.

There are several methods that are provide additional functionality beyond the TreeModel interface. These methods support Navigation Bar specific functionality. For example, the method buldSelectedNodeList is used to create a chain of NavigationTreeNodes that represent the descent into a multi-tier navigation scheme down to the NavigationTreeNode that generated the current URL.

Supported API: false

Extendable: false


Field Summary
private  String name
          Deprecated.  
private  NavigationTreeNode root
          Deprecated.  
private  List selectedNodeList
          Deprecated.  
 
Constructor Summary
NavigationTreeModel(String name, NavigationTreeNode root)
          Deprecated.  
 
Method Summary
protected  void addSelectedNode(NavigationTreeNode treeNode, HashMap queryValueMap, Object contextObject)
          Deprecated. Recursive function that builds the selected node list.
 void addTreeModelListener(TreeModelListener l)
          Deprecated. Throws an UnsupportedOperationException when called
 void buildSelectedNodeList(HashMap queryValueMap, Object contextObject)
          Deprecated. Builds a list of nodes based on the current URL query string (queryValueMap) that represents a "chain of links".
 Object getChild(Object parent, int index)
          Deprecated. Returns the child of the parent at the position index specified by index, if the parent is a NavigationTreeNode.
 int getChildCount(Object parent)
          Deprecated.  
 int getIndexOfChild(Object parent, Object child)
          Deprecated. Returns index of the child in the list of the parent's immediate descendents.
 String getName()
          Deprecated.  
 Object getRoot()
          Deprecated.  
 List getSelectNodeList()
          Deprecated. Returns an unmodifiable list that represents a "chain of links" leading the currently selected link based on the current URL in a multi-tier navigation tree.
 boolean isLeaf(Object node)
          Deprecated.  
 boolean isSelectedNode(NavigationTreeNode treeNode)
          Deprecated. Returns a flag to indicate if the NavigationTreeNode passed in is on the "chain of links" in part of a multi-tier navigation tree.
 void removeTreeModelListener(TreeModelListener l)
          Deprecated. Throws an UnsupportedOperationException when called
 void valueForPathChanged(TreePath path, Object newValue)
          Deprecated. Empty implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private String name
Deprecated. 

root

private NavigationTreeNode root
Deprecated. 

selectedNodeList

private List selectedNodeList
Deprecated. 
Constructor Detail

NavigationTreeModel

public NavigationTreeModel(String name,
                           NavigationTreeNode root)
Deprecated. 
Method Detail

getName

public String getName()
Deprecated. 

getRoot

public Object getRoot()
Deprecated. 
Specified by:
getRoot in interface TreeModel

getChild

public Object getChild(Object parent,
                       int index)
Deprecated. 
Returns the child of the parent at the position index specified by index, if the parent is a NavigationTreeNode. Otherwise, null is returned.

Specified by:
getChild in interface TreeModel
Parameters:
parent - - Child at index "index" is returned. Needs to be a NavigationTreeNode instance.
index - - Position of child in parent subtree

getChildCount

public int getChildCount(Object parent)
Deprecated. 
Specified by:
getChildCount in interface TreeModel

isLeaf

public boolean isLeaf(Object node)
Deprecated. 
Specified by:
isLeaf in interface TreeModel

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Deprecated. 
Empty implementation. No action is performed.

Specified by:
valueForPathChanged in interface TreeModel

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Deprecated. 
Returns index of the child in the list of the parent's immediate descendents.

If the parent or the child is NOT an instance of NavigationTreeNode, -1 is returned.

Specified by:
getIndexOfChild in interface TreeModel
Parameters:
parent - - Needs to be a NavigationTreeNode instance
child - - Needs to be a NavigationTreeNode instance

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Deprecated. 
Throws an UnsupportedOperationException when called

Specified by:
addTreeModelListener in interface TreeModel
Parameters:
l -

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Deprecated. 
Throws an UnsupportedOperationException when called

Specified by:
removeTreeModelListener in interface TreeModel
Parameters:
l -

isSelectedNode

public boolean isSelectedNode(NavigationTreeNode treeNode)
Deprecated. 
Returns a flag to indicate if the NavigationTreeNode passed in is on the "chain of links" in part of a multi-tier navigation tree. For example, if the NavigationTreeModel represents a three tiered navigation scheme and the current URL represents a link on the bottom tier, then the link on the bottom tier, its parent link, and its grandparent link are all part of the "chain of links". If the treeNode instance is any one of the those three nodes, then true is returned. Otherwise, false is returned.

Parameters:
treeNode - - Candidate NavigationTreeNode to check for membership on the "chain of links"

buildSelectedNodeList

public void buildSelectedNodeList(HashMap queryValueMap,
                                  Object contextObject)
Deprecated. 
Builds a list of nodes based on the current URL query string (queryValueMap) that represents a "chain of links".

For example, if the NavigationTreeModel represents a three tiered navigation scheme and the current URL represents a link on the bottom tier, then the link on the bottom tier, its parent link, and its grandparent link are all part of the "chain of links". The list that is returned contains those nodes, with the first node representing the node on the first tier, and the last node representing the node that generated the current URL(not necessarily a node in the bottom tier).

Parameters:
queryValueMap - - name/value pairs from the query string of the current URL
contextObject - - the current context object

getSelectNodeList

public List getSelectNodeList()
Deprecated. 
Returns an unmodifiable list that represents a "chain of links" leading the currently selected link based on the current URL in a multi-tier navigation tree.

For example, if the NavigationTreeModel represents a three tiered navigation scheme and the current URL represents a link on the bottom tier, then the link on the bottom tier, its parent link, and its grandparent link are all part of the "chain of links". The list that is returned contains those nodes, with the first node representing the node on the first tier, and the last node representing the node that generated the current URL(not necessarily a node in the bottom tier).


addSelectedNode

protected void addSelectedNode(NavigationTreeNode treeNode,
                               HashMap queryValueMap,
                               Object contextObject)
Deprecated. 
Recursive function that builds the selected node list. Given the node, treeNode, it finds if treeNode has a child that is "selected". That child is added to the list and then the children of the selected child are checked recursively.