org.apache.myfaces.trinidad.menu
Class MenuNode

java.lang.Object
  extended by org.apache.myfaces.trinidad.menu.MenuNode
Direct Known Subclasses:
GroupNode, ItemNode

public class MenuNode
extends Object

Code generic to a Menu Nodes of the menu model. IMPORTANT NOTE: even internally, values that support EL expressions should use the "get" methods to obtain values.


Constructor Summary
MenuNode()
          Constructs a MenuNode
 
Method Summary
 String doAction()
          Called by the Default ActionListener when a menu node is clicked/selected.
 char getAccessKey()
          getAccessKey - get the label's accessKey as a char.
 String getAccessKeyProperty()
           
 String getBundleKeyProperty()
           
 String getBundleNameProperty()
           
 List<MenuNode> getChildren()
          Get the List of menu item's children.
 List<MenuNode> getChildrenProperty()
           
 boolean getDefaultFocusPath()
          Gets the defaultFocusPath attribute of the menu item.
 String getDefaultFocusPathProperty()
           
 String getDestination()
          Get the Destination URL of a page for a GET.
 boolean getDisabled()
          Gets the disabled attribute of the menu item.
 String getDisabledProperty()
           
 String getFocusViewId()
          Gets the value of the node's focusViewId property.
 String getFocusViewIdProperty()
           
protected  String getHandlerId()
          Set the MenuContentHandlerImpl's id.
 String getHandlerIdProperty()
           
 String getIcon()
          Get the icon used by the menu item This could either be a string value set directly in the metadata or an EL expression string.
 String getIconProperty()
           
 String getId()
          getId - gets the metadata id of the node.
 String getIdProperty()
           
 String getLabel()
          Get the menu item's label This could either be a string value set directly in the metadata or an EL expression string.
 String getLabelAndAccessKey()
          getLabelAndAccessKey - get the label and accessKey together in a single string.
 String getLabelAndAccessKeyProperty()
           
 String getLabelProperty()
           
 String getModelId()
          Gets the local (shared node's) menu Model's Request map key.
 String getModelIdProperty()
           
 boolean getReadOnly()
          Gets the readOnly state of the node.
 String getReadOnlyProperty()
           
 MenuNode getRefNode()
          Get the node whose id matches this node's idref attribute value.
 boolean getRendered()
          Gets the rendered attribute of the menu item.
 String getRenderedProperty()
           
 int getRootId()
           
 int getRootIdProperty()
           
protected  XMLMenuModel getRootModel()
          Get the top-level, root menu model, which contains the entire menu tree.
 String getRootModelKey()
          Get the top-level, root menu model Request Map Key.
 String getRootModelKeyProperty()
           
 MenuNode getThreadSafeCopy()
          Construct a thread safe version of this object and return it.
 String getUniqueId()
          getUniqueId - gets the unique id of the node.
 String getUniqueIdProperty()
           
 boolean getVisible()
          Gets the visible attribute of the menu item.
 String getVisibleProperty()
           
protected  void postSelectedNode(MenuNode selectedNode)
          Notifies the root model that this node has been selected on a POST
 void setAccessKey(char accessKey)
          setAccessKey - Takes a single character and sets the value of the accessKey attribute of the node.
 void setAccessKey(String accessKey)
          setAccessKey - Takes either a single character String or an EL expression and sets the value of the accessKey attribute of the node.
 void setChildren(List<MenuNode> children)
          Set the List of menu item's children.
 void setDefaultFocusPath(boolean defaultFocusPath)
          Sets the defaultFocusPath attribute of the menu item.
 void setDefaultFocusPath(String defaultFocusPathStr)
          Sets the defaultFocusPath attribute of the menu item.
 void setDisabled(boolean disabled)
          Sets the disabled attribute of the menu item.
 void setDisabled(String disabledStr)
          Sets the disabled attribute of the menu item.
 void setFocusViewId(String focusViewId)
          Sets the value of the node's focusViewId property.
 void setHandlerId(String handlerId)
          setHandlerId - sets the MenuContentHandlerImpl's handlerId on the node.
 void setIcon(String icon)
          Set the icon used by the menu item.
 void setId(String id)
          setId - sets the id of the node.
 void setLabel(String label)
          Set the menu item's label.
 void setLabelAndAccessKey(String labelAndAccessKey)
          setLabelAndAccessKey - Takes either an EL expression or a String representing the label and accessKey together, and sets the label and the accessKey separately.
 void setModelId(String modelId)
          Sets the local (shared node's) menu Model's Request map key.
 void setReadOnly(boolean readOnly)
          Sets the the value of the readOnly attribute of the node.
 void setReadOnly(String readOnlyStr)
          Sets the readOnly attribute of the menu item.
 void setRendered(boolean rendered)
          Sets the rendered attribute of the menu item.
 void setRendered(String renderedStr)
          Sets the rendered attribute of the menu item.
 void setResBundleKey(String bundleKey)
          setResBundleKey - sets the name of the resource bundle used in obtaining the node's label text.
 void setResBundleName(String bundleName)
          setResBundleKey - sets the name of the resource bundle used in obtaining the node's label text.
 void setRootId(int id)
           
 void setRootModelKey(String rootModelKey)
          Sets the root menu Model's Request map key.
 void setVisible(boolean visible)
          Sets the visible attribute of the menu item.
 void setVisible(String visibleStr)
          Sets the visible attribute of the menu item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuNode

public MenuNode()
Constructs a MenuNode

Method Detail

setLabel

public void setLabel(String label)
Set the menu item's label.

Parameters:
label - - String name shown in the menu item

getLabel

public String getLabel()
Get the menu item's label This could either be a string value set directly in the metadata or an EL expression string. In the case of an EL expression, we need to get its bound value.

Returns:
label as a String

setIcon

public void setIcon(String icon)
Set the icon used by the menu item.

Parameters:
icon - - the String URI to the icon.

getIcon

public String getIcon()
Get the icon used by the menu item This could either be a string value set directly in the metadata or an EL expression string. In the case of an EL expression, we need to get its bound value.

Returns:
icon - the String URI to the icon.

setRendered

public void setRendered(boolean rendered)
Sets the rendered attribute of the menu item. If false, menu item will not appear.

Parameters:
rendered - - boolean that toggles the visible state of the XMLMenuModel item.

getRendered

public boolean getRendered()
Gets the rendered attribute of the menu item. If false, menu item will not appear.

Returns:
boolean indicating whether or not the menu item is visible.

setDisabled

public void setDisabled(boolean disabled)
Sets the disabled attribute of the menu item. If true, menu item will not appear greyed-out and clicking on it will have no effect

Parameters:
disabled - - boolean that toggles the enabled/disabled state of the menu item.

getDisabled

public boolean getDisabled()
Gets the disabled attribute of the menu item. If true, menu item will not appear greyed-out and clicking on it will have no effect

Returns:
boolean indicating whether or not the menu item is disabled.

setVisible

public void setVisible(boolean visible)
Sets the visible attribute of the menu item. If false, menu item will not appear

Parameters:
visible - - boolean that toggles the visible state of the menu item.

getVisible

public boolean getVisible()
Gets the visible attribute of the menu item. If false, menu item will not appear

Returns:
boolean indicating whether or not the menu item is visible.

setDefaultFocusPath

public void setDefaultFocusPath(boolean defaultFocusPath)
Sets the defaultFocusPath attribute of the menu item.

Parameters:
defaultFocusPath - - boolean that tells the XMLMenuModel model that the focus path to this node should be used in cases where the focus path is not determinable by the XMLMenuModel model.

getDefaultFocusPath

public boolean getDefaultFocusPath()
Gets the defaultFocusPath attribute of the menu item.

Returns:
boolean indicating whether or not this is the focus path to use, by default, in cases where there are duplicate paths to this node and the focus path is not determinable by the XMLMenuModel model.

getChildren

public List<MenuNode> getChildren()
Get the List of menu item's children.

Returns:
List of menu item's children

setChildren

public void setChildren(List<MenuNode> children)
Set the List of menu item's children.

Parameters:
children - - List of MenuNode children for this MenuNode

getReadOnly

public boolean getReadOnly()
Gets the readOnly state of the node.

Returns:
the node's readOnly state as a boolean.

setReadOnly

public void setReadOnly(boolean readOnly)
Sets the the value of the readOnly attribute of the node.

Parameters:
readOnly - - boolean setting readOnly state of the node

setFocusViewId

public void setFocusViewId(String focusViewId)
Sets the value of the node's focusViewId property.

Parameters:
focusViewId - - string value of the Node's "focusViewId" property.

getFocusViewId

public String getFocusViewId()
Gets the value of the node's focusViewId property.

Returns:
string - the value of the Node's "focusViewId" property.

setRendered

public void setRendered(String renderedStr)
Sets the rendered attribute of the menu item. If false, menu item will not appear. Called only from MenuContentHandlerImpl during parsing of metadata.

Parameters:
renderedStr - - string representing a boolean value

setDisabled

public void setDisabled(String disabledStr)
Sets the disabled attribute of the menu item. If false, menu item will appear in a disabled state.

Parameters:
disabledStr - - string representing a boolean value or an EL Expression

setReadOnly

public void setReadOnly(String readOnlyStr)
Sets the readOnly attribute of the menu item. If false, menu item will appear in a readOnly state.

Parameters:
readOnlyStr - - string representing a boolean value or EL expression.

setVisible

public void setVisible(String visibleStr)
Sets the visible attribute of the menu item. If false, menu item will not appear.

Parameters:
visibleStr - - string representing a boolean value or an EL Expression

setDefaultFocusPath

public void setDefaultFocusPath(String defaultFocusPathStr)
Sets the defaultFocusPath attribute of the menu item. Called only from MenuContentHandlerImpl during parsing of metadata.

Parameters:
defaultFocusPathStr - - string representing a boolean value

setAccessKey

public void setAccessKey(String accessKey)
setAccessKey - Takes either a single character String or an EL expression and sets the value of the accessKey attribute of the node.

Parameters:
accessKey - - Single character String or EL expression representing the label's access key.

setAccessKey

public void setAccessKey(char accessKey)
setAccessKey - Takes a single character and sets the value of the accessKey attribute of the node.

Parameters:
accessKey - - Single character label access key.

getAccessKey

public char getAccessKey()
getAccessKey - get the label's accessKey as a char.

Returns:
the access key of the label as a char.

setLabelAndAccessKey

public void setLabelAndAccessKey(String labelAndAccessKey)
setLabelAndAccessKey - Takes either an EL expression or a String representing the label and accessKey together, and sets the label and the accessKey separately.

Parameters:
labelAndAccessKey - - either and EL Expression or a String representing the label and accessKey together.

getLabelAndAccessKey

public String getLabelAndAccessKey()
getLabelAndAccessKey - get the label and accessKey together in a single string.

Returns:
a String containing (representing) the label and accessKey together.

setId

public void setId(String id)
setId - sets the id of the node.

Parameters:
id - - the identifier for the node component

getId

public String getId()
getId - gets the metadata id of the node.

Returns:
- String identifier for the node component.

getRefNode

public MenuNode getRefNode()
Get the node whose id matches this node's idref attribute value.

Returns:
the MenuNode whose id matches this node's idref attribute value.

doAction

public String doAction()
Called by the Default ActionListener when a menu node is clicked/selected.

Returns:
String outcome or viewId used during a POST for navigation.

getDestination

public String getDestination()
Get the Destination URL of a page for a GET.

Returns:
String URL of a page.

getRootModelKey

public String getRootModelKey()
Get the top-level, root menu model Request Map Key.

Returns:
root, top-level XMLMenuModel's Request Map Key.

setRootModelKey

public void setRootModelKey(String rootModelKey)
Sets the root menu Model's Request map key.

This is always only the top-level, root model's Request map key. We do this because the MenuContentHandlerImpl and nodes need to be able to call into the root model to:

Parameters:
rootModelKey - - String the root, top-level menu model's Request map key.

getModelId

public String getModelId()
Gets the local (shared node's) menu Model's Request map key.


setModelId

public void setModelId(String modelId)
Sets the local (shared node's) menu Model's Request map key.

This is appended to the node's id to create a unique id.

Parameters:
rootModelKey - - String the local (shared node's) menu Model's Request map key.

getRootId

public int getRootId()

setRootId

public void setRootId(int id)

getLabelProperty

public final String getLabelProperty()

getIconProperty

public final String getIconProperty()

getChildrenProperty

public final List<MenuNode> getChildrenProperty()

getFocusViewIdProperty

public final String getFocusViewIdProperty()

getRenderedProperty

public final String getRenderedProperty()

getDisabledProperty

public final String getDisabledProperty()

getVisibleProperty

public final String getVisibleProperty()

getReadOnlyProperty

public final String getReadOnlyProperty()

getHandlerIdProperty

public final String getHandlerIdProperty()

getBundleKeyProperty

public final String getBundleKeyProperty()

getBundleNameProperty

public final String getBundleNameProperty()

getAccessKeyProperty

public final String getAccessKeyProperty()

getIdProperty

public final String getIdProperty()

getModelIdProperty

public final String getModelIdProperty()

getUniqueIdProperty

public final String getUniqueIdProperty()

getLabelAndAccessKeyProperty

public final String getLabelAndAccessKeyProperty()

getDefaultFocusPathProperty

public final String getDefaultFocusPathProperty()

getRootModelKeyProperty

public final String getRootModelKeyProperty()

getRootIdProperty

public final int getRootIdProperty()

setResBundleKey

public void setResBundleKey(String bundleKey)
setResBundleKey - sets the name of the resource bundle used in obtaining the node's label text. Used, along with the handerId, to identify and get a string from the proper resource bundle.

Parameters:
bundleKey - - String name of the resource bundle.

setResBundleName

public void setResBundleName(String bundleName)
setResBundleKey - sets the name of the resource bundle used in obtaining the node's label text. Used, along with the handerId, to identify and get a string from the proper resource bundle.

Parameters:
bundleName - - String name of the resource bundle.

setHandlerId

public void setHandlerId(String handlerId)
setHandlerId - sets the MenuContentHandlerImpl's handlerId on the node. Used, along with the bundleKey, to identify and get a string from the proper resource bundle.

Parameters:
handlerId - String uniquely identifying the specific MenuContentHandlerImpl that created this node.

postSelectedNode

protected void postSelectedNode(MenuNode selectedNode)
Notifies the root model that this node has been selected on a POST

Parameters:
selectedNode - - The currently selected menu item.

getUniqueId

public String getUniqueId()
getUniqueId - gets the unique id of the node.

Returns:
- String identifier for the node component.

getHandlerId

protected String getHandlerId()
Set the MenuContentHandlerImpl's id.

Returns:
String object id of the MenuContentHandlerImpl

getRootModel

protected XMLMenuModel getRootModel()
Get the top-level, root menu model, which contains the entire menu tree.

Returns:
root, top-level XMLMenuModel

getThreadSafeCopy

public MenuNode getThreadSafeCopy()
Construct a thread safe version of this object and return it.

Returns:
a thread safe copy of this object.


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.