|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.faces.model.DataModel
org.apache.myfaces.trinidad.model.CollectionModel
org.apache.myfaces.trinidad.model.TreeModel
org.apache.myfaces.trinidad.model.MenuModel
org.apache.myfaces.trinidad.model.BaseMenuModel
org.apache.myfaces.trinidad.model.XMLMenuModel
public class XMLMenuModel
Creates a Menu Model from a TreeModel where nodes in the treeModel contain viewId information.
Each node must have either a bean getter method or a Map property that returns a viewId. There are several restrictions on the data:
The getFocusRowKey method
The Model is created by specifying it in the faces-config.xml file as follows
<managed-bean> <managed-bean-name>hr_menu</managed-bean-name> <managed-bean-class> org.apache.myfaces.trinidad.model.XMLMenuModel </managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>source</property-name> <property-class>java.lang.String</property-class> <value>/WEB-INF/hr-menu.xml</value> </managed-property> </managed-bean>
Nested Class Summary | |
---|---|
static interface |
XMLMenuModel.MenuContentHandler
|
Constructor Summary | |
---|---|
XMLMenuModel()
|
Method Summary | |
---|---|
void |
addViewId(java.lang.String newViewId,
java.lang.String aliasedViewId)
Maps the focusPath returned when the viewId is newViewId to the focusPath returned when the viewId is aliasedViewId. |
boolean |
getCreateHiddenNodes()
Gets the boolean value that determines whether or not to create nodes whose rendered attribute value is false. |
java.lang.Object |
getCustomProperty(java.lang.Object node,
java.lang.String propName)
Gets the list of custom properties from the node and returns the value of propName. |
java.lang.Object |
getFocusRowKey()
Returns the rowKey to the current viewId, or in the case of where the model has nodes with duplicate viewId's and one is encountered, we return the rowKey of the currently selected node. |
java.lang.Object |
getNode(java.lang.String id)
Get a the MenuNode corresponding to the key "id" from the node id hashmap. |
java.lang.String |
getSource()
Gets the URI to the XML menu metadata. |
java.io.InputStream |
getStream(java.lang.String uri)
getStream - Opens an InputStream to the provided URI. |
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
getViewIdFocusPathMap()
Get the Model's viewIdFocusPathMap |
void |
setCreateHiddenNodes(boolean createHiddenNodes)
Sets the boolean value that determines whether or not to create nodes whose rendered attribute value is false. |
void |
setCurrentlyPostedNode(java.lang.Object currentNode)
Sets the currently selected node and the request method. |
void |
setSource(java.lang.String menuMetadataUri)
setSource - specifies the XML metadata and creates the XML Menu Model. |
void |
setWrappedData(java.lang.Object data)
Makes the TreeModel part of the menu model. |
Methods inherited from class org.apache.myfaces.trinidad.model.BaseMenuModel |
---|
enterContainer, exitContainer, getContainerRowKey, getRowCount, getRowData, getRowIndex, getRowKey, getWrappedData, isContainer, isRowAvailable, setRowIndex, setRowKey |
Methods inherited from class org.apache.myfaces.trinidad.model.TreeModel |
---|
getAllAncestorContainerRowKeys, getContainerRowKey, getDepth, getDepth, isContainerEmpty |
Methods inherited from class org.apache.myfaces.trinidad.model.CollectionModel |
---|
getRowData, getSortCriteria, isRowAvailable, isSortable, setSortCriteria |
Methods inherited from class javax.faces.model.DataModel |
---|
addDataModelListener, getDataModelListeners, removeDataModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLMenuModel()
Method Detail |
---|
public void setSource(java.lang.String menuMetadataUri)
menuMetadataUri
- - String URI to the XML metadata.public void setWrappedData(java.lang.Object data)
setWrappedData
in class BaseMenuModel
data
- The Tree Model instancepublic java.lang.Object getFocusRowKey()
The getFocusRowKey method
getFocusRowKey
in class MenuModel
public java.lang.String getSource()
public void setCreateHiddenNodes(boolean createHiddenNodes)
public boolean getCreateHiddenNodes()
public void addViewId(java.lang.String newViewId, java.lang.String aliasedViewId)
newViewId
- the view id to add a focus path for.aliasedViewId
- the view id to use to get the focusPath to use
for newViewId.public void setCurrentlyPostedNode(java.lang.Object currentNode)
currentNode
- The currently selected node in the menupublic java.lang.Object getNode(java.lang.String id)
id
- - String node id key for the hashmap entry.
public java.lang.Object getCustomProperty(java.lang.Object node, java.lang.String propName)
node
- Object used to get its list of custom propertiespropName
- String name of the property whose value is desired
public java.io.InputStream getStream(java.lang.String uri)
uri
- - String uri to a data source.
public java.util.Map<java.lang.String,java.util.List<java.lang.Object>> getViewIdFocusPathMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |