org.safs.rational
Class MenuTree
java.lang.Object
org.safs.Tree
org.safs.rational.MenuTree
- All Implemented Interfaces:
- java.io.Serializable
public class MenuTree
- extends Tree
Purpose: To handle the manipulation of JMenuBar and JPopupMenu
- Since:
- APR 25, 2008
JUN 12, 2009 (LeiWang) Add method toString() to print the tree.
NOV 02, 2009 (LeiWang) Modify method getTreePathAndStatus(String) to getTreePaths(String, boolean)
This method will return a list of menu tree path with or without menuitem's status.
- See Also:
- Serialized Form
| Methods inherited from class org.safs.Tree |
exactMatchPath, findMatchPath, getChildCount, getFirstChild, getLevel, getNextSibling, getSiblingCount, getUserObject, setChildCount, setLevel, setSiblingCount, toStringArray, toStringArrayWOSiblings |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MenuTree
public MenuTree()
getMenuTreeNode
public MenuTreeNode getMenuTreeNode()
setUserObject
public void setUserObject(java.lang.Object userObject)
- Overrides:
setUserObject in class Tree
setFirstChild
public void setFirstChild(Tree firstChild)
- Overrides:
setFirstChild in class Tree
setNextSibling
public void setNextSibling(Tree nextSibling)
- Overrides:
setNextSibling in class Tree
getTreePaths
public java.util.List getTreePaths(java.lang.String ancestorPath,
boolean getPahtwithSatus)
- Returns:
- List, a list of the path and status of each node of this tree
Example: {"File=Enabled","File->Open=Enabled","File-Open=Enabled","Edit=Enabled","Edit->Cut=Disabled","Edit->Copy=Enabled"}
matchPath
public java.lang.String matchPath(java.lang.String pathTobeMatched,
boolean fuzzy,
java.lang.String status)
Purpose: find an matched path based on the parameter by walking the tree.
finding a string which equals each matching substring if fuzzy is false;
finding a string which contains the matching substring if fuzzy is true.
finally returning the full path if it matched.
Assumptions: pathTobeMatched is not null;
first part of pathTobeMatched will be considered the match, subsequent matches would therefore be ignored.
for example, if pathTobeMatched is "firstlevel->secondlevel", only "firstlevel" will be considered at this level,
"secondlevel" will be considered at it's child level.
- Parameters:
pathTobeMatched, - String, the path to be matchedfuzzy, - boolean, Whether the match is exactstatus, - String, the status of the node, example "Enabled Checked"
- Returns:
- full path to match, null otherwise
toString
public java.lang.String toString()
- Overrides:
toString in class Tree