Class BaseViewBean

All Implemented Interfaces:
IPageFlowScopeAdapter, Serializable, EventListener, PhaseListener, HttpSessionBindingListener
Direct Known Subclasses:
BaseCompositeViewControlPageBean, BasePortletPageBean, BaseWebPageBean

public class BaseViewBean extends BaseFacesSessionBean implements PhaseListener
Base class implementation for view page managed beans. Clients should subclass this base class for each .view file in the web or portlet application.
See Also:
  • Field Details

    • clientIds

      protected transient IContentProvider clientIds
      IContentProvider to map raw control ids to client-side element ids.
    • initialized

      protected transient boolean initialized
      boolean to check if the Bean is initialized.
  • Constructor Details

    • BaseViewBean

      public BaseViewBean()
      Default constructor
  • Method Details

    • release

      protected void release()
      Description copied from class: BaseFacesSessionBean
      Override this method to release any resources associated with this session. Please note, the FacesContext is not valid for this function
      Specified by:
      release in class BaseFacesSessionBean
    • streamFileDataToResponse

      protected void streamFileDataToResponse(IFileExportBean exportBean)
      Helper method that can be called to stream an exported file back to the response.
      Parameters:
      exportBean - the bean describing the file to export
    • beforePhase

      public void beforePhase(PhaseEvent event)
      Implementation method of the JSF phase listener. Should not be subclassed by the clients directly. Specific beforeXXX methods should be used instead to perform actions during required JSF phases.
      Specified by:
      beforePhase in interface PhaseListener
      Parameters:
      event - JSF phase even
    • preRenderResponse

      public void preRenderResponse(PreRenderViewEvent e)
      The JSF 2.x technique for doing logic before rendering a view. The phase listener of the page bean doesn't work for the render phase since the view has not been constructed yet when the phase listeners are firing.
      Parameters:
      e - the system event
    • callInitialize

      protected void callInitialize()
      Initializes the bean if not already done.
    • initialize

      protected String initialize()
      This gets overwritten in the page bean classes to be a public dataflow method implementation
      Returns:
      returns null by default, subclasses may return other status codes as needed.
    • afterPhase

      public void afterPhase(PhaseEvent event)
      Implementation method of the JSF phase listener. Should not be subclassed by the clients directly. Specific afterXXX methods should be used instead to perform actions during required JSF phases.
      Specified by:
      afterPhase in interface PhaseListener
      Parameters:
      event - JSF PhaseEvent
    • getPhaseId

      public PhaseId getPhaseId()
      Returns PhaseId.ANY_PHASE which indicates all standard phases.
      Specified by:
      getPhaseId in interface PhaseListener
      See Also:
    • gotoPage

      public void gotoPage(String pageURI)
      Deprecated.
      Sets the specified view page URI on the faces context for rendering. This method should be called inside an action method to set the page URI for the next rendering request.
      Parameters:
      pageURI - the uri of the page, for example: /portlet1/mypage.view
    • gotoPage

      public void gotoPage(String pageURI, boolean redirect)
      Switches to the specified view page. If redirect is false it will simply change the faces context view root to the contents of the specified viewId. If redirect is true, it will redirect to the URL of the specified view. This method should be called inside an action method to set the page URI for the next rendering request.
      Parameters:
      pageURI - the uri of the page, for example: /portlet1/mypage.view
      redirect - true to redirect to the page, false to just change the FacesContext view root
    • findComponent

      public UIComponent findComponent(UIComponent base, String id)

      Return the UIComponent (if any) with the specified id, searching recursively starting at the specified base, and examining the base component itself, followed by examining all the base component's facets and children. Unlike findComponent method of UIComponentBase, which skips recursive scan each time it finds a NamingContainer, this method examines all components, regardless of their namespace (assuming IDs are unique).

      Parameters:
      base - Base UIComponent from which to search
      id - Component identifier to be matched
      Returns:
      UI component or null if not found
    • findComponentInRoot

      public UIComponent findComponentInRoot(String id)
      Finds components by its id in the root of the component tree.
      Parameters:
      id - the component id
      Returns:
      UIComponent or null if not found
    • getClientIds

      public IContentProvider getClientIds()

      Maps raw control ids to client-side element ids.

      For example, #{myPageBean.clientIds.myControlId} returns the client-side id (ie "wmp1234:zID3:myControlId") for the control with an id of 'myControlId'.

      Returns:
      instance of the IContentProvider for ID mapping.
    • isAsyncRequest

      public boolean isAsyncRequest()
      Returns true if current request is an async request.
      Returns:
      true for async request
    • getRealPath

      protected static String getRealPath(String relPath)
      Returns a full system path for a resource path given relative to the web application root.
      Parameters:
      relPath - relative path of the web resource
      Returns:
      String for full system path of this resource, or null if it cannot be calculated
    • getApplicationScope

      protected Map getApplicationScope()
      Returns writable map of application scoped attributes
      Returns:
      Map <String, Object> of attributes
    • getRequestParam

      protected Map getRequestParam()
      Returns read-only map of request parameters
      Returns:
      Map <String, Object> of parameters
    • getRequestScope

      protected Map getRequestScope()
      Returns writable map of request scoped attributes
      Returns:
      Map <String, Object> of attributes
    • getSessionScope

      protected Map getSessionScope()
      Returns writable map of session scoped attributes. For portlets the session scope is private, i.e. per portlet instance.
      Returns:
      Map <String, Object> of attributes
    • beforeRestoreView

      protected void beforeRestoreView()
      Clients should overwrite this method to perform custom actions before the view gets restored from the postback render request.
    • afterRestoreView

      protected void afterRestoreView()
      Clients should overwrite this method to perform custom actions after the view got restored from the postback render request.
    • beforeApplyRequestValues

      protected void beforeApplyRequestValues()
      Clients should overwrite this method to perform custom actions before request parameters are applied to the controls.
    • afterApplyRequestValues

      protected void afterApplyRequestValues()
      Clients should overwrite this method to perform custom actions after request parameters are applied to the controls.
    • beforeProcessValidations

      protected void beforeProcessValidations()
      Clients should overwrite this method to perform custom actions before validation is performed.
    • afterProcessValidations

      protected void afterProcessValidations()
      Clients should overwrite this method to perform custom actions after validation is performed.
    • beforeUpdateModelValues

      protected void beforeUpdateModelValues()
      Clients should overwrite this method to perform custom actions before controls update data model using submitted values.
    • afterUpdateModelValues

      protected void afterUpdateModelValues()
      Clients should overwrite this method to perform custom actions after controls updated data model using submitted values.
    • beforeInvokeApplication

      protected void beforeInvokeApplication()
      Clients should overwrite this method to perform custom actions before an action method is invoked.
    • afterInvokeApplication

      protected void afterInvokeApplication()
      Clients should overwrite this method to perform custom actions after an action method is invoked.
    • beforeRenderResponse

      protected void beforeRenderResponse()
      Clients should overwrite this method to perform custom actions before the view gets rendered.
    • afterRenderResponse

      protected void afterRenderResponse()
      Clients should overwrite this method to perform custom actions after the view got rendered.
    • resetPageFlowStorage

      protected void resetPageFlowStorage()
      Reset the storage used for Page Flow.