Class BaseAppNavBean
java.lang.Object
com.webmethods.caf.faces.bean.nav.BaseAppNavBean
- Direct Known Subclasses:
XMLAppNavBean
Helper bean for displaying web application navigation links.
When initialized with a current
IAppNavPage
and a root IAppNavPage
,
this bean helps calculate the breadcrumbs from the root to the current IAppNavPage
,
as well as other useful properties.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Map of all pages in the navigation hierarchy, keyed by id.protected class
Map of a sub-BaseAppNavBean
for each page in the navigation hierarchy, keyed by id. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IAppNavPage
Current page.protected IAppNavPage
Root page of the navigation hierarchy. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new, uninitialized, web application navigation bean.BaseAppNavBean
(IAppNavPage root) Creates a new web application navigation bean, initialized with the specified root page.BaseAppNavBean
(IAppNavPage root, IAppNavPage current) Creates a new web application navigation bean, initialized with the specified root page and current page. -
Method Summary
Modifier and TypeMethodDescriptionprotected BaseAppNavBean
Creates a new, uninitialized sub-navigation bean.createSubNav
(IAppNavPage root) Creates a new sub-navigation bean, initialized with the specified root page.createSubNav
(IAppNavPage root, IAppNavPage current) Creates a new sub-navigation bean initialized with the specified root page and current page.Finds the page with the specified id.List of pages on the path from the root page to the current page, inclusive, ordered from the root page to the current page.Current page.int
getDepth()
Distance of the current page from the root page.Next sibling of the current page.getPages()
Map of all pages in the navigation hierarchy, keyed by id.List of all pages in the navigation hierarchy.Next sibling of the current page's parent.Previous sibling of the current page's parent.Previous sibling of the current page.getRoot()
Root page of the navigation hierarchy.Map of a sub-BaseAppNavBean
for each page in the navigation hierarchy, keyed by id.void
setCurrent
(IAppNavPage current) Current page.void
setCurrent
(FacesContext context) Sets the current page for the given context.void
setCurrentById
(String id) Sets the current page to the page with the specified id.void
setRoot
(IAppNavPage root) Root page of the navigation hierarchy.
-
Field Details
-
m_root
Root page of the navigation hierarchy. May be null if this bean has not yet been initialized. -
m_current
Current page. May be null if there is no current page. Must be a descendant of the root (or the root itself).
-
-
Constructor Details
-
BaseAppNavBean
public BaseAppNavBean()Creates a new, uninitialized, web application navigation bean. Must be initialized with a valid root before it can be used.
-
-
Method Details
-
getRoot
Root page of the navigation hierarchy. May be null if this bean has not yet been initialized. -
getCurrent
Current page. May be null if there is no current page. Must be a descendant of the root (or the root itself). -
setCurrent
Sets the current page for the given context. The base implementation is to set the current page to the page with an id which matches the current view id (or no current page if no page id matches the current view id). -
setCurrentById
Sets the current page to the page with the specified id. -
getDepth
public int getDepth()Distance of the current page from the root page. Returns 0 if no current page; returns 1 if the current page is the root page; returns 2 if the current page is a child of the root page; etc. -
getNextSibling
Next sibling of the current page. May be null if there is no current page, or the current page has no next sibling. -
getPrevSibling
Previous sibling of the current page. May be null if there is no current page, or the current page has no previous sibling. -
getParentNextSibling
Next sibling of the current page's parent. May be null if there is no current page, the current page is the root, or the current page's parent has no next sibling. -
getParentPrevSibling
Previous sibling of the current page's parent. May be null if there is no current page, the current page is the root, or the current page's parent has no previous sibling. -
getBreadcrumbs
List of pages on the path from the root page to the current page, inclusive, ordered from the root page to the current page. If there is no current page, returns an empty list. If the root is the current page, returns a list containing only the root page. If the current page is a child of the root page, returns a list containing the root page and the current page. If the current page is a grandchild of the root page, returns a list containing the root page, the parent of the current page, and the current page. -
getPages
Map of all pages in the navigation hierarchy, keyed by id. For example, if there is a page with an id of "/foo/bar.view" in the navigation hierarchy,getPages().getValue("/foo/bar.view")
will return theIAppNavPage
with an id of "/foo/bar.view" (if there is no such page, it will return null). -
getPagesList
List of all pages in the navigation hierarchy. -
findPage
Finds the page with the specified id. May be null if no such page is found in the navigation hierarchy.
-