com.googlecode.wickedcharts.wicket6
Class JavaScriptExpressionSendingAjaxBehavior

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      extended by org.apache.wicket.behavior.AbstractAjaxBehavior
          extended by org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
              extended by com.googlecode.wickedcharts.wicket6.JavaScriptExpressionSendingAjaxBehavior
All Implemented Interfaces:
Serializable, org.apache.wicket.behavior.IBehaviorListener, org.apache.wicket.IComponentAwareEventSink, org.apache.wicket.IRequestListener, org.apache.wicket.markup.html.IComponentAwareHeaderContributor, org.apache.wicket.util.io.IClusterable
Direct Known Subclasses:
InteractionBehavior, LiveDataAjaxBehavior, SelectionBehavior

public abstract class JavaScriptExpressionSendingAjaxBehavior
extends org.apache.wicket.ajax.AbstractDefaultAjaxBehavior

This AJAX behavior passes the values of a set of defined javascript variables to the server via AJAX.

Author:
Tom Hombergs (tom.hombergs@gmail.com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
 
Fields inherited from interface org.apache.wicket.behavior.IBehaviorListener
INTERFACE
 
Constructor Summary
JavaScriptExpressionSendingAjaxBehavior()
           
 
Method Summary
 void addJavaScriptValue(String parameterName, String javascriptExpression)
          Adds a javascript expression whose value to be passed from client to server.
 void addJavaScriptValues(Map<String,String> parameterMap)
          Adds a set of javascript expressions to be passed from client to server.
 CharSequence getCallbackScript()
           
protected  org.apache.wicket.util.string.StringValue getVariableValue(String parameterName)
          Reads the value of the given javascript variable from the AJAX request.
protected  void updateAjaxAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes attributes)
           
 
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getChannel, getFailureScript, getPreconditionScript, getSuccessScript, onBind, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributes, renderHead, respond
 
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag
 
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onConfigure, onEvent, onException, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptExpressionSendingAjaxBehavior

public JavaScriptExpressionSendingAjaxBehavior()
Method Detail

getVariableValue

protected org.apache.wicket.util.string.StringValue getVariableValue(String parameterName)
Reads the value of the given javascript variable from the AJAX request.

Parameters:
parameterName - the parameter name of the javascript expression whose value to read. The parameterName must have been specified earlier when calling addJavaScriptValue(String, String).
Returns:
the string representation of the javascript expression's value

getCallbackScript

public CharSequence getCallbackScript()
Overrides:
getCallbackScript in class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior

addJavaScriptValue

public void addJavaScriptValue(String parameterName,
                               String javascriptExpression)
Adds a javascript expression whose value to be passed from client to server. The result value of this expression is sent to the server via AJAX and can be accessed using the method getVariableValue(String). A javascript variable with the given name must exist within the scope the callback script of this behavior is called on the client side!

Parameters:
parameterName - the name under which the value of the given javascript expression can be accessed later
javascriptExpression - the javascript expression whose value pass from client to server.

addJavaScriptValues

public void addJavaScriptValues(Map<String,String> parameterMap)
Adds a set of javascript expressions to be passed from client to server.

Parameters:
parameterMap - a map containing the name of a parameter as key and a javascript expression as value
See Also:
addJavaScriptValue(String, String)

updateAjaxAttributes

protected void updateAjaxAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes attributes)
Overrides:
updateAjaxAttributes in class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior


Copyright © 2013. All Rights Reserved.