cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r210086 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/forms/java/org/apache/cocoon/forms/formmodel/
Date Mon, 11 Jul 2005 08:26:44 GMT
Author: cziegeler
Date: Mon Jul 11 01:26:40 2005
New Revision: 210086

URL: http://svn.apache.org/viewcvs?rev=210086&view=rev
Log:
CForms block: Add isValid() method to a Widget.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Output.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractContainerWidget.java
Mon Jul 11 01:26:40 2005
@@ -109,12 +109,14 @@
      *         extra validation rules on this containment level are ok.
      */
     public boolean validate() {
-        if (!getCombinedState().isValidatingValues())
+        if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
-
+        }
         // Validate children first, then always validate self. Return combined result.
         final boolean valid = widgets.validate();
-        return super.validate() && valid;
+        this.wasValid = super.validate() && valid;
+        return this.wasValid;
     }
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
Mon Jul 11 01:26:40 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -65,6 +65,11 @@
      */
     private Map attributes;
 
+    /**
+     * The result of the last call to {@link #validate()}.
+     */
+    protected boolean wasValid = true;
+
     protected AbstractWidget(AbstractWidgetDefinition definition) {
         this.state = definition.getState();
     }
@@ -279,20 +284,26 @@
         return false;
     }
 
+    /**
+     * @see org.apache.cocoon.forms.formmodel.Widget#validate()
+     */
     public boolean validate() {
         // Consider widget valid if it is not validating values.
         if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
         }
 
         // Test validators from the widget definition
         if (!getDefinition().validate(this)) {
             // Failed
+            this.wasValid = false;
             return false;
         } 
         // Definition successful, test local validators
         if (this.validators == null) {
             // No local validators
+            this.wasValid = true;
             return true;
         }
         
@@ -301,13 +312,21 @@
         while(iter.hasNext()) {
             WidgetValidator validator = (WidgetValidator)iter.next();
             if (!validator.validate(this)) {
+                this.wasValid = false;
                 return false;
             }
         }
         
         // All local iterators successful
+        this.wasValid = true;
         return true;
+    }
 
+    /**
+     * @see org.apache.cocoon.forms.formmodel.Widget#isValid()
+     */
+    public boolean isValid() {
+        return this.wasValid;
     }
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Action.java
Mon Jul 11 01:26:40 2005
@@ -96,6 +96,13 @@
         return true;
     }
 
+    /**
+     * @see org.apache.cocoon.forms.formmodel.Widget#isValid()
+     */
+    public boolean isValid() {
+        return true;
+    }
+    
     private static final String ACTION_EL = "action";
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AggregateField.java
Mon Jul 11 01:26:40 2005
@@ -194,9 +194,10 @@
     }
 
     public boolean validate() {
-        if (!getCombinedState().isValidatingValues())
+        if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
-
+        }
         if (enteredValue != null && !fieldsHaveValues()) {
             XMLizable failMessage = getAggregateFieldDefinition().getSplitFailMessage();
             if (failMessage != null) {
@@ -207,6 +208,7 @@
                                                                       Constants.I18N_CATALOGUE));
             }
             valueState = VALUE_DISPLAY_VALIDATION;
+            this.wasValid = false;
             return false;
         }
 
@@ -221,6 +223,7 @@
         }
         if (!valid) {
             valueState = VALUE_DISPLAY_VALIDATION;
+            this.wasValid = false;
             return false;
         }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
Mon Jul 11 01:26:40 2005
@@ -273,8 +273,10 @@
     }
 
     public boolean validate() {
-        if (!getCombinedState().isValidatingValues())
+        if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
+        }
 
         if (this.valueState == VALUE_UNPARSED) {
             doParse();
@@ -296,6 +298,7 @@
             getForm().addWidgetUpdate(this);
         }
 
+        this.wasValid = this.validationError == null;
         return this.validationError == null;
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java
Mon Jul 11 01:26:40 2005
@@ -328,7 +328,7 @@
      * Set a validation error on this field. This allows the form to be externally marked
as invalid by
      * application logic.
      *
-     * @param error the validation error
+     * @return the validation error
      */
     public ValidationError getValidationError() {
         return this.validationError;
@@ -351,7 +351,8 @@
 
         // FIXME: Is this check needed, before invoking the listener?
         if (this.endProcessing != null) {
-            return this.endProcessing.booleanValue();
+            this.wasValid = this.endProcessing.booleanValue();
+            return this.wasValid;
         }
 
         // Notify the end of the current phase
@@ -362,10 +363,11 @@
             // De-validate the form if one of the listeners asked to end the processing
             // This allows for additional application-level validation.
             this.isValid = false;
-            return this.endProcessing.booleanValue();
+            this.wasValid = this.endProcessing.booleanValue();
+            return this.wasValid;
         }
-
-        return this.isValid && this.validationError == null;
+        this.wasValid = this.isValid && this.validationError == null;
+        return this.wasValid;
     }
 
     private static final String FORM_EL = "form";

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Messages.java
Mon Jul 11 01:26:40 2005
@@ -60,9 +60,11 @@
 
     public boolean validate() {
         if (!getCombinedState().isValidatingValues())  {
+            this.wasValid = true;
             return true;
         }
-        return messages.size() == 0;
+        this.wasValid = messages.size() == 0;
+        return this.wasValid;
     }
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
Mon Jul 11 01:26:40 2005
@@ -114,8 +114,10 @@
     }
 
     public boolean validate() {
-        if (!getCombinedState().isValidatingValues())
+        if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
+        }
 
         if (values != null) {
             validationError = definition.getDatatype().validate(values, new ExpressionContextImpl(this));
@@ -123,7 +125,8 @@
         else {
             validationError = new ValidationError(new I18nMessage("multivaluefield.conversionfailed",
Constants.I18N_CATALOGUE));
         }
-        return validationError == null ? super.validate() : false;
+        this.wasValid = validationError == null ? super.validate() : false;
+        return this.wasValid;
     }
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Output.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Output.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Output.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Output.java
Mon Jul 11 01:26:40 2005
@@ -59,7 +59,17 @@
         // do nothing
     }
 
+    /**
+     * @see org.apache.cocoon.forms.formmodel.Widget#validate()
+     */
     public boolean validate() {
+        return true;
+    }
+
+    /**
+     * @see org.apache.cocoon.forms.formmodel.Widget#isValid()
+     */
+    public boolean isValid() {
         return true;
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Repeater.java
Mon Jul 11 01:26:40 2005
@@ -248,17 +248,22 @@
         }
     }
 
+    /**
+     * @see org.apache.cocoon.forms.formmodel.Widget#validate()
+     */
     public boolean validate() {
-        if (!getCombinedState().isValidatingValues())
+        if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
-
+        }
         boolean valid = true;
         Iterator rowIt = rows.iterator();
         while (rowIt.hasNext()) {
             RepeaterRow row = (RepeaterRow)rowIt.next();
             valid = valid & row.validate();
         }
-        return (valid ? super.validate() : false) && this.validationError == null;
+        this.wasValid = (valid ? super.validate() : false) && this.validationError
== null;
+        return this.wasValid;
     }
 
 
@@ -341,7 +346,7 @@
      * Set a validation error on this field. This allows repeaters be externally marked as
invalid by
      * application logic.
      *
-     * @param error the validation error
+     * @return the validation error
      */
     public ValidationError getValidationError() {
         return this.validationError;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Union.java
Mon Jul 11 01:26:40 2005
@@ -120,16 +120,20 @@
 
     // TODO: Simplify this logic.
     public boolean validate() {
-        if (!getCombinedState().isValidatingValues())
+        if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
-
+        }
         Widget widget;
         boolean valid = true;
         // Read current case from request
         String value = (String)getValue();
-        if (value != null && !value.equals(""))
-            if ((widget = getChild(value)) != null)
+        if (value != null && !value.equals("")) {
+            if ((widget = getChild(value)) != null) {
                 valid = valid & widget.validate();
+            }
+        }
+        this.wasValid = valid;
         return valid;
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
Mon Jul 11 01:26:40 2005
@@ -110,9 +110,10 @@
     }
 
     public boolean validate() {
-        if (!getCombinedState().isValidatingValues())
+        if (!getCombinedState().isValidatingValues()) {
+            this.wasValid = true;
             return true;
-        
+        }
         ValidationError newError = null;
 
         if (this.part == null) {
@@ -143,8 +144,8 @@
         if (!ObjectUtils.equals(this.validationError, newError)) {
             setValidationError(newError);
         }
-
-        return validationError == null ? super.validate() : false;
+        this.wasValid = validationError == null ? super.validate() : false;
+        return this.wasValid;
     }
 
     /**

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
Mon Jul 11 01:26:40 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 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.
@@ -57,51 +57,51 @@
      * Widget-Separator used in path-like notations
      * @see #lookupWidget(String)
      */
-    public static final char PATH_SEPARATOR = '/';
+    char PATH_SEPARATOR = '/';
 
     /**
      * Called after widget's environment has been setup,
      * to allow for any contextual initalization such as
      * looking up case widgets for union widgets.
      */
-    public void initialize();
+    void initialize();
 
     /**
      * @return  the source location of this widget.
      */
-    public String getLocation();
+    String getLocation();
 
     /**
      * @return the id of this widget.  This should never be <code>null</code>
      * Top-level container widgets (like 'form') should return <code>""</code>
      */
-    public String getId();
+    String getId();
 
     /**
      * @return the parent of this widget. If this widget is the root widget,
      * this method returns null.
      */
-    public Widget getParent();
+    Widget getParent();
 
     /**
      * This method is called on a widget when it is added to a container.
      * You shouldn't call this method unless youre implementing a widget yourself (in
      * which case it should be called when a widget is added as child of your widget).
      */
-    public void setParent(Widget widget);
+    void setParent(Widget widget);
 
     /**
      * @return the {@link Form} to which this widget belongs. The form is the top-most ancestor
      * of the widget.
      */
-    public Form getForm();
+    Form getForm();
 
     /**
      * Get this widget's definition.
      * 
      * @return the widget's definition
      */
-    public WidgetDefinition getDefinition();
+    WidgetDefinition getDefinition();
     
     /**
      * Get the widget's own state. Note that this state is <em>not</em> the one
actually considered
@@ -110,7 +110,7 @@
      * @see #getCombinedState()
      * @return the widget's own state
      */
-    public WidgetState getState();
+    WidgetState getState();
 
     /**
      * Set the widget's own state. This may change its combined state, and those of its
@@ -118,7 +118,7 @@
      *
      * @param state the new wiget state
      */
-    public void setState(WidgetState state);
+    void setState(WidgetState state);
 
     /**
      * Get the widget's combined state, which is the strictest of its own state and parent
state.
@@ -128,20 +128,20 @@
      * @see WidgetState#strictest(WidgetState, WidgetState)
      * @return the combined state
      */
-    public WidgetState getCombinedState();
+    WidgetState getCombinedState();
 
     /**
      * @return the id prefixed with the namespace, this name should be unique
      * accross all widgets on the form.
      */
-    public String getRequestParameterName();
+    String getRequestParameterName();
 
     /**
      * @deprecated getWidget got removed, use lookupWidget or getChild instead.
      * @throws UnsupportedOperationException indicating this method has been 
      * deprecated from the API, and will be removed from future releases.  
      */
-    public Widget getWidget(String id);
+    Widget getWidget(String id);
 
     /**
      * Finds a widget relative to this one based on a path-like
@@ -150,14 +150,14 @@
      * @return the found widget or <code>null</code> if allong the traversal
      *   of the path an invalid section was encountered. 
      */
-    public Widget lookupWidget(String path);
+    Widget lookupWidget(String path);
 
     /**
      * Lets this widget read its data from a request. At this point the Widget
      * may try to convert the request parameter to its native datatype (if it
      * is not a string), but it should not yet generate any validation errors.
      */
-    public void readFromRequest(FormContext formContext);
+    void readFromRequest(FormContext formContext);
 
     /**
      * Validates this widget and returns the outcome. Possible error messages are
@@ -167,24 +167,34 @@
      * @return <code>true</code> to indicate all validations were ok, 
      *         <code>false</code> otherwise
      */
-    public boolean validate();
+    boolean validate();
 
-    public void addValidator(WidgetValidator validator);
+    void addValidator(WidgetValidator validator);
 
-    public boolean removeValidator(WidgetValidator validator);
+    boolean removeValidator(WidgetValidator validator);
+
+    /**
+     * Return the current validation state.
+     * This method delivers the same result as the last call to {@link #validate()}.
+     * The validation process is not started again. If the value of this widget has
+     * changed since the latest call to {@link #validate()}, the result of this method
+     * is out of date.
+     * @return The result of the last call to {@link #validate()}.
+     */
+    boolean isValid();
 
     /**
      * Generates an XML representation of this widget. The startDocument and endDocument
      * SAX events will not be called. It is assumed that the prefix for the CForms namespace
      * mentioned in Constants.FI_PREFIX is already declared (by the caller or otherwise).
      */
-    public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws
SAXException;
+    void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException;
 
     /**
      * Generates SAX events for the label of this widget. The label will not be wrapped
      * inside another element.
      */
-    public void generateLabel(ContentHandler contentHandler) throws SAXException;
+    void generateLabel(ContentHandler contentHandler) throws SAXException;
 
     /**
      * Get the value of a widget.
@@ -195,7 +205,7 @@
      * @return the value of the widget.
      * @throws UnsupportedOperationException if this widget doesn't have a value.
      */
-    public Object getValue() throws UnsupportedOperationException;
+    Object getValue() throws UnsupportedOperationException;
 
     /**
      * Sets the value of this widget.
@@ -206,37 +216,37 @@
      * @param value the new widget's value.
      * @throws UnsupportedOperationException if this widget doesn't have a value.
      */
-    public void setValue(Object value) throws UnsupportedOperationException;
+    void setValue(Object value) throws UnsupportedOperationException;
 
     /**
      * @return whether this widget is required to be filled in. As with {@link #getValue()},

      * for some widgets this may not make sense, those should return false here.
      */
-    public boolean isRequired();
+    boolean isRequired();
 
     /**
      * Broadcast an event previously queued by this widget to its event listeners.
      */
-    public void broadcastEvent(WidgetEvent event);
+    void broadcastEvent(WidgetEvent event);
 
     /**
-     * Retrieves an attribute on this widget
+     * Retrieves an attribute on this widget.
      * 
      * @param name of the attribute to lookup
      * @return the found attribute or <code>null</code> if none was found with
that name.
      */
-    public Object getAttribute(String name);
+    Object getAttribute(String name);
 
     /**
      * Sets an attribute on this widget. This can be used to store custom
      * data with each widget.
      */
-    public void setAttribute(String name, Object value);
+    void setAttribute(String name, Object value);
 
     /**
      * Removes the named attribute from this widget.
      * 
      * @param name of the attribute
      */
-    public void removeAttribute(String name);
+    void removeAttribute(String name);
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
Mon Jul 11 01:26:40 2005
@@ -31,30 +31,30 @@
     /**
      * Gets the {@link FormDefinition}.
      */
-    public FormDefinition getFormDefinition();
+    FormDefinition getFormDefinition();
 
     /**
-     * Sets the parent of this definition
+     * Sets the parent of this definition.
      */
-    public void setParent(WidgetDefinition definition);
+    void setParent(WidgetDefinition definition);
 
     /**
      * Gets source location of this widget definition.
      */
-    public String getLocation();
+    String getLocation();
 
     /**
      * Gets id of this widget definition.
      */
-    public String getId();
+    String getId();
     
     /**
-     * Gets an attribute that has been defined on the widget's definition
+     * Gets an attribute that has been defined on the widget's definition.
      * 
      * @param name the attribute name
      * @return the attribute value, or null if it doesn't exist
      */
-    public Object getAttribute(String name);
+    Object getAttribute(String name);
     
     /**
      * Validate a widget using the validators that were defined in its definition. If validation
@@ -63,26 +63,26 @@
      * @param widget the widget
      * @return <code>true</code> if validation was successful.
      */
-    public boolean validate(Widget widget);
+    boolean validate(Widget widget);
     
 
     /**
      * Creates and returns a widget based on this widget definition.
      */
-    public Widget createInstance();
+    Widget createInstance();
 
     /**
      * Generates SAX events for named display data.
      */
-    public void generateDisplayData(String name, ContentHandler contentHandler) throws SAXException;
+    void generateDisplayData(String name, ContentHandler contentHandler) throws SAXException;
 
     /**
      * Generates SAX events for display data.
      */
-    public void generateDisplayData(ContentHandler contentHandler) throws SAXException;
+    void generateDisplayData(ContentHandler contentHandler) throws SAXException;
 
     /**
      * Generates SAX events for the label of this widget.
      */
-    public void generateLabel(ContentHandler contentHandler) throws SAXException;
+    void generateLabel(ContentHandler contentHandler) throws SAXException;
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
Mon Jul 11 01:26:40 2005
@@ -30,6 +30,6 @@
  */
 public interface WidgetDefinitionBuilder {
 
-    public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception;
+    WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception;
 
 }

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=210086&r1=210085&r2=210086&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Jul 11 01:26:40 2005
@@ -196,6 +196,9 @@
 
   <changes>
   <release version="@version@" date="@date@">
+    <action dev="CZ" type="add">
+      CForms block: Add isValid() method to a Widget.
+    </action>     
     <action dev="VG" type="add" fixes-bug="29817" due-to="Patrick Herber" due-to-email="patrick@arpage.ch">
       POI Block: Added HSSFGenerator.
     </action>



Mime
View raw message