|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.behavior.AbstractBehavior
org.apache.wicket.behavior.AbstractAjaxBehavior
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
org.apache.wicket.ajax.AjaxEventBehavior
public abstract class AjaxEventBehavior
An ajax behavior that is attached to a certain client-side (usually javascript) event, such as onClick, onChange, onKeyDown, etc.
Example:
WebMarkupContainer div=new WebMarkupContainer(...); div.setOutputMarkupId(true); div.add(new AjaxEventBehavior("onclick") { protected void onEvent(AjaxRequestTarget target) { System.out.println("ajax here!"); } }This behavior will be linked to the onclick javascript event of the div WebMarkupContainer represents, and so anytime a user clicks this div the
onEvent(AjaxRequestTarget)
of the
behavior is invoked.
Field Summary |
---|
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior |
---|
INDICATOR |
Fields inherited from interface org.apache.wicket.behavior.IBehaviorListener |
---|
INTERFACE |
Constructor Summary | |
---|---|
AjaxEventBehavior(String event)
Construct. |
Method Summary | |
---|---|
protected CharSequence |
generateCallbackScript(CharSequence partialCall)
Returns javascript that performs an ajax callback to this behavior. |
String |
getEvent()
|
protected CharSequence |
getEventHandler()
|
protected void |
onCheckEvent(String event)
|
protected void |
onComponentTag(ComponentTag tag)
Called any time a component that has this handler registered is rendering the component tag. |
protected abstract void |
onEvent(AjaxRequestTarget target)
Listener method for the ajax event |
protected void |
respond(AjaxRequestTarget target)
|
AjaxEventBehavior |
setThrottleDelay(Duration throttleDelay)
Sets the throttle delay for this behavior. |
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior |
---|
findIndicatorId, getAjaxCallDecorator, getCallbackScript, getCallbackScript, getChannelName, getFailureScript, getPreconditionScript, getSuccessScript, onBind, onRequest, renderHead, throttleScript |
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior |
---|
bind, getCallbackUrl, getCallbackUrl, getComponent, getImplementationId, getStatelessHint, onComponentRendered, onComponentTag, onRendered, onRenderHeadContribution, onRenderHeadInitContribution |
Methods inherited from class org.apache.wicket.behavior.AbstractBehavior |
---|
afterRender, beforeRender, cleanup, detach, detachModel, exception, isEnabled, isTemporary, onConfigure, onException, rendered |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AjaxEventBehavior(String event)
event
- event this behavior will be attached toMethod Detail |
---|
public final AjaxEventBehavior setThrottleDelay(Duration throttleDelay)
For example, this is useful when attaching this behavior to the onkeypress event. It is not desirable to have an ajax call made every time the user types so we throttle that call to a desirable delay, such as once per second. This gives us a near real time ability to provide feedback without overloading the server with ajax calls.
throttleDelay
- throttle delay
protected void onComponentTag(ComponentTag tag)
AbstractAjaxBehavior
onComponentTag
in class AbstractAjaxBehavior
tag
- the tag that is renderedAbstractAjaxBehavior.onComponentTag(org.apache.wicket.markup.ComponentTag)
protected CharSequence getEventHandler()
protected CharSequence generateCallbackScript(CharSequence partialCall)
AbstractDefaultAjaxBehavior
AbstractDefaultAjaxBehavior.getAjaxCallDecorator()
.
generateCallbackScript
in class AbstractDefaultAjaxBehavior
partialCall
- Javascript of a partial call to the function performing the actual ajax callback.
Must be in format function(params,
with signature
function(params, onSuccessHandler, onFailureHandler
. Example:
wicketAjaxGet('callbackurl'
protected void onCheckEvent(String event)
event
- public final String getEvent()
protected final void respond(AjaxRequestTarget target)
respond
in class AbstractDefaultAjaxBehavior
target
- The AJAX targetAbstractDefaultAjaxBehavior.respond(org.apache.wicket.ajax.AjaxRequestTarget)
protected abstract void onEvent(AjaxRequestTarget target)
target
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |