public class XMLMenuModel extends BaseMenuModel
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>Objects of this class are not thread safe and should be used only in request scope.
Modifier and Type | Class and Description |
---|---|
static interface |
XMLMenuModel.MenuContentHandler |
LocalRowKeyIndex.Confidence, LocalRowKeyIndex.LocalCachingStrategy
Modifier and Type | Field and Description |
---|---|
static String |
SHARED_MODEL_INDICATOR_KEY
This key is used to store information about the included xml menu
models which are constructed during parsing.
|
UNKNOWN_ROW_LIMIT, UNLIMITED_ROW
Constructor and Description |
---|
XMLMenuModel() |
Modifier and Type | Method and Description |
---|---|
void |
addViewId(String newViewId,
String aliasedViewId)
Maps the focusPath returned when the viewId is newViewId
to the focusPath returned when the viewId is aliasedViewId.
|
protected Object |
getCacheKey() |
protected int |
getContentHandlerId() |
protected Map<Object,List<XMLMenuModel.MenuContentHandler>> |
getContentHandlerMap()
Returns the map of content handlers
which hold the state of one XML tree.
|
boolean |
getCreateHiddenNodes()
Gets the boolean value that determines whether or not to create
nodes whose rendered attribute value is false.
|
Object |
getCustomProperty(Object node,
String propName)
Gets the list of custom properties from the node
and returns the value of propName.
|
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.
|
Object |
getNode(String id)
Get a the MenuNode corresponding to the key "id" from the
node id hashmap.
|
String |
getSource()
Gets the URI to the XML menu metadata.
|
InputStream |
getStream(String uri)
getStream - Opens an InputStream to the provided URI.
|
Map<String,List<Object>> |
getViewIdFocusPathMap()
Get the Model's viewIdFocusPathMap
|
protected boolean |
isCompatibilityMode()
This needs to be overriden by classes extending XmlMenuModel and using APIs for the nodes
of XmlMenuModel.
|
void |
setCreateHiddenNodes(boolean createHiddenNodes)
Sets the boolean value that determines whether or not to create
nodes whose rendered attribute value is false.
|
void |
setCurrentlyPostedNode(Object currentNode)
Sets the currently selected node and the request method.
|
void |
setSource(String menuMetadataUri)
setSource - specifies the XML metadata and creates
the XML Menu Model.
|
void |
setWrappedData(Object data)
Makes the TreeModel part of the menu model.
|
enterContainer, exitContainer, getContainerRowKey, getRowCount, getRowData, getRowIndex, getRowKey, getWrappedData, isContainer, isRowAvailable, setRowIndex, setRowKey
areRowsLocallyAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, getAllAncestorContainerRowKeys, getContainerRowKey, getDepth, getDepth, isChildCollectionLocallyAvailable, isChildCollectionLocallyAvailable, isChildCollectionLocallyAvailable, isContainerEmpty
addRowKeyChangeListener, areRowsAvailable, areRowsAvailable, areRowsAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, clearCachedRow, clearCachedRow, clearCachedRows, clearCachedRows, clearLocalCache, ensureRowsAvailable, fireRowKeyChange, getCachingStrategy, getEstimatedRowCount, getEstimatedRowCountConfidence, getRowData, getRowData, getRowLimit, getSortCriteria, isRowAvailable, isRowAvailable, isRowLocallyAvailable, isRowLocallyAvailable, isSortable, removeRowKeyChangeListener, setSortCriteria
public static final String SHARED_MODEL_INDICATOR_KEY
protected boolean isCompatibilityMode()
public void setSource(String menuMetadataUri)
menuMetadataUri
- - String URI to the XML metadata.public void setWrappedData(Object data)
setWrappedData
in class BaseMenuModel
data
- The Tree Model instancepublic Object getFocusRowKey()
The getFocusRowKey method
getFocusRowKey
in class MenuModel
public String getSource()
public void setCreateHiddenNodes(boolean createHiddenNodes)
public boolean getCreateHiddenNodes()
public void addViewId(String newViewId, 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(Object currentNode)
currentNode
- The currently selected node in the menupublic Object getNode(String id)
id
- - String node id key for the hashmap entry.public Object getCustomProperty(Object node, String propName)
node
- Object used to get its list of custom propertiespropName
- String name of the property whose value is desiredpublic InputStream getStream(String uri)
uri
- - String uri to a data source.public Map<String,List<Object>> getViewIdFocusPathMap()
protected Map<Object,List<XMLMenuModel.MenuContentHandler>> getContentHandlerMap()
scopeMap
- protected int getContentHandlerId()
protected Object getCacheKey()
Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.