Class BaseAppNavBean

java.lang.Object
com.webmethods.caf.faces.bean.nav.BaseAppNavBean
Direct Known Subclasses:
XMLAppNavBean

public class BaseAppNavBean extends Object
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.
  • Field Details

    • m_root

      protected IAppNavPage m_root
      Root page of the navigation hierarchy. May be null if this bean has not yet been initialized.
    • m_current

      protected IAppNavPage 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.
    • BaseAppNavBean

      public BaseAppNavBean(IAppNavPage root)
      Creates a new web application navigation bean, initialized with the specified root page.
      Parameters:
      root - Root page of the navigation hierarchy.
    • BaseAppNavBean

      public BaseAppNavBean(IAppNavPage root, IAppNavPage current)
      Creates a new web application navigation bean, initialized with the specified root page and current page.
      Parameters:
      root - Root page of the navigation hierarchy.
      current - Current page. Must be a descendant of the root (or the root itself).
  • Method Details

    • getRoot

      public IAppNavPage getRoot()
      Root page of the navigation hierarchy. May be null if this bean has not yet been initialized.
    • setRoot

      public void setRoot(IAppNavPage root)
      Root page of the navigation hierarchy. May be null if this bean has not yet been initialized.
    • getCurrent

      public IAppNavPage getCurrent()
      Current page. May be null if there is no current page. Must be a descendant of the root (or the root itself).
    • setCurrent

      public void setCurrent(IAppNavPage current)
      Current page. May be null if there is no current page. Must be a descendant of the root (or the root itself).
    • setCurrent

      public void setCurrent(FacesContext context)
      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

      public void setCurrentById(String id)
      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

      public IAppNavPage 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

      public IAppNavPage 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

      public IAppNavPage 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

      public IAppNavPage 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

      public List<IAppNavPage> 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

      public IContentProvider 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 the IAppNavPage with an id of "/foo/bar.view" (if there is no such page, it will return null).
    • getPagesList

      public List<IAppNavPage> getPagesList()
      List of all pages in the navigation hierarchy.
    • getSubNavs

      public IContentProvider getSubNavs()
      Map of a sub-BaseAppNavBean for each page 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, getSubNavs().getValue("/foo/bar.view") will return a BaseAppNavBean for the sub-hierarchy rooted by the page with an id of "/foo/bar.view" (if there is no such page, it will return null).
    • findPage

      public IAppNavPage findPage(String id)
      Finds the page with the specified id. May be null if no such page is found in the navigation hierarchy.
    • createSubNav

      protected BaseAppNavBean createSubNav()
      Creates a new, uninitialized sub-navigation bean. The new bean must be initialized with a valid root before it can be used.
    • createSubNav

      public BaseAppNavBean createSubNav(IAppNavPage root)
      Creates a new sub-navigation bean, initialized with the specified root page.
      Parameters:
      root - Root page of the sub-navigation hierarchy.
    • createSubNav

      public BaseAppNavBean createSubNav(IAppNavPage root, IAppNavPage current)
      Creates a new sub-navigation bean initialized with the specified root page and current page.
      Parameters:
      root - Root page of the sub-navigation hierarchy.
      current - Current page. Must be a descendant of the root (or the root itself).