cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel AbstractContainerWidget.java
Date Wed, 07 Jul 2004 01:39:54 GMT
vgritsenko    2004/07/06 18:39:54

  Modified:    src/blocks/forms/java/org/apache/cocoon/forms/formmodel
                        AbstractContainerWidget.java
  Log:
  Call children validators first, then call self validators regardless of results.
  See http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108387931801458
  
  Revision  Changes    Path
  1.13      +28 -33    cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
  
  Index: AbstractContainerWidget.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AbstractContainerWidget.java	7 May 2004 16:43:42 -0000	1.12
  +++ AbstractContainerWidget.java	7 Jul 2004 01:39:54 -0000	1.13
  @@ -1,12 +1,12 @@
   /*
    * Copyright 1999-2004 The Apache Software Foundation.
  - * 
  + *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
  - * 
  + *
    *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  + *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  @@ -28,13 +28,13 @@
    * @version $Id$
    */
   public abstract class AbstractContainerWidget extends AbstractWidget implements ContainerWidget
{
  -    
  +
       /**
        * List of contained widgets.
        */
       protected WidgetList widgets;
   
  -    /** 
  +    /**
        * Constructs AbstractContainerWidget
        */
       public AbstractContainerWidget() {
  @@ -53,20 +53,20 @@
       public Widget getChild(String id) {
           return widgets.getWidget(id);
       }
  -    
  +
       public Iterator getChildren() {
           return widgets.iterator();
       }
   
       /**
        * Delegates the readFromRequest() down to the contained child-widgets.
  -     *  
  -     * When overriding one should call <code>super.readFromRequest()</code>

  -     * to allow child-widgets to process the request.  
  -     * 
  -     * Overide only to add possible request-reading statements on the containment level.
 
  -     * 
  -     * @param formContext to be passed to the {@link Widget#readFromRequest(FormContext)}

  +     *
  +     * When overriding one should call <code>super.readFromRequest()</code>
  +     * to allow child-widgets to process the request.
  +     *
  +     * Overide only to add possible request-reading statements on the containment level.
  +     *
  +     * @param formContext to be passed to the {@link Widget#readFromRequest(FormContext)}
        *                    of the contained widgets.
        */
       public void readFromRequest(FormContext formContext) {
  @@ -74,32 +74,27 @@
       }
   
       /**
  -     * Delegates the validate() down to the contained child-widgets,
  -     * and only validates the extra rules on this containment level if all
  -     * child-widgets are valid. 
  -     * 
  -     * When overriding one should call <code>super.validate()</code> as the
first 
  -     * statement to keep in sync with this behaviour. 
  -     * 
  -     * @return <code>true</code> only if all contained widgets are valid and
the 
  +     * Delegates the <code>validate()</code> down to the contained child-widgets,
  +     * and validates the extra rules on this containment level regardless of
  +     * children widget's validities.
  +     *
  +     * <p>When overriding one should call <code>super.validate()</code>
as the first
  +     * statement to keep in sync with this behaviour.</p>
  +     *
  +     * @return <code>true</code> only if all contained widgets are valid and
the
        *         extra validation rules on this containment level are ok.
        */
       public boolean validate() {
  -        // Validate self only if child widgets are valid
  -        //TODO: check if we should not change this to still validating kids first 
  -        // BUT also validating the top level
  -        if (widgets.validate()) {
  -            return super.validate();
  -        } else {
  -            return false;
  -        }
  +        // Validate children first, then always validate self. Return combined result.
  +        final boolean valid = widgets.validate();
  +        return super.validate() && valid;
       }
   
   
       /**
  -     * Subclass container widgets can call this super.generateItemSaxFragment(..) 
  -     * to just insert the child-widget content wrapped in a @lt;fi:widgets@gt; 
  -     * 
  +     * Subclass container widgets can call this super.generateItemSaxFragment(..)
  +     * to just insert the child-widget content wrapped in a @lt;fi:widgets@gt;
  +     *
        * @param contentHandler where the SAX is sent to via {@link Widget#generateSaxFragment(ContentHandler,
Locale)}
        * @param locale
        * @throws SAXException
  
  
  

Mime
View raw message