public abstract class AbstractYuiAjaxBehavior
extends org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
AbstractDefaultAjaxBehavior
s that want to use YUI modules. It uses a IYuiContext
to
register all required components. The IYuiContext
is created by a (global) IYuiManager
which, in this
case, lives inside the Page
(as an IBehavior
) that is retrieved by component.getPage()
To allow clientside javascript components to do callbacks in a more flexible way than, for example, just sticking
them inside an element's onclick attribute, this behavior uses a bean that implements IAjaxSettings
in which
it will store the callbackUrl, a list of allowed callbackParameters and an anonymous function that takes the
callbackUrl as an argument and executes the callbackScript that is generated by the AbstractDefaultAjaxBehavior
.
Subclasses should override addHeaderContribution(IYuiContext context)
to get access to the
IYuiContext
.
Note: This behavior skips adding the necessary Wicket-Ajax header contributions, as this is handled by the
YuiHeaderCache
Constructor and Description |
---|
AbstractYuiAjaxBehavior(IAjaxSettings settings) |
Modifier and Type | Method and Description |
---|---|
void |
addHeaderContribution(IYuiContext context)
Override this method to get access to the IYuiContext
|
protected String |
getCallbackFunction()
Wrap the callback script in an anonymous function that takes the callback url as a parameter to allow client side
code to add request parameters
|
protected Map<String,Object> |
getCallbackParameters()
Provide custom callbackParameters
|
protected void |
onRenderHead(org.apache.wicket.markup.html.IHeaderResponse response) |
void |
renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
Don't call super since WicketAjax is loaded by Yui webapp behavior
TODO: webapp ajax is configurable, maybe check here and still load it.
|
protected void |
updateAjaxSettings() |
findIndicatorId, generateCallbackScript, getAjaxCallDecorator, getCallbackScript, getCallbackScript, getChannelName, getFailureScript, getPreconditionScript, getSuccessScript, onBind, onRequest, respond, throttleScript
bind, getCallbackUrl, getCallbackUrl, getComponent, getImplementationId, getStatelessHint, onComponentRendered, onComponentTag, onComponentTag, onRendered, onRenderHeadContribution, onRenderHeadInitContribution
public AbstractYuiAjaxBehavior(IAjaxSettings settings)
protected void updateAjaxSettings()
protected String getCallbackFunction()
protected Map<String,Object> getCallbackParameters()
public void addHeaderContribution(IYuiContext context)
context
- The IYuiContext this behavior can use to register YUI-modules and the likes.public void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
renderHead
in interface org.apache.wicket.markup.html.IHeaderContributor
renderHead
in class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
protected void onRenderHead(org.apache.wicket.markup.html.IHeaderResponse response)
Copyright © 2007-2013 Hippo B.V. (http://www.onehippo.com). All Rights Reserved.