cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From step...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test FlowTest.java
Date Wed, 31 Mar 2004 14:16:30 GMT
stephan     2004/03/31 06:16:30

  Modified:    src/blocks/javaflow/java/org/apache/cocoon/forms/flow/java
                        FormInstance.java
               src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java
                        FormFlow.java
               src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test
                        FlowTest.java
  Log:
  tabs2spaces.
  
  Revision  Changes    Path
  1.2       +61 -61    cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/forms/flow/java/FormInstance.java
  
  Index: FormInstance.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/forms/flow/java/FormInstance.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FormInstance.java	31 Mar 2004 13:32:57 -0000	1.1
  +++ FormInstance.java	31 Mar 2004 14:16:30 -0000	1.2
  @@ -38,14 +38,14 @@
    */
   public class FormInstance extends AbstractCocoonFlow {
   
  -	  private Form form;
  -		private Binding binding;
  +    private Form form;
  +    private Binding binding;
       private Widget formWidget;
  -		private Locale locale;
  -		private boolean isValid;
  -		private String submitId;
  -		private Object validator; // Used?
  -	
  +    private Locale locale;
  +    private boolean isValid;
  +    private String submitId;
  +    private Object validator; // Used?
  +  
       /**
        * Create a form, given the URI of its definition file
        */
  @@ -69,38 +69,38 @@
               if (src != null) resolver.release(src);
               releaseComponent(resolver);
           }
  -		}
  +    }
   
  -		/**
  +    /**
        * Create a form, given the URI of its definition file, the
  -		 * binding file.
  +     * binding file.
        */
  -		public FormInstance(String definitionFile, String bindingFile) {
  -			  this(definitionFile);
  -				createBinding(bindingFile);
  -		}
  +    public FormInstance(String definitionFile, String bindingFile) {
  +        this(definitionFile);
  +        createBinding(bindingFile);
  +    }
   
       /**
        * Create a form of an fd:form element in the form of a org.w3c.dom.Element
        */
       public FormInstance(Element formDefinition) {
           FormManager formMgr = null;
  -			  SourceResolver resolver = null;
  -				Source src = null;
  -		    try {
  -					  formMgr = (FormManager)getComponent(FormManager.ROLE);
  +        SourceResolver resolver = null;
  +        Source src = null;
  +        try {
  +            formMgr = (FormManager)getComponent(FormManager.ROLE);
               resolver = (SourceResolver)getComponent(SourceResolver.ROLE);
  -						Form form = formMgr.createForm(formDefinition);
  -		        this.binding = null;
  -		        // this.formWidget = new Widget(form);  could not create instance
  -		        // this.local = cocoon.createPageLocal(); PageLocal ?
  -			  } catch (Exception e) {
  +            Form form = formMgr.createForm(formDefinition);
  +            this.binding = null;
  +            // this.formWidget = new Widget(form);  could not create instance
  +            // this.local = cocoon.createPageLocal(); PageLocal ?
  +        } catch (Exception e) {
               throw new RuntimeException(e.toString());
  -  	    } finally {
  +        } finally {
               releaseComponent(formMgr);
               if (src != null) resolver.release(src);
               releaseComponent(resolver);
  -				}
  +        }
       }
   
       public Widget getModel() {
  @@ -125,9 +125,9 @@
        * redisplayed. If setBookmark() is not called, this is implicitly set to
        * the beginning of showForm().
        */
  -/*		public WebContinuation setBookmark() {
  -			    return (this.local_.webContinuation = cocoon.createWebContinuation());
  -		}*/
  +/*    public WebContinuation setBookmark() {
  +          return (this.local_.webContinuation = cocoon.createWebContinuation());
  +    }*/
   
       /**
        * Returns the bookmark continuation associated with this form, or undefined
  @@ -136,12 +136,12 @@
        */
   /*    public WebContinuation getBookmark() {
           return this.local_.webContinuation;
  -    }	*/
  +    }  */
   
       public void show(String uri) {
           show(uri, new VarMap());
  -		}
  -		
  +    }
  +    
       /**
        * Manages the display of a form and its validation.
        *
  @@ -178,7 +178,7 @@
           do {
               sendPageAndWait(uri, bizData);
           
  -						FormContext formContext = new FormContext(getRequest(), locale);
  +            FormContext formContext = new FormContext(getRequest(), locale);
   
               // Prematurely add the bizData as a request attribute so that event listeners
can use it
               // (the same is done by cocoon.sendPage())
  @@ -217,33 +217,33 @@
        *  created
        * @returns The web continuation associated with submitting this form
        */
  -/*		public showForm(String uri, Object fun, ttl) {
  +/*    public showForm(String uri, Object fun, ttl) {
           if (!this.getBookmark()) {
  -				    this.setBookmark();
  -		    }
  -				FormContext formContext = FormsFlowHelper.getFormContext(cocoon, this.locale);
  -		    // this is needed by the FormTemplateTransformer:
  -				//var javaWidget = this.formWidget_.unwrap();;
  -		    //this.formWidget_["CocoonFormsInstance"] = javaWidget;
  -		    getRequest().setAttribute(Packages.org.apache.cocoon.forms.transformation.CFORMSKEY,
this.formWidget);
  -		    WebContinuation wk = sendPageAndWait(uri, this.formWidget, fun, ttl);
  -		    var formContext = new FormContext(cocoon.request, javaWidget.getLocale());
  -		    var userErrors = 0;
  +            this.setBookmark();
  +        }
  +        FormContext formContext = FormsFlowHelper.getFormContext(cocoon, this.locale);
  +        // this is needed by the FormTemplateTransformer:
  +        //var javaWidget = this.formWidget_.unwrap();;
  +        //this.formWidget_["CocoonFormsInstance"] = javaWidget;
  +        getRequest().setAttribute(Packages.org.apache.cocoon.forms.transformation.CFORMSKEY,
this.formWidget);
  +        WebContinuation wk = sendPageAndWait(uri, this.formWidget, fun, ttl);
  +        var formContext = new FormContext(cocoon.request, javaWidget.getLocale());
  +        var userErrors = 0;
           this.formWidget_.validationErrorListener = function(widget, error) {
               if (error != null) {
                   userErrors++;
               }
  -		    }
  -		    var finished = javaWidget.process(formContext);
  -		    if (this.onValidate) {
  +        }
  +        var finished = javaWidget.process(formContext);
  +        if (this.onValidate) {
               this.onValidate(this);
  -		    }
  -		    if (!finished || userErrors > 0) {
  -		        cocoon.continuation = this.local_.webContinuation;
  -				    this.local_.webContinuation.continuation(this.local_.webContinuation);
  -				}
  -				return wk;
  -		}*/
  +        }
  +        if (!finished || userErrors > 0) {
  +            cocoon.continuation = this.local_.webContinuation;
  +            this.local_.webContinuation.continuation(this.local_.webContinuation);
  +        }
  +        return wk;
  +    }*/
   
       public void createBinding(String bindingURI) {
           BindingManager bindingManager = null;
  @@ -254,7 +254,7 @@
               resolver = (SourceResolver)getComponent(SourceResolver.ROLE);
               source = resolver.resolveURI(bindingURI);
               this.binding = bindingManager.createBinding(source);
  -				} catch (Exception e) {
  +        } catch (Exception e) {
               throw new RuntimeException(e.toString());
           } finally {
               if (source != null)
  @@ -268,22 +268,22 @@
           if (this.binding == null)
               throw new Error("Binding not configured for this form.");
   
  -				try {
  +        try {
               this.binding.loadFormFromModel(this.form, object);
  -				} catch (Exception e) {
  +        } catch (Exception e) {
               throw new RuntimeException(e.toString());
  -				}
  +        }
       }
   
       public void save(Object object) {
           if (this.binding == null)
               throw new Error("Binding not configured for this form.");
   
  -				try {
  +        try {
               this.binding.saveFormToModel(this.form, object);
  -				} catch (Exception e) {
  +        } catch (Exception e) {
               throw new RuntimeException(e.toString());
  -				}
  +        }
       }
   
       public void setAttribute(String name, Object value) {
  
  
  
  1.4       +1 -1      cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java/FormFlow.java
  
  Index: FormFlow.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/samples/flow/java/FormFlow.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormFlow.java	31 Mar 2004 13:32:57 -0000	1.3
  +++ FormFlow.java	31 Mar 2004 14:16:30 -0000	1.4
  @@ -27,7 +27,7 @@
   
       public void doEditForm1() {
   
  -				FormInstance form = new FormInstance("forms/form1.xml");
  +        FormInstance form = new FormInstance("forms/form1.xml");
   
           Field birthDate = (Field) form.getWidget("birthdate");
           birthDate.setValue(new Date());
  
  
  
  1.2       +24 -24    cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/FlowTest.java
  
  Index: FlowTest.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/FlowTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FlowTest.java	31 Mar 2004 14:12:01 -0000	1.1
  +++ FlowTest.java	31 Mar 2004 14:16:30 -0000	1.2
  @@ -45,27 +45,27 @@
       }
   
       private static ClassLoader loader = new ContinuationClassLoader(FlowTest.class.getClassLoader());
  -		private ContinuationContext context;
  -		private MockRequest request;
  -		private MockRedirector redirector;
  -		private HashMap objectmodel;
  +    private ContinuationContext context;
  +    private MockRequest request;
  +    private MockRedirector redirector;
  +    private HashMap objectmodel;
   
  -		public void setUp() {
  +    public void setUp() {
   
           context = new ContinuationContext();
  -			
  -			  DefaultContext avalonContext = new DefaultContext();
  +      
  +        DefaultContext avalonContext = new DefaultContext();
   
  -				request = new MockRequest();
  -				avalonContext.put(ContextHelper.CONTEXT_REQUEST_OBJECT, request);
  -				objectmodel = new HashMap();
  -				objectmodel.put(ObjectModelHelper.REQUEST_OBJECT, request);
  -				avalonContext.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectmodel);
  +        request = new MockRequest();
  +        avalonContext.put(ContextHelper.CONTEXT_REQUEST_OBJECT, request);
  +        objectmodel = new HashMap();
  +        objectmodel.put(ObjectModelHelper.REQUEST_OBJECT, request);
  +        avalonContext.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectmodel);
           redirector = new MockRedirector();
   
  -				context.setAvalonContext(avalonContext);
  -				context.setRedirector(redirector);
  -		}
  +        context.setAvalonContext(avalonContext);
  +        context.setRedirector(redirector);
  +    }
   
       public void testSimple() throws Exception {
   
  @@ -106,7 +106,7 @@
   
           //System.out.println("request=" + request);
           request.addParameter("a", "2.3");
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  @@ -124,7 +124,7 @@
           assertTrue(!c.isCapturing());
   
           VarMap map = (VarMap)FlowHelper.getContextObject(objectmodel);
  -				
  +        
           assertEquals(((Float)map.getMap().get("result")).floatValue(), 3.3f, 0.1f);
   
           JXPathContext jxcontext = JXPathContext.newContext(FlowHelper.getContextObject(objectmodel));
  @@ -158,7 +158,7 @@
           assertEquals(redirector.getRedirect(), "cocoon:/getNumberA");
   
           request.addParameter("a", "bla");
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  @@ -177,7 +177,7 @@
   
           assertEquals(redirector.getRedirect(), "cocoon:/error");
   
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  @@ -220,7 +220,7 @@
           assertEquals(context.getRedirectedURI(), "cocoon:/getNumberA");
   
           request.addParameter("a", "bla");
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  @@ -237,7 +237,7 @@
   
           assertEquals(context.getRedirectedURI(), "cocoon:/result");
   
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  @@ -322,7 +322,7 @@
           assertEquals(redirector.getRedirect(), "cocoon:/page/getNumberA");
   
           request.addParameter("a", "2");
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  @@ -344,7 +344,7 @@
           assertEquals(redirector.getRedirect(), "cocoon:/page/getNumberB");
   
           request.addParameter("b", "2");
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  @@ -366,7 +366,7 @@
           assertEquals(redirector.getRedirect(), "cocoon:/page/getOperator");
           
           request.addParameter("operator", "plus");
  -				redirector.reset();
  +        redirector.reset();
           c = new Continuation(c, context);
   
           assertTrue(c.isRestoring());
  
  
  

Mime
View raw message