|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.faces.component.UIComponent
javax.faces.component.UIComponentBase
org.jboss.seam.faces.component.UIViewAction
public class UIViewAction
UIViewAction is an ActionSource2
UIComponent
that specifies an application-specific command
(or action)--defined as an EL method expression--to be invoked during one of the JSF lifecycle phases that proceeds view
rendering. This component must be declared as a child of the ViewMetadata
facet of the UIViewRoot
so that it
gets incorporated into the JSF lifecycle on both non-faces (initial) requests and faces (postback) requests.
The purpose of this component is to provide a light-weight front-controller solution for executing code upon the loading of a JSF view to support the integration of system services, content retrieval, view management, and navigation. This functionality is especially useful for non-faces (initial) requests.
The UIViewAction
component is closely tied to the UIViewParameter
component. The UIViewParameter
component binds a request parameter to a model property. Most of the time, this binding is used to populate the model with
data that supports the method being invoked by a UIViewAction
component, much like form inputs populate the model
with data to support the method being invoked by a UICommand
component.
When the UIViewAction
is invoked, it will queue an ActionEvent
to
be broadcast to all interested listeners when the
If the value of the component's
The invocation of the action is normally suppressed (meaning the ActionEvent
is not queued) on a faces request. It
can be enabled by setting the component's
The NavigationHandler
is consulted after the action is invoked to carry out the navigation case that matches the
action signature and outcome. If a navigation case is matched, or the response is marked complete by the action, subsequent
UIViewAction
components associated with the current view are short-circuited. The lifecycle then advances
appropriately.
It's important to note that the full component tree is not built before the UIViewAction components are processed on an
non-faces (initial) request. Rather, the component tree only contains the ViewMetadata
, an important part of the
optimization of this component and what sets it apart from a PreRenderViewEvent
listener.
UIViewParameter
Field Summary | |
---|---|
static String |
COMPONENT_FAMILY
The standard component family for this component. |
static String |
COMPONENT_TYPE
The standard component type for this component. |
Fields inherited from class javax.faces.component.UIComponent |
---|
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY |
Constructor Summary | |
---|---|
UIViewAction()
Create a new UIViewAction instance with default property values. |
Method Summary | |
---|---|
void |
addActionListener(ActionListener listener)
Action listeners are not supported by the UIViewAction component. |
void |
broadcast(FacesEvent event)
In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent) processing, pass the ActionEvent being broadcast to
the default ActionListener registered on the Application . |
void |
decode(FacesContext context)
First, determine if the action should be invoked by evaluating this components pre-conditions. |
MethodBinding |
getAction()
Deprecated. This has been replaced by getActionExpression() . |
MethodExpression |
getActionExpression()
Returns the action, represented as an EL method expression, to invoke. |
MethodBinding |
getActionListener()
Action listeners are not supported by the UIViewAction component. |
ActionListener[] |
getActionListeners()
Action listeners are not supported by the UIViewAction component. |
String |
getFamily()
|
String |
getPhase()
Returns the name of the phase in which the action is to be queued. |
PhaseId |
getPhaseId()
|
boolean |
isIf()
Returns a condition, represented as an EL value expression, that must evaluate to true for the action to be invoked. |
boolean |
isImmediate()
Returns the value which dictates the JSF lifecycle phase in which the action is invoked. |
boolean |
isOnPostback()
Returns a boolean value that controls whether the action is invoked during faces (postback) request. |
void |
removeActionListener(ActionListener listener)
Action listeners are not supported by the UIViewAction component. |
void |
setAction(MethodBinding action)
Deprecated. This has been replaced by setActionExpression(javax.el.MethodExpression) . |
void |
setActionExpression(MethodExpression actionExpression)
Sets the action, represented as an EL method expression, to invoke. |
void |
setActionListener(MethodBinding actionListener)
Action listeners are not supported by the UIViewAction component. |
void |
setIf(boolean condition)
Sets the condition, represented as an EL value expression, that must evaluate to true for the action to be invoked. |
void |
setImmediate(boolean immediate)
Sets the immediate flag, which controls the JSF lifecycle in which the action is invoked. |
void |
setOnPostback(boolean onPostback)
Set the bookean flag that controls whether the action is invoked during a faces (postback) request. |
void |
setPhase(String phase)
Set the name of the phase in which the action is to be queued. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String COMPONENT_TYPE
The standard component type for this component.
public static final String COMPONENT_FAMILY
The standard component family for this component.
Constructor Detail |
---|
public UIViewAction()
Create a new UIViewAction
instance with default property values.
Method Detail |
---|
public String getFamily()
getFamily
in class UIComponent
@Deprecated public MethodBinding getAction()
getActionExpression()
.
getAction
in interface ActionSource
@Deprecated public void setAction(MethodBinding action)
setActionExpression(javax.el.MethodExpression)
.
setAction
in interface ActionSource
UnsupportedOperationException
- if calledpublic MethodBinding getActionListener()
UIViewAction
component.
getActionListener
in interface ActionSource
UnsupportedOperationException
- if calledpublic void setActionListener(MethodBinding actionListener)
UIViewAction
component.
setActionListener
in interface ActionSource
UnsupportedOperationException
- if calledpublic boolean isImmediate()
isImmediate
in interface ActionSource
public void setImmediate(boolean immediate)
setImmediate
in interface ActionSource
public String getPhase()
Returns the name of the phase in which the action is to be queued. Only the following phases are supported (case does not matter):
If the phase is set, it takes precedence over the immediate flag.
public void setPhase(String phase)
public PhaseId getPhaseId()
public void addActionListener(ActionListener listener)
UIViewAction
component.
addActionListener
in interface ActionSource
UnsupportedOperationException
- if calledpublic ActionListener[] getActionListeners()
UIViewAction
component.
getActionListeners
in interface ActionSource
public void removeActionListener(ActionListener listener)
UIViewAction
component.
removeActionListener
in interface ActionSource
UnsupportedOperationException
- if calledpublic MethodExpression getActionExpression()
getActionExpression
in interface ActionSource2
public void setActionExpression(MethodExpression actionExpression)
setActionExpression
in interface ActionSource2
public boolean isOnPostback()
public void setOnPostback(boolean onPostback)
public boolean isIf()
public void setIf(boolean condition)
public void broadcast(FacesEvent event) throws AbortProcessingException
In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent)
processing, pass the ActionEvent
being broadcast to
the default ActionListener
registered on the Application
.
broadcast
in class UIComponentBase
event
- FacesEvent
to be broadcast
AbortProcessingException
- Signal the JavaServer Faces implementation that no further processing on the current
event should be performed
IllegalArgumentException
- if the implementation class of this FacesEvent
is not supported by this
component
NullPointerException
- if event
is null
public void decode(FacesContext context)
ActionEvent
.
Set the phaseId in which the queued ActionEvent
should be broadcast by assigning the appropriate value to the
phaseId property of the ActionEvent
according to the evaluated value of the immediate attribute. If the value is
PhaseId.APPLY_REQUEST_VALUES
. Otherwise, set the phaseId to to
PhaseId.INVOKE_APPLICATION
.
Finally, queue the event by calling ActionEvent
just created.
decode
in class UIComponentBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |