|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.ActionEventDispatcher
public class ActionEventDispatcher
Provides a control ActionListener and AjaxBehavior dispatcher. The ClickServlet will dispatch registered ActionListeners and AjaxBehaviors after page controls have been processed.
public class MyControl extends AbstractControl { ... public boolean onProcess() { bindRequestValue(); if (isClicked()) { // Dispatch an action listener event for invocation after // control processing has finished dispatchActionEvent(); } return true; } }When the link is clicked it invokes the method
AbstractControl.dispatchActionEvent()
.
This method registers the Control's action listener with the
ActionEventDispatcher. The ClickServlet will subsequently invoke the registered
ActionListener.onAction(Control)
method after all the Page controls
onProcess() method have been invoked.
Constructor Summary | |
---|---|
ActionEventDispatcher(ConfigService configService)
Construct the ActionEventDispatcher with the given ConfigService. |
Method Summary | |
---|---|
static void |
dispatchActionEvent(Control source,
ActionListener listener)
Register the event source and event ActionListener to be fired by the ClickServlet once all the controls have been processed. |
static void |
dispatchAjaxBehaviors(Control source)
Register the source control which AjaxBehaviors should be fired by the ClickServlet. |
protected void |
errorOccurred(Throwable throwable)
Allow the dispatcher to handle the error that occurred. |
protected boolean |
fireActionEvent(Context context,
Control source,
ActionListener listener)
Fire the action for the given listener and event source which return true if the page should continue processing. |
boolean |
fireActionEvents(Context context)
Fire all the registered action events after the Page Controls have been processed and return true if the page should continue processing. |
protected boolean |
fireActionEvents(Context context,
List<Control> eventSourceList,
List<ActionListener> eventListenerList)
Fire the actions for the given listener list and event source list which return true if the page should continue processing. |
boolean |
fireAjaxBehaviors(Context context)
Fire all the registered AjaxBehaviors and return true if the page should continue processing, false otherwise. |
protected boolean |
fireAjaxBehaviors(Context context,
Control source)
Fire the AjaxBehaviors for the given control and return true if the page should continue processing, false otherwise. |
protected boolean |
fireAjaxBehaviors(Context context,
Set<Control> ajaxBbehaviorSourceSet)
Fire the AjaxBehaviors for the given control set and return true if the page should continue processing, false otherwise. |
static ActionEventDispatcher |
getThreadLocalDispatcher()
Return the thread local ActionEventDispatcher instance. |
static boolean |
hasThreadLocalDispatcher()
Returns true if an ActionEventDispatcher instance is available on the current thread, false otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ActionEventDispatcher(ConfigService configService)
configService
- the click application configuration serviceMethod Detail |
---|
public static void dispatchActionEvent(Control source, ActionListener listener)
source
- the action event sourcelistener
- the event action listenerpublic static void dispatchAjaxBehaviors(Control source)
source
- the source control which behaviors should be firedpublic static ActionEventDispatcher getThreadLocalDispatcher()
RuntimeException
- if an ActionEventDispatcher is not available on
the threadpublic static boolean hasThreadLocalDispatcher()
getThreadLocalDispatcher()
this method can safely be used
and will not throw an exception if an ActionEventDispatcher is not
available on the current thread.
public boolean fireActionEvents(Context context)
context
- the request context
public boolean fireAjaxBehaviors(Context context)
context
- the request context
fireAjaxBehaviors(org.apache.click.Context, java.util.Set)
protected void errorOccurred(Throwable throwable)
throwable
- the error which occurred during processingprotected boolean fireActionEvents(Context context, List<Control> eventSourceList, List<ActionListener> eventListenerList)
context
- the request contexteventSourceList
- the list of source controlseventListenerList
- the list of listeners to fire
protected boolean fireActionEvent(Context context, Control source, ActionListener listener)
context
- the request contextsource
- the source controllistener
- the listener to fire
protected boolean fireAjaxBehaviors(Context context, Set<Control> ajaxBbehaviorSourceSet)
context
- the request contextajaxBbehaviorSourceSet
- the set of controls with attached AjaxBehaviors
fireAjaxBehaviors(org.apache.click.Context, org.apache.click.Control)
protected boolean fireAjaxBehaviors(Context context, Control source)
isAjaxTarget()
method returns true.
This method can be overridden if you need to customize the way
AjaxBehaviors are fired.
context
- the request contextsource
- the control which attached behaviors should be fired
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |