mpo         2003/12/31 06:37:13

  Modified:    src/blocks/woody/samples/flow bindings.js
               src/blocks/woody/samples/forms/binding 02lenient-data.xml
  Log:
  Adding some comments to describe the working of sample '02lenient'
  
  Revision  Changes    Path
  1.2       +12 -11    cocoon-2.1/src/blocks/woody/samples/flow/bindings.js
  
  Index: bindings.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/flow/bindings.js,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- bindings.js       30 Dec 2003 17:27:30 -0000      1.1
  +++ bindings.js       31 Dec 2003 14:37:13 -0000      1.2
  @@ -146,6 +146,9 @@
    * Finds the sample specific XML file to bind to and parses it into a DOM 
Document.
    */
   function createXMLBean(sampleCode) {
  +     // note if you want to toss around with the XML model (e.g. sample 
02lenient)
  +     // then you should do that by editing the files: 
../forms/binding/*-data.xml
  +
        var uri = "forms/binding/" + sampleCode +"-data.xml";
        print("Using the XML data file at " + uri);
   
  @@ -203,12 +206,9 @@
       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 
  +        // using javascript beans seem to survive even non lenient binding
  +        // so you can do here what you want, the bean itself seems to be 
leninet?
           //bean[contexts[i]]["breakingField"] = "present";
  -        
  -        //IMPORTANT: nothing changes! 
  -        // looks like we have become too lenient?
       }
        return bean;
   }
  @@ -218,15 +218,16 @@
    */ 
   function createJavaBeanFor02lenient() {
        var bean = new Packages.java.util.HashMap();
  -    var contexts = ["one","two","three"];      
  +     // to see the runtime effect of non-lenient binding
  +     // remove/replace the 'one' in the following list:
  +    var contexts = ["one","two","three"];      // only the 'one' context is 
required by non-lenient binding
        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?
  +         var subBean = new 
Packages.org.apache.cocoon.woody.samples.bindings.LenientOKBean("init");
  +//       var subBean = new 
Packages.org.apache.cocoon.woody.samples.bindings.LenientNotOKBean("init");
  +         
  +         // the NotOkBean does not have a getBreakingField() required by the 
non-lenient binding
   
            bean.put(contexts[i], subBean);
       }
  
  
  
  1.2       +6 -2      
cocoon-2.1/src/blocks/woody/samples/forms/binding/02lenient-data.xml
  
  Index: 02lenient-data.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/woody/samples/forms/binding/02lenient-data.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- 02lenient-data.xml        31 Dec 2003 08:05:35 -0000      1.1
  +++ 02lenient-data.xml        31 Dec 2003 14:37:13 -0000      1.2
  @@ -2,15 +2,19 @@
   <root>
     <!-- to see the runtime effect of non-lenient binding
          comment out one of the 'breakingField' nodes below -->
  +       
  +  <!-- an element named 'one' is required by non-lenient binding -->     
     <one>
  +    <!-- 'breakingField' is required by non-lenient binding -->
       <breakingField>init1</breakingField>
     </one>
  +
  +  <!-- elements 'two' and 'three' are optional, but if present, then 
non-lenient
  +       binding requires them to have a 'breakingField' child attribute -->
     <two>
       <breakingField>init2</breakingField>
     </two>
     <three>
  -  <!--
       <breakingField>init3</breakingField>
  -    -->
     </three>
   </root>
  
  
  

Reply via email to