Interface ActionSource
- All Known Subinterfaces:
ActionSource2
- All Known Implementing Classes:
HtmlCommandButton
,HtmlCommandLink
,HtmlCommandScript
,UICommand
,UIViewAction
ActionSource is an interface that may be implemented by any concrete UIComponent
that wishes
to be a source of ActionEvent
s, including the ability to invoke application actions via the default
ActionListener
mechanism.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionListener
(ActionListener listener) Add a newActionListener
to the set of listeners interested in being notified whenActionEvent
s occur.default MethodExpression
Return theMethodExpression
pointing at the application action to be invoked, if thisUIComponent
is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of theimmediate
property.Return the set of registeredActionListener
s for thisActionSource
instance.boolean
Return a flag indicating that the defaultActionListener
provided by the Jakarta 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
removeActionListener
(ActionListener listener) Remove an existingActionListener
(if any) from the set of listeners interested in being notified whenActionEvent
s occur.default void
setActionExpression
(MethodExpression action) Set theMethodExpression
pointing at the appication action to be invoked, if thisUIComponent
is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of theimmediate
property.void
setImmediate
(boolean immediate) Set the "immediate execution" flag for thisUIComponent
.
-
Method Details
-
isImmediate
boolean isImmediate()Return a flag indicating that the default
ActionListener
provided by the Jakarta 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 befalse
.- Returns:
true
if immediate,false
otherwise.
-
setImmediate
void setImmediate(boolean immediate) Set the "immediate execution" flag for this
UIComponent
.- Parameters:
immediate
- The new immediate execution flag
-
addActionListener
Add a new
ActionListener
to the set of listeners interested in being notified whenActionEvent
s occur.- Parameters:
listener
- TheActionListener
to be added- Throws:
NullPointerException
- iflistener
isnull
-
getActionListeners
ActionListener[] getActionListeners()Return the set of registered
ActionListener
s for thisActionSource
instance. If there are no registered listeners, a zero-length array is returned.- Returns:
- the action listeners, or a zero-length array.
-
removeActionListener
Remove an existing
ActionListener
(if any) from the set of listeners interested in being notified whenActionEvent
s occur.- Parameters:
listener
- TheActionListener
to be removed- Throws:
NullPointerException
- iflistener
isnull
-
getActionExpression
Return the
MethodExpression
pointing at the application action to be invoked, if thisUIComponent
is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of theimmediate
property.The default implementation throws
UnsupportedOperationException
and is provided for the sole purpose of not breaking existing applications that extendActionSource
. Historically this method was declared inActionSource2
for precisely this reason but default methods in interfaces weren't supported.- Returns:
- the action expression.
- Since:
- 4.1
-
setActionExpression
Set the
MethodExpression
pointing at the appication action to be invoked, if thisUIComponent
is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of theimmediate
property.Any method referenced by such an expression must be public, with a return type of
String
, and accept no parameters.The default implementation throws
UnsupportedOperationException
and is provided for the sole purpose of not breaking existing applications that extendActionSource
. Historically this method was declared inActionSource2
for precisely this reason but default methods in interfaces weren't supported.- Parameters:
action
- The new method expression- Since:
- 4.1
-