org.apache.cocoon.woody.binding
Class JavaScriptJXPathBindingBuilder
java.lang.Object
org.apache.cocoon.woody.binding.JXPathBindingBuilderBase
org.apache.cocoon.woody.binding.JavaScriptJXPathBindingBuilder
- All Implemented Interfaces:
- LogEnabled
public class JavaScriptJXPathBindingBuilder
- extends JXPathBindingBuilderBase
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".
- Version:
- CVS $Id: JavaScriptJXPathBindingBuilder.html 1304258 2012-03-23 10:09:27Z ilgrosso $
- Author:
- Sylvain Wallez
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaScriptJXPathBindingBuilder
public JavaScriptJXPathBindingBuilder()
buildBinding
public JXPathBindingBase buildBinding(Element element,
JXPathBindingManager.Assistant assistant)
throws BindingException
- Description copied from class:
JXPathBindingBuilderBase
- Builds a configured binding object based on the configuration as
described in the bindingElement. The BuilderMap can be used to
find appropriate builders for possible subBinders.
- Specified by:
buildBinding
in class JXPathBindingBuilderBase
- Returns:
- JXPathBindingBase
- Throws:
BindingException
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.