public abstract class AbstractDefaultAjaxBehavior extends AbstractAjaxBehavior
| Modifier and Type | Field and Description |
|---|---|
static ResourceReference |
INDICATOR
reference to the default indicator gif file.
|
INTERFACE| Constructor and Description |
|---|
AbstractDefaultAjaxBehavior() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
findIndicatorId()
Finds the markup id of the indicator.
|
protected AjaxRequestAttributes |
getAttributes() |
CharSequence |
getCallbackFunction(CallbackParameter... extraParameters)
Generates a javascript function that can take parameters and performs an AJAX call which
includes these parameters.
|
CharSequence |
getCallbackFunctionBody(CallbackParameter... extraParameters)
Generates the body the callback
function.
|
CharSequence |
getCallbackScript() |
protected CharSequence |
getCallbackScript(Component component) |
protected void |
onBind()
Subclasses should call super.onBind()
|
void |
onRequest()
Called when a request to a behavior is received.
|
protected void |
postprocessConfiguration(JSONObject attributesJson,
Component component)
Gives a chance to modify the JSON attributesJson that is going to be used as attributes for
the Ajax call.
|
protected CharSequence |
renderAjaxAttributes(Component component)
{
u: 'editable-label?6-1.IBehaviorListener.0-text1-label', // url
m: 'POST', // method name.
|
protected CharSequence |
renderAjaxAttributes(Component component,
AjaxRequestAttributes attributes) |
void |
renderHead(Component component,
IHeaderResponse response)
Render to the web response whatever the component wants to contribute to the head section.
|
protected abstract void |
respond(AjaxRequestTarget target) |
protected void |
updateAjaxAttributes(AjaxRequestAttributes attributes)
Gives a chance to the specializations to modify the attributes.
|
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbindbeforeRender, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onConfigure, onEvent, onException, onRemovepublic static final ResourceReference INDICATOR
protected void onBind()
onBind in class AbstractAjaxBehaviorAbstractAjaxBehavior.onBind()public void renderHead(Component component, IHeaderResponse response)
BehaviorrenderHead in interface IComponentAwareHeaderContributorrenderHead in class Behaviorcomponent - component which is contributing to the response. This parameter is here to give
the component as the context for component-awares implementing this interfaceresponse - Response objectBehavior.renderHead(Component,
org.apache.wicket.markup.head.IHeaderResponse)protected final AjaxRequestAttributes getAttributes()
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
attributes - protected final CharSequence renderAjaxAttributes(Component component)
{
u: 'editable-label?6-1.IBehaviorListener.0-text1-label', // url
m: 'POST', // method name. Default: 'GET'
c: 'label7', // component id (String) or window for page
e: 'click', // event name
sh: [], // list of success handlers
fh: [], // list of failure handlers
pre: [], // list of preconditions. If empty set default : Wicket.$(settings{c}) !== null
ep: {}, // extra parameters
async: true|false, // asynchronous XHR or not
ch: 'someName|d', // AjaxChannel
i: 'indicatorId', // indicator component id
ad: true, // allow default
}
component - the component with that behaviorprotected final CharSequence renderAjaxAttributes(Component component, AjaxRequestAttributes attributes)
component - attributes - protected void postprocessConfiguration(JSONObject attributesJson, Component component) throws JSONException
attributesJson - the JSON object created by #renderAjaxAttributes()component - the component with the attached Ajax behaviorJSONException - thrown if an error occurs while modifying attributesJson argumentpublic CharSequence getCallbackScript()
protected CharSequence getCallbackScript(Component component)
component - the component to use when generating the attributespublic CharSequence getCallbackFunction(CallbackParameter... extraParameters)
function(param1, param2) {
var attrs = attrsJson;
var params = {'param1': param1, 'param2': param2};
attrs.ep = jQuery.extend(attrs.ep, params);
Wicket.Ajax.ajax(attrs);
}
extraParameters - public CharSequence getCallbackFunctionBody(CallbackParameter... extraParameters)
extraParameters - protected String findIndicatorId()
null if no indicator foundpublic final void onRequest()
IBehaviorListenerIBehaviorListener.onRequest()protected abstract void respond(AjaxRequestTarget target)
target - The AJAX targetCopyright © 2006–2021 Apache Software Foundation. All rights reserved.