org.safs.jvmagent.agents
Class JMenuAgent

java.lang.Object
  extended by org.safs.jvmagent.agents.ObjectAgent
      extended by org.safs.jvmagent.agents.ComponentAgent
          extended by org.safs.jvmagent.agents.ContainerAgent
              extended by org.safs.jvmagent.agents.JComponentAgent
                  extended by org.safs.jvmagent.agents.JMenuAgent
All Implemented Interfaces:
AlternateAncestorUser, LocalAgent, LocalAgentFactoryUser, LocalSubItemsAgent
Direct Known Subclasses:
JMenuAgent

public class JMenuAgent
extends JComponentAgent

Since:
Feb 20, 2006

Field Summary
static java.lang.String objectType
           
 
Fields inherited from class org.safs.jvmagent.agents.ObjectAgent
alternateAncestor, alternateAncestorClassname, factory
 
Constructor Summary
JMenuAgent()
          Creates a new instance of JMenuAgent
 
Method Summary
 java.lang.Object getMatchingPathObject(java.lang.Object object, java.lang.String path)
          Return the subitem at the specified string path from the given object.
 java.lang.Object getSubItemAtIndex(java.lang.Object object, int index)
          Return the subitem at the specified index from the given object.
 boolean isMatchingPath(java.lang.Object object, java.lang.String path)
          Determine if the object contains a subitem/object identified by the provided Path.
protected  java.lang.Object traverseMenu(java.lang.Object object, java.lang.String path)
          returns a menu item control according to the path
 
Methods inherited from class org.safs.jvmagent.agents.ContainerAgent
getChildCount, getChildren
 
Methods inherited from class org.safs.jvmagent.agents.ComponentAgent
convertCoords, validateActionCommand, validateComponent
 
Methods inherited from class org.safs.jvmagent.agents.ObjectAgent
getAlternateAncestor, getAlternateAncestorClassname, getAncestorAgent, getCaption, getClassName, getID, getLevel, getLocalAgentFactory, getName, getProperty, getPropertyNames, getStringData, getSuperClassNames, getText, isShowing, isValid, process, processAncestor, setAlternateAncestor, setAlternateAncestorClassname, setLocalAgentFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectType

public static final java.lang.String objectType
See Also:
Constant Field Values
Constructor Detail

JMenuAgent

public JMenuAgent()
Creates a new instance of JMenuAgent

Method Detail

getSubItemAtIndex

public java.lang.Object getSubItemAtIndex(java.lang.Object object,
                                          int index)
                                   throws java.lang.Exception
Return the subitem at the specified index from the given object. This may be a ComboBox item, a List item, or a Tree node, etc... The returned item may be a component object or perhaps a String representing the text of the item. The return type is object specific.

Specified by:
getSubItemAtIndex in interface LocalSubItemsAgent
Overrides:
getSubItemAtIndex in class ObjectAgent
Parameters:
object - reference from which to locate the subitem.
index - of the subitem to retrieve.
Returns:
subitem object or String
Throws:
an - Exception if the subitem index is invalid or subitem is unobtainable.
java.lang.Exception

getMatchingPathObject

public java.lang.Object getMatchingPathObject(java.lang.Object object,
                                              java.lang.String path)
                                       throws java.lang.Exception
Return the subitem at the specified string path from the given object. This is a hierarchical path of parent->child relationships separated by "->". The returned item may be a component object or perhaps a String representing the text of the item. The return type is object specific. This is often used to identify items in Menus and Trees.

Ex:

File->Exit
Root->Branch->Leaf

Specified by:
getMatchingPathObject in interface LocalAgent
Specified by:
getMatchingPathObject in interface LocalSubItemsAgent
Overrides:
getMatchingPathObject in class ObjectAgent
Parameters:
object -
path - to desired subitem using item->subitem->subitem format.
Returns:
subitem object or String
Throws:
java.lang.Exception
See Also:
LocalAgent.getMatchingPathObject(Object, String)

isMatchingPath

public boolean isMatchingPath(java.lang.Object object,
                              java.lang.String path)
                       throws java.lang.Exception
Determine if the object contains a subitem/object identified by the provided Path. Path is hierarchical information showing parent->child relationships separated by '->'. This is often used in Menus and Trees.

Ex:

File->Exit
Root->Branch->Leaf

Specified by:
isMatchingPath in interface LocalAgent
Specified by:
isMatchingPath in interface LocalSubItemsAgent
Overrides:
isMatchingPath in class ObjectAgent
Parameters:
object--Object - proxy for the object to be evaluated.
path - information to locate another object or subitem relative to object. this is usually something like a menuitem or tree node where supported.
Returns:
true if the child sub-object was found relative to object.
Throws:
java.lang.Exception
See Also:
LocalAgent.isMatchingPath(Object, String)

traverseMenu

protected java.lang.Object traverseMenu(java.lang.Object object,
                                        java.lang.String path)
returns a menu item control according to the path

Parameters:
object - a menu or menu item control
path - the path of the menu item on the menu hierarchy