|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.faces.component.UIComponent | +--javax.faces.component.UIComponentBase | +--javax.faces.component.UICommand
UICommand is a UIComponent
that represents
a user interface component which, when activated by the user, triggers
an application specific "command" or "action". Such a component is
typically rendered as a push button, a menu item, or a hyperlink.
When the decode()
method of this UICommand
, or
its corresponding Renderer
, detects that this control has been
activated, it will queue an ActionEvent
.
Later on, the broadcast()
method will ensure that this
event is broadcast to all interested listeners.
Listeners will be invoked in the following order:
ActionListener
s, in the order in which they were registered.
MethodBinding
ActionListener
, retrieved from the
Application
- and therefore, any attached "action"
MethodBinding
.
By default, the rendererType
property must be set to
"javax.faces.Button
". This value can be changed by calling the
setRendererType()
method.
Field Summary | |
static java.lang.String |
COMPONENT_FAMILY
The standard component family for this component. |
static java.lang.String |
COMPONENT_TYPE
The standard component type for this component. |
Constructor Summary | |
UICommand()
Create a new UICommand instance with default property
values. |
Method Summary | |
void |
addActionListener(javax.faces.event.ActionListener listener)
Add a new ActionListener to the set of listeners interested
in being notified when ActionEvent s occur. |
void |
broadcast(javax.faces.event.FacesEvent event)
In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent)
processing, pass the ActionEvent being broadcast to the
method referenced by actionListener (if any),
and to the default ActionListener registered on the
Application . |
javax.faces.el.MethodBinding |
getAction()
Return the MethodBinding pointing at the application
action to be invoked, if this UIComponent is activated by
the user, during the Apply Request Values or Invoke
Application phase of the request processing lifecycle,
depending on the value of the immediate
property. |
javax.faces.el.MethodBinding |
getActionListener()
Return the MethodBinding pointing at an action
listener method to be invoked, if this UIComponent is
activated by the user, during the Apply Request Values
or Invoke Application phase of the request processing
lifecycle, depending upon the value of the immediate
property. |
javax.faces.event.ActionListener[] |
getActionListeners()
Return the set of registered ActionListener s for this
ActionSource instance. |
java.lang.String |
getFamily()
Return the identifier of the component family to which this component belongs. |
java.lang.Object |
getValue()
Returns the value property of the
UICommand . |
boolean |
isImmediate()
Return a flag indicating that the default ActionListener
provided by the JavaServer Faces implementation should be executed
immediately (that is, during Apply Request Values phase
of the request processing lifecycle), rather than waiting until the
Invoke Application phase. |
void |
queueEvent(javax.faces.event.FacesEvent e)
Intercept queueEvent and, for ActionEvent s,
mark the phaseId for the event to be
PhaseId.APPLY_REQUEST_VALUES if the
immediate flag is true,
PhaseId.INVOKE_APPLICATION otherwise. |
void |
removeActionListener(javax.faces.event.ActionListener listener)
Remove an existing ActionListener (if any) from the set of
listeners interested in being notified when ActionEvent s
occur. |
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
Perform any processing required to restore the state from the entries in the state Object. |
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
Gets the state of the instance as a Serializable Object. |
void |
setAction(javax.faces.el.MethodBinding action)
Set the MethodBinding pointing at the appication
action to be invoked, if this UIComponent is activated by
the user, during the Apply Request Values or Invoke
Application phase of the request processing lifecycle,
depending on the value of the immediate
property. |
void |
setActionListener(javax.faces.el.MethodBinding actionListener)
Set the MethodBinding pointing at an action listener
method to be invoked, if this UIComponent is activated by
the user, during the Apply Request Values or Invoke
Application phase of the request processing lifecycle,
depending upon the value of the immmediate
property. |
void |
setImmediate(boolean immediate)
Set the "immediate execution" flag for this UIComponent . |
void |
setValue(java.lang.Object value)
Sets the value property of the UICommand . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String COMPONENT_TYPE
The standard component type for this component.
public static final java.lang.String COMPONENT_FAMILY
The standard component family for this component.
Constructor Detail |
public UICommand()
Create a new UICommand
instance with default property
values.
Method Detail |
public java.lang.String getFamily()
UIComponent
Return the identifier of the component family to which this
component belongs. This identifier, in conjunction with the value
of the rendererType
property, may be used to select
the appropriate Renderer
for this component instance.
getFamily
in class UIComponent
public javax.faces.el.MethodBinding getAction()
ActionSource
Return the MethodBinding
pointing at the application
action to be invoked, if this UIComponent
is activated by
the user, during the Apply Request Values or Invoke
Application phase of the request processing lifecycle,
depending on the value of the immediate
property.
getAction
in interface ActionSource
public void setAction(javax.faces.el.MethodBinding action)
ActionSource
Set the MethodBinding
pointing at the appication
action to be invoked, if this UIComponent
is activated by
the user, during the Apply Request Values or Invoke
Application phase of the request processing lifecycle,
depending on the value of the immediate
property.
Any method referenced by such an expression must be public, with
a return type of String
, and accept no parameters.
setAction
in interface ActionSource
action
- The new MethodBinding expressionpublic javax.faces.el.MethodBinding getActionListener()
ActionSource
Return the MethodBinding
pointing at an action
listener method to be invoked, if this UIComponent
is
activated by the user, during the Apply Request Values
or Invoke Application phase of the request processing
lifecycle, depending upon the value of the immediate
property.
getActionListener
in interface ActionSource
public void setActionListener(javax.faces.el.MethodBinding actionListener)
ActionSource
Set the MethodBinding
pointing at an action listener
method to be invoked, if this UIComponent
is activated by
the user, during the Apply Request Values or Invoke
Application phase of the request processing lifecycle,
depending upon the value of the immmediate
property.
Any method referenced by such an expression must be public, with
a return type of void
, and accept a single parameter of
type ActionEvent
.
setActionListener
in interface ActionSource
actionListener
- The new method binding expressionpublic boolean isImmediate()
ActionSource
Return a flag indicating that the default ActionListener
provided by the JavaServer Faces implementation should be executed
immediately (that is, during Apply Request Values phase
of the request processing lifecycle), rather than waiting until the
Invoke Application phase. The default value for this
property must be false
.
isImmediate
in interface ActionSource
public void setImmediate(boolean immediate)
ActionSource
Set the "immediate execution" flag for this UIComponent
.
setImmediate
in interface ActionSource
immediate
- The new immediate execution flagpublic java.lang.Object getValue()
Returns the value
property of the
UICommand
. This is most often rendered as a label.
public void setValue(java.lang.Object value)
Sets the value
property of the UICommand
.
This is most often rendered as a label.
value
- the new valuepublic void addActionListener(javax.faces.event.ActionListener listener)
ActionSource
Add a new ActionListener
to the set of listeners interested
in being notified when ActionEvent
s occur.
addActionListener
in interface ActionSource
listener
- The ActionListener
to be added
java.lang.NullPointerException
- if listener
is null
public javax.faces.event.ActionListener[] getActionListeners()
ActionSource
Return the set of registered ActionListener
s for this
ActionSource
instance. If there are no registered listeners,
a zero-length array is returned.
getActionListeners
in interface ActionSource
public void removeActionListener(javax.faces.event.ActionListener listener)
ActionSource
Remove an existing ActionListener
(if any) from the set of
listeners interested in being notified when ActionEvent
s
occur.
removeActionListener
in interface ActionSource
listener
- The ActionListener
to be removed
java.lang.NullPointerException
- if listener
is null
public java.lang.Object saveState(javax.faces.context.FacesContext context)
StateHolder
Gets the state of the instance as a
Serializable
Object.
If the class that implements this interface has references to
instances that implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.)
this method must call the StateHolder.saveState(javax.faces.context.FacesContext)
method on all those
instances as well. This method must not save the state
of children and facets. That is done via the StateManager
This method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
component
should be the same as before executing
it.
The return from this method must be Serializable
saveState
in interface StateHolder
saveState
in class UIComponentBase
public void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
StateHolder
Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to
instances that also implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.)
this method must call the StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)
method on all those
instances as well.
restoreState
in interface StateHolder
restoreState
in class UIComponentBase
public void broadcast(javax.faces.event.FacesEvent event) throws AbortProcessingException
In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent)
processing, pass the ActionEvent
being broadcast to the
method referenced by actionListener
(if any),
and 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
java.lang.IllegalArgumentException
- if the implementation class
of this FacesEvent
is not supported by this component
java.lang.NullPointerException
- if event
is
null
public void queueEvent(javax.faces.event.FacesEvent e)
Intercept queueEvent
and, for ActionEvent
s,
mark the phaseId for the event to be
PhaseId.APPLY_REQUEST_VALUES
if the
immediate
flag is true,
PhaseId.INVOKE_APPLICATION
otherwise.
queueEvent
in class UIComponentBase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |