Package com.webmethods.caf.faces.bean
Class BaseViewBean
java.lang.Object
com.webmethods.caf.faces.bean.BaseFacesBean
com.webmethods.caf.faces.bean.BaseFacesSessionBean
com.webmethods.caf.faces.bean.BaseViewBean
- All Implemented Interfaces:
IPageFlowScopeAdapter
,Serializable
,EventListener
,PhaseListener
,HttpSessionBindingListener
- Direct Known Subclasses:
BaseCompositeViewControlPageBean
,BasePortletPageBean
,BaseWebPageBean
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Providers that maps raw control ids to client-side element ids. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IContentProvider
IContentProvider
to map raw control ids to client-side element ids.protected boolean
boolean
to check if theBean
is initialized.Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
fExpireWithPageFlow
Fields inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
DATA_BINDING_CLIENTS, EMPTY_RESOURCES, OUTCOME_ERROR, OUTCOME_OK, resourcesProviders
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Clients should overwrite this method to perform custom actions after request parameters are applied to the controls.protected void
Clients should overwrite this method to perform custom actions after an action method is invoked.void
afterPhase
(PhaseEvent event) Implementation method of the JSF phase listener.protected void
Clients should overwrite this method to perform custom actions after validation is performed.protected void
Clients should overwrite this method to perform custom actions after the view got rendered.protected void
Clients should overwrite this method to perform custom actions after the view got restored from the postback render request.protected void
Clients should overwrite this method to perform custom actions after controls updated data model using submitted values.protected void
Clients should overwrite this method to perform custom actions before request parameters are applied to the controls.protected void
Clients should overwrite this method to perform custom actions before an action method is invoked.void
beforePhase
(PhaseEvent event) Implementation method of the JSF phase listener.protected void
Clients should overwrite this method to perform custom actions before validation is performed.protected void
Clients should overwrite this method to perform custom actions before the view gets rendered.protected void
Clients should overwrite this method to perform custom actions before the view gets restored from the postback render request.protected void
Clients should overwrite this method to perform custom actions before controls update data model using submitted values.protected void
Initializes the bean if not already done.findComponent
(UIComponent base, String id) Return theUIComponent
(if any) with the specifiedid
, searching recursively starting at the specifiedbase
, and examining the base component itself, followed by examining all the base component's facets and children.Finds components by itsid
in the root of the component tree.protected Map
Returns writable map of application scoped attributesMaps raw control ids to client-side element ids.ReturnsPhaseId.ANY_PHASE
which indicates all standard phases.protected static String
getRealPath
(String relPath) Returns a full system path for a resource path given relative to the web application root.protected Map
Returns read-only map of request parametersprotected Map
Returns writable map of request scoped attributesprotected Map
Returns writable map of session scoped attributes.void
Deprecated.void
Switches to the specified view page.protected String
This gets overwritten in the page bean classes to be a public dataflow method implementationboolean
Returnstrue
if current request is an async request.void
The JSF 2.x technique for doing logic before rendering a view.protected void
release()
Override this method to release any resources associated with this session.protected void
Reset the storage used for Page Flow.protected void
streamFileDataToResponse
(IFileExportBean exportBean) Helper method that can be called to stream an exported file back to the response.Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesSessionBean
getExpireWithPageFlow, setExpireWithPageFlow, valueBound, valueUnbound
Methods inherited from class com.webmethods.caf.faces.bean.BaseFacesBean
createMethodBinding, createMethodExpression, createValueBinding, createValueExpression, createValueExpression, error, error, error, error, error, getBean, getFacesContext, getLocale, getResourceInputStream, getResources, getResourcesProvider, getRootCause, getStackTrace, getTreeAttribute, isUserInRole, log, log, log, putTreeAttribute, resetDataBindingClients, resolveDataBinding, resolveDataBinding, resolveExpression, setValue
-
Field Details
-
clientIds
IContentProvider
to map raw control ids to client-side element ids. -
initialized
protected transient boolean initializedboolean
to check if theBean
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 classBaseFacesSessionBean
-
streamFileDataToResponse
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
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 interfacePhaseListener
- Parameters:
event
- JSF phase even
-
preRenderResponse
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
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
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 interfacePhaseListener
- Parameters:
event
- JSFPhaseEvent
-
getPhaseId
ReturnsPhaseId.ANY_PHASE
which indicates all standard phases.- Specified by:
getPhaseId
in interfacePhaseListener
- See Also:
-
gotoPage
Deprecated.usegotoPage(String, boolean)
instead.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
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.viewredirect
- true to redirect to the page, false to just change the FacesContext view root
-
findComponent
Return the
UIComponent
(if any) with the specifiedid
, searching recursively starting at the specifiedbase
, and examining the base component itself, followed by examining all the base component's facets and children. Unlike findComponent method ofUIComponentBase
, which skips recursive scan each time it finds aNamingContainer
, this method examines all components, regardless of their namespace (assuming IDs are unique).- Parameters:
base
- BaseUIComponent
from which to searchid
- Component identifier to be matched- Returns:
- UI component or null if not found
-
findComponentInRoot
Finds components by itsid
in the root of the component tree.- Parameters:
id
- the component id- Returns:
UIComponent
or null if not found
-
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()Returnstrue
if current request is an async request.- Returns:
true
for async request
-
getRealPath
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
Returns writable map of application scoped attributes- Returns:
Map <String, Object>
of attributes
-
getRequestParam
Returns read-only map of request parameters- Returns:
Map <String, Object>
of parameters
-
getRequestScope
Returns writable map of request scoped attributes- Returns:
Map <String, Object>
of attributes
-
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.
-
gotoPage(String, boolean)
instead.