mpo         2003/12/30 09:27:31

  Modified:    src/blocks/woody/samples welcome.xml sitemap.xmap
  Added:       src/blocks/woody/samples/flow bindings.js
               src/blocks/woody/samples/forms/binding done.jx
                        02lenient-def.xml 02lenient-bind.xml
                        01value-data.xml 01value-def.xml 01value-bind.xml
               src/blocks/woody/java/org/apache/cocoon/woody/samples/bindings
                        LenientNotOKBean.java LenientBaseBean.java
                        ValuesBean.java LenientOKBean.java
  Log:
  Initial commit of step-by-step Binding samples.
  Puts down a framework and some first sample-cases.
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/woody/samples/flow/bindings.js
  
  Index: bindings.js
  ===================================================================
  /*
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      [EMAIL PROTECTED]
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody2.js");
  
  /** 
   * Disclaimer: 
   *   To make this flowscript quite generic we've applied some typical 
javascript 
   *   hacks here and there. Don't let them overwhelm you, the prupose of this 
tutorial
   *   is _not_ to get into the depths of woody and flowscript. In stead you 
should 
   *   focus on the effects of the applied definitions in the binding files:
   *   see ../forms/bindings/*-bind.xml.  And how to shape you backend-models:
   *    - for JS see here: createJSBeanfor*() functions
   *    - for Java see the org.apache.cocoon.woody.samples.bindings.* classes
   *    - for XML see ../forms/bindings/*-data.xml.
   *   
   * In the same area of genericity we are not using the 
WoodyTemplateTransformer 
   *   since that would require to provide an extra template file to every 
sample.
   *
   * To add more binding-tutorial-samples follow these steps:
   *  - decide on a sample-code (e.g. '01value')
   *  - provide a woody formDefinition ../forms/bindings/{sampleCode}-def.xml
   *  - provide a woody formBinding    ../forms/bindings/{sampleCode}-bind.xml
   *  - provide the 3 types of backend-models:
   *    - for JS (javascript) you add here a function 
createJSBeanFor{sampleCode}()
   *      and let it return the js object to bind to
   *    - for Java you create an actual Java class that gets instantiated and 
returned
   *      by a function createJavaBeanFor{sampleCode}() over here
   *    - for XML you create a simple XML file over at
   *      ../forms/bindings/{sampleCode}-data.xml
   *  - finally you add a link into the ../welcome.xml page to link to your new 
sample      
   */
  
  
  
  
  /**
   *  Generic entry-function for all binding samples.  This uses the 
   *   'sample-code' and the 'backend-type' to effectively select the form 
   *   and specific back-end-model to use.
   */
  function bindingSample(sampleCode, backendType) {
        // sample-code holds the number-and-name of this binding sample in the 
tutorial
        if (cocoon.parameters["sample-code"] != undefined) {
          sampleCode = cocoon.parameters["sample-code"];
        }
        
        // backend-type holds one of 'JS', 'Java' or 'XML' to indicate 
        // the type of backend to use.
        if (cocoon.parameters["backend-type"] != undefined) {
          backendType = cocoon.parameters["backend-type"];
        }
        
        // all back-end models are bound to essentially the same form, using 
the same binding!
        var form = createFormForSample(sampleCode);
  
        // the beack-end model itself however depends on sample and type. 
        var bean = createBeanForSample(backendType, sampleCode);
        
        // loads the backend-bean into the form
        form.load(bean);
  
        // wait for user to submit the form correctly   
        form.showForm("binding.form");
        
        // saves the form into the backend-bean
        form.save(bean);
        var bizData = new Object();
        bizData["bean"] = bean;
        bizData["backendType"] = backendType;
        bizData["sampleCode"] = sampleCode;
  
        cocoon.sendPage("binding.done", bizData);
  }
  
  /** 
   * Creates the form for this sample. And automatically creates the 
accompanied 
   * binding.
   */
  function createFormForSample(sampleCode) {
        var form = new Form("forms/binding/" + sampleCode + "-def.xml");
        form.createBinding("forms/binding/" + sampleCode +"-bind.xml");
        return form;
  }
  
  /** 
   * Creates the Bean of the desired type for this sample.
   */
  function createBeanForSample(backendType, sampleCode) {
        if (backendType.equals("XML")) {
            return createXMLBean(sampleCode);
        } else {
        var factoryFunction = "create" + backendType + "BeanFor" + sampleCode;
            print("Using the bean returned by function " + factoryFunction + 
"()");
            return this[factoryFunction].apply();
        }
  }
  
  /** 
   * Finds the sample specific XML file to bind to and parses it into a DOM 
Document.
   */
  function createXMLBean(sampleCode) {
        var uri = "forms/binding/" + sampleCode +"-data.xml";
        print("Using the XML data file at " + uri);
  
      var parser = null;
      var source = null;
      var resolver = null;
      try {
          parser = 
cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
          resolver = 
cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
          source = resolver.resolveURI(uri);
          var is = new 
Packages.org.xml.sax.InputSource(source.getInputStream());
          is.setSystemId(source.getURI());
          //Note: we immediately narrow down to the root-element here to avoid
          // needing to wrap js and Java beans in a silly 'root'
          return parser.parseDocument(is).getDocumentElement();
      } finally {
          if (source != null)
              resolver.release(source);
          cocoon.releaseComponent(parser);
          cocoon.releaseComponent(resolver);
      }
  }     
  
  /**
   * Creates the JS Bean for sample '01value'
   */ 
  function createJSBeanFor01value() {
        var bean;
        bean = new Object();
        bean.simple = "Simple";
        bean.readOnly = "Read-Only";
        bean.writeOnly = "Write-Only";
        bean.diffIn = "Diff-in/out";
        // diffOut doesn't need to exist, binding will create it.
        bean.onUpdate = "On Update";
        bean.updateCount = 0;
        bean.bool = true;
        bean.date = "19700605";
        bean.other = "This field is not involved in the form.";
        return bean;
  }
  
  /**
   * Creates the Java Bean for sample '01value'
   */ 
  function createJavaBeanFor01value() {
        return new 
Packages.org.apache.cocoon.woody.samples.bindings.ValuesBean();
  }
  
  /**
   * Creates the JS Bean for sample '02lenient'
   */ 
  function createJSBeanFor02lenient() {
        var bean = new Object();
      var contexts = ["one","two","three"];       
        for(var i=0; i<contexts.length; i++) {
            bean[contexts[i]] = new Object();
          // to see the runtime effect of non-lenient binding
          // swap the following line from comment to code 
          //bean[contexts[i]]["breakingField"] = "present";
          
          //IMPORTANT: nothing changes! 
          // looks like we have become too lenient?
      }
        return bean;
  }
  
  /**
   * Creates the Java Bean for sample '02lenient'
   */ 
  function createJavaBeanFor02lenient() {
        var bean = new Packages.java.util.HashMap();
      var contexts = ["one","two","three"];       
        for(var i=0; i<contexts.length; i++) {
          // to see the runtime effect of non-lenient binding
          // swap the following 2 lines from comment to code 
  //        var subBean = new 
Packages.org.apache.cocoon.woody.samples.bindings.LenientOKBean("init");
            var subBean = new 
Packages.org.apache.cocoon.woody.samples.bindings.LenientNotOKBean("init");
  
          //IMPORTANT: nothing changes! 
          // looks like we have become too lenient?
  
            bean.put(contexts[i], subBean);
      }
        return bean;
  }
  
  
  1.1                  cocoon-2.1/src/blocks/woody/samples/forms/binding/done.jx
  
  Index: done.jx
  ===================================================================
  <?xml version="1.0"?>
  <page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
  
    <jx:macro name="dumpBean">
      <jx:parameter name="bean"/>
      <table cellspacing="2" cellpadding="1" bgcolor="#222222">
        <jx:forEach select="#{$bean/*}">
            <tr>
              <td bgcolor="#eeeeee">#{local-name(.)}</td>
              <td bgcolor="#ffffff">
                <jx:choose>
                  <jx:when test="#{starts-with(.,'[object ')}">
                    <dumpBean bean="#{.}" />
                  </jx:when>
                  <jx:otherwise>
                    #{.}
                  </jx:otherwise>
                </jx:choose>
              </td>
            </tr>
        </jx:forEach>
      </table>
    </jx:macro>
  
  
    <title>BindingSample :: Result</title>
    <content>
      <i>Contents of the #{./backendType} BEAN after using the binding for 
save():</i>
      <br/>
      
      <blockquote>
        <dumpBean bean="#{./bean}" />
          <!-- BEAN = #{./bean} -->
          <!-- BEAN-simple = #{./bean/simple} -->
      </blockquote>
      
      <i>Same sample using different backend-models: 
        <a href="./binding-#{./sampleCode}-JS.flow">JS</a> - 
        <a href="./binding-#{./sampleCode}-Java.flow">Java</a> - 
        <a href="./binding-#{./sampleCode}-XML.flow">XML</a>
      </i>
      
      <br/>
      
      <i>Other <a href="./">binding samples</a></i>
      
    </content>
  </page>
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/samples/forms/binding/02lenient-def.xml
  
  Index: 02lenient-def.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <wd:form
    xmlns:wd="http://apache.org/cocoon/woody/definition/1.0";>
  
    <wd:widgets>
    
      <wd:field id="anyfield" >
        <wd:label>String - Only one, bound to various paths in the 
model</wd:label>
        <wd:datatype base="string" />
      </wd:field>
      
    </wd:widgets>
    
  </wd:form>
  
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/samples/forms/binding/02lenient-bind.xml
  
  Index: 02lenient-bind.xml
  ===================================================================
  <?xml version="1.0"?>
  <wb:context 
    xmlns:wb="http://apache.org/cocoon/woody/binding/1.0"; 
    xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"; 
        path="/" 
        direction="load" >
  
  <!-- 
     | This file shows the inheritance behaviour of the @lenient setting 
     | on the various bindings in the framework. 
     | You will need to edit the backend-model in the script to see the effect
     |  see: ../../flow/bindings.js#createLenientTestObject()
     -->
     
    <!-- following 3 bindings work identical, see how inheritance and
         default settings do their work -->
          
    <wb:context path="one" lenient="false">
      <!-- to override inherit from .. explicitely set 'true' -->
      <wb:value id="anyfield" path="surviveField" lenient="true" />
      <!-- inherit from .. becomes 'false' -->
      <wb:value id="anyfield" path="breakingField" />
    </wb:context>
              
    <wb:context path="two" lenient="true">
      <!-- inherit from .. becomes 'true' -->
      <wb:value id="anyfield" path="surviveField" />
      <!-- to override inherit from .. explicitely set 'false' -->
      <wb:value id="anyfield" path="breakingField" lenient="false"/>
    </wb:context>
              
    <wb:context path="three" >
      <!-- inherit from ../.. becomes 'true' (the default for the root) -->
      <wb:value id="anyfield" path="surviveField" />
      <!-- to override inherit from ../.. explicitely set 'false' -->
      <wb:value id="anyfield" path="breakingField" lenient="false"/>
    </wb:context>
  
  </wb:context>
  
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/samples/forms/binding/01value-data.xml
  
  Index: 01value-data.xml
  ===================================================================
  <?xml version="1.0"?>
  <root>
    <simple test="nothing">Simple</simple>
    <readOnly>Read-Only</readOnly>
    <writeonly>Write-Only</writeonly>
    <diffIn>Diff-In/Out</diffIn>
    <!-- diffOut doesn't need to exist since the binding
         by default will create it. (not here though, but at the end...) -->
    <onUpdate>On Update</onUpdate>
    <updateCount>0</updateCount>
    <bool>true</bool>
    <date>19700506</date>
  </root>
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/samples/forms/binding/01value-def.xml
  
  Index: 01value-def.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <wd:form
    xmlns:wd="http://apache.org/cocoon/woody/definition/1.0";>
  
    <wd:widgets>
    
      <wd:field id="simple" >
        <wd:label>String - bound in both directions:</wd:label>
        <wd:datatype base="string" />
      </wd:field>
  
      <wd:field id="readonly" >
        <wd:label>String - bound only during load:</wd:label>
        <wd:datatype base="string" />
      </wd:field>
  
      <wd:field id="writeonly" >
        <wd:label>String - bound only during save:</wd:label>
        <wd:datatype base="string" />
      </wd:field>
  
      <wd:field id="diff" >
        <wd:label>String - bound in both directions but to different 
locations:</wd:label>
        <wd:datatype base="string" />
      </wd:field>
      
      <wd:field id="onupdate" >
        <wd:label>String - with extra binding &lt;on-update&gt;</wd:label>
        <wd:datatype base="string" />
      </wd:field>
      
      <wd:booleanfield id="bool">
        <wd:label>Boolean Value</wd:label>
      </wd:booleanfield>
  
  
      <wd:field id="date">
        <wd:label>Date - with different convertor for binding.</wd:label>
        <wd:datatype base="date" >
          <wd:convertor>
            <wd:patterns>
              <wd:pattern>dd/MM/yyyy</wd:pattern>
            </wd:patterns>
          </wd:convertor>
        </wd:datatype>
      </wd:field>
      
    </wd:widgets>
  </wd:form>
  
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/samples/forms/binding/01value-bind.xml
  
  Index: 01value-bind.xml
  ===================================================================
  <?xml version="1.0"?>
  <wb:context 
    xmlns:wb="http://apache.org/cocoon/woody/binding/1.0"; 
    xmlns:wd="http://apache.org/cocoon/woody/definition/1.0"; 
        path="/" >
  
  <!-- 
     | This file shows the different possibilities for (single) Value Binding 
     | of the Binding Framework in Cocoon Forms (aka Woody).
     -->
  
  
    <!-- 
       | SECTION 1. Default simple value-binding 
       -->
    <wb:value id="simple"   
              path="simple" />
              
  
    <!-- 
       | SECTION 2. Playing around with @direction
       -->
  
    <!-- Binding only during load() -->
    <wb:value id="readonly"   
              path="readOnly" direction="load"/>
              
    <!-- Binding only during save() -->          
    <wb:value id="writeonly"   
              path="writeOnly" direction="save"/>
              
    <!-- Binding working to different targets for 
         load() and save() -->
    <wb:value id="diff"   
              path="diffIn" direction="load"/>            
    <wb:value id="diff"   
              path="diffOut" direction="save"/>
              
              
    <!-- 
       | SECTION 3. Using the 'on-update'
       -->
                 
    <!-- Binding executing additional action on save()
         if the value changed -->          
    <wb:value id="onupdate"   
              path="onUpdate" >
      <wb:on-update>
        <wb:javascript id="onupdate" path="..">
          <wb:load-form />
          <wb:save-form>
            var countPointer = jxpathContext.getPointer('updateCount');
            var count = parseInt(countPointer.getValue()) + 1;
            countPointer.setValue(count);
          </wb:save-form>
        </wb:javascript>
      </wb:on-update>          
    </wb:value>
              
              
    <!-- 
       | SECTION 4. Matching value types and data-conversion
       -->
              
    <!-- Boolean Binding just works -->          
    <wb:value id="bool"   
              path="bool">
      <wd:convertor datatype="boolean" />
    </wb:value>
                          
    <!-- Converting data-types to/from String values -->
    <wb:value id="date"   
              path="date" >
      <wd:convertor datatype="date" >
        <wd:patterns>
          <wd:pattern>yyyyMMdd</wd:pattern>
        </wd:patterns>
      </wd:convertor>
    </wb:value>
    
  </wb:context>
  
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/samples/bindings/LenientNotOKBean.java
  
  Index: LenientNotOKBean.java
  ===================================================================
  /*
   * File LenientNotOKBean.java 
   * created by mpo
   * on Dec 26, 2003 | 4:01:40 PM
   * 
   * (c) 2003 - Outerthought BVBA
   */
  package org.apache.cocoon.woody.samples.bindings;
  
  /**
   * LenientNotOKBean
   */
  public class LenientNotOKBean extends LenientBaseBean{
  
      
      public LenientNotOKBean(String initVal) {
          super(initVal);
      }
      
  }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/samples/bindings/LenientBaseBean.java
  
  Index: LenientBaseBean.java
  ===================================================================
  /*
   * File LenientBaseBean.java 
   * created by mpo
   * on Dec 26, 2003 | 5:54:50 PM
   * 
   * (c) 2003 - Outerthought BVBA
   */
  package org.apache.cocoon.woody.samples.bindings;
  
  /**
   * LenientBaseBean
   */
  public class LenientBaseBean {
      protected String breakingField;
      protected String surviveField;
      
      protected LenientBaseBean(String initVal) {
          this.breakingField = initVal;
          this.surviveField = initVal;
      }
      
      
      public String toString() {
          final String className = this.getClass().getName();
          final String state = "[breakingField=" +breakingField + 
"|surviveField="+ surviveField+"]";
          return className + state;
      }
  
  }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/samples/bindings/ValuesBean.java
  
  Index: ValuesBean.java
  ===================================================================
  /*
   * File ValuesBean.java created by mpo on Dec 26, 2003 | 4:01:03 PM
   * 
   * (c) 2003 - Outerthought BVBA
   */
  package org.apache.cocoon.woody.samples.bindings;
  
  /**
   * ValuesBean used in the 01values test.
   */
  public class ValuesBean {
      private String simple = "Simple";
      private String writeOnly = "Write-Only";
      private String readOnly = "Read-Only";
      private String date = "19700506";
      private String diffIn = "Diff-in/out";
      private String diffOut;
      private String onUpdate = "On Update";
      private int updateCount = 0;
      private boolean bool = true;
      private String other = "This field is not involved in the form.";
  
    
  
      
      public String toString() {
          return "ValuesBean[\n"
          +"\tsimple=" +simple +"\n"
          +"\treadonly=" +readOnly +"\n"
          +"\twriteonly=" +writeOnly +"\n"
          +"\tdiff-in=" +diffIn +"\n"
          +"\tdiff-out=" +diffOut +"\n"
          +"\tdate=" +date +"\n"
          +"\tbool=" +bool +"\n"
          +"\tonupdate=" + onUpdate +"\n"
          +"\tupdateCount=" + updateCount +"\n"
          +"\tother=" + other +"\n";
      }
      
      /**
       * @return Returns the bool.
       */
      public boolean isBool() {
          return bool;
      }
  
      /**
       * @param bool The bool to set.
       */
      public void setBool(boolean bool) {
          this.bool = bool;
      }
  
      /**
       * @return Returns the date.
       */
      public String getDate() {
          return date;
      }
  
      /**
       * @param date The date to set.
       */
      public void setDate(String date) {
          this.date = date;
      }
  
      /**
       * @return Returns the diffIn.
       */
      public String getDiffIn() {
          return diffIn;
      }
  
      /**
       * @param diffIn The diffIn to set.
       */
      public void setDiffIn(String diffIn) {
          this.diffIn = diffIn;
      }
  
      /**
       * @return Returns the diffOut.
       */
      public String getDiffOut() {
          return diffOut;
      }
  
      /**
       * @param diffOut The diffOut to set.
       */
      public void setDiffOut(String diffOut) {
          this.diffOut = diffOut;
      }
  
      /**
       * @return Returns the onUpdate.
       */
      public String getOnUpdate() {
          return onUpdate;
      }
  
      /**
       * @param onUpdate The onUpdate to set.
       */
      public void setOnUpdate(String onUpdate) {
          this.onUpdate = onUpdate;
      }
  
      /**
       * @return Returns the other.
       */
      public String getOther() {
          return other;
      }
  
      /**
       * @param other The other to set.
       */
      public void setOther(String other) {
          this.other = other;
      }
  
      /**
       * @return Returns the readOnly.
       */
      public String getReadOnly() {
          return readOnly;
      }
  
      /**
       * @param readOnly The readOnly to set.
       */
      public void setReadOnly(String readOnly) {
          this.readOnly = readOnly;
      }
  
      /**
       * @return Returns the simple.
       */
      public String getSimple() {
          return simple;
      }
  
      /**
       * @param simple The simple to set.
       */
      public void setSimple(String simple) {
          this.simple = simple;
      }
  
      /**
       * @return Returns the updateCount.
       */
      public int getUpdateCount() {
          return updateCount;
      }
  
      /**
       * @param updateCount The updateCount to set.
       */
      public void setUpdateCount(int updateCount) {
          this.updateCount = updateCount;
      }
  
      /**
       * @return Returns the writeOnly.
       */
      public String getWriteOnly() {
          return writeOnly;
      }
  
      /**
       * @param writeOnly The writeOnly to set.
       */
      public void setWriteOnly(String writeOnly) {
          this.writeOnly = writeOnly;
      }
  
  }
  
  
  
  1.1                  
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/samples/bindings/LenientOKBean.java
  
  Index: LenientOKBean.java
  ===================================================================
  /*
   * File LenientOKBean.java 
   * created by mpo
   * on Dec 26, 2003 | 4:01:29 PM
   * 
   * (c) 2003 - Outerthought BVBA
   */
  package org.apache.cocoon.woody.samples.bindings;
  
  /**
   * LenientOKBean
   */
  public class LenientOKBean extends LenientBaseBean{
     
      public LenientOKBean(String initVal) {
          super(initVal);
      }
  
      
      /**
       * @return Returns the breakingField.
       */
      public String getBreakingField() {
          return breakingField;
      }
  
      /**
       * @param breakingField The breakingField to set.
       */
      public void setBreakingField(String breakingField) {
          this.breakingField = breakingField;
      }
  
  }
  
  
  
  1.12      +10 -0     cocoon-2.1/src/blocks/woody/samples/welcome.xml
  
  Index: welcome.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/welcome.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- welcome.xml       29 Dec 2003 06:14:49 -0000      1.11
  +++ welcome.xml       30 Dec 2003 17:27:31 -0000      1.12
  @@ -30,6 +30,16 @@
     </note>
     <sample name="XML Binding" href="form2xml.flow">A form for just editing an 
XML file.</sample>
     <sample name="Bean Binding" href="form2bean.flow">A form for just editing 
a Java bean</sample>
  +  <note>
  +     Step-by-step tutorial into individual binding features:
  +  </note>
  +  <sample name="1. Binding Simple Values" 
href="binding-01value.flow">wb:*/direction and wb:value/*</sample>
  +  <sample name="2. Lenient Binding" 
href="binding-02lenient.flow">*/@lenient</sample>
  +  <!-- TODO: provide more tutorial samples like these:
  +  <sample name="3. Aggregate Binding" 
href="binding-03aggregate.flow">wb:aggregate</sample>
  +  <sample name="4. Repeater Binding" 
href="binding-04repeater.flow">wb:repeater</sample>
  +  <sample name="5. JavaScript Binding" 
href="binding-05js.flow">wb:javascript</sample>
  +  -->
    </group>
   
    <group name="Locales">
  
  
  
  1.33      +39 -0     cocoon-2.1/src/blocks/woody/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/sitemap.xmap,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- sitemap.xmap      30 Dec 2003 11:35:45 -0000      1.32
  +++ sitemap.xmap      30 Dec 2003 17:27:31 -0000      1.33
  @@ -70,6 +70,7 @@
       <map:script src="flow/upload_example.js"/>
       <map:script src="flow/registration.js"/>
       <map:script src="flow/customvalidationdemo.js"/>
  +    <map:script src="flow/bindings.js"/>
       <map:script src="flow/form_model_gui.js"/>
     </map:flow>
   
  @@ -312,6 +313,11 @@
          <map:read src="{0}"/>
        </map:match>
   
  +     <!--
  +        | Sample building a woody-form-gui editor in woody
  +        | Doubles as a showcase for class, new, struct, union widgets
  +        -->
  +
        <map:match pattern="form_model_gui.flow">
          <map:call function="woody">
            <map:parameter name="function" value="form_model_gui"/>
  @@ -320,6 +326,39 @@
            <map:parameter name="documentURI" 
value="forms/form_model_gui_data.xml"/>
            <map:parameter name="bindingURI" 
value="forms/form_model_gui_binding.xml"/>
          </map:call>
  +     </map:match>
  +     
  +     
  +     <!--
  +        | Group of Binding feature samples...
  +        -->
  +     
  +     <map:match pattern="binding-*-*.flow">
  +       <map:call function="bindingSample">
  +         <map:parameter name="sample-code" value="{1}" />
  +         <map:parameter name="backend-type" value="{2}" />
  +       </map:call>
  +     </map:match>
  +     
  +     <map:match pattern="binding-*.flow">
  +       <map:redirect-to uri="binding-{1}-JS.flow" />
  +     </map:match>
  +     
  +     <map:match pattern="binding.form">
  +       <map:generate type="woody">
  +         <map:parameter name="form-action" 
value="#\{$continuation/id}.continue" />
  +       </map:generate>
  +       <!--TODO: fix xsl for use with woody-generator -->
  +       <map:transform src="resources/woody-samples-styling.xsl" />
  +       <map:serialize type="html" />
  +     </map:match>
  +
  +     <map:match pattern="binding.done">
  +       <map:generate type="jx" src="forms/binding/done.jx"/> <!-- generic 
dump of flow env via jx? -->
  +       <map:call resource="simple-page2html">
  +         <map:parameter name="file" value="forms/binding/done.jx"/>
  +       </map:call>
  +       <map:serialize />
        </map:match>
   
      </map:pipeline>
  
  
  

Reply via email to