| Builds a
Binding based on two JavaScript snippets, respectively for loading and saving the form.
The syntax for this binding is as follows :
<wb:javascript id="foo" path="@foo">
<wb:load-form>
var appValue = jxpathPointer.getValue();
var formValue = doLoadConversion(appValue);
widget.setValue(formValue);
</wb:load-form>
<wb:save-form>
var formValue = widget.getValue();
var appValue = doSaveConversion(formValue);
jxpathPointer.setValue(appValue);
</wb:save-form>
</wb:javascript>
This example is rather trivial and could be replaced by a simple <wb:value>, but
it shows the available variables in the script:
widget : the widget identified by the "id" attribute,
jxpathPointer : the JXPath pointer corresponding to the "path" attribute,
jxpathContext (not shown): the JXPath context corresponding to the "path" attribute
Notes:
- The <wb:save-form> snippet should be ommitted if the "direction" attribute is set to "load".
- The <wb:load-form> snippet should be ommitted if the "direction" attribute is set to "save".
author: Sylvain Wallez version: CVS $Id: JavaScriptJXPathBindingBuilder.java 433543 2006-08-22 06:22:54Z crossley $ |