cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r328140 - in /cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel: BooleanField.java Field.java Output.java Upload.java
Date Mon, 24 Oct 2005 19:23:01 GMT
Author: sylvain
Date: Mon Oct 24 12:22:55 2005
New Revision: 328140

URL: http://svn.apache.org/viewcvs?rev=328140&view=rev
Log:
Bugfix: don't count the FormHandler as an event listener, otherwise all fields are auto-submitted
when there is one

Modified:
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java?rev=328140&r1=328139&r2=328140&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/BooleanField.java Mon
Oct 24 12:22:55 2005
@@ -161,7 +161,7 @@
         value = (Boolean)object;
         if (!value.equals(oldValue)) {
             Form form = getForm();
-            if (hasValueChangedListeners()) {
+            if (hasValueChangedListeners() || this.getForm().hasFormHandler()) {
                 form.addWidgetEvent(new ValueChangedEvent(this, oldValue, value));
             }
             form.addWidgetUpdate(this);
@@ -182,7 +182,7 @@
     }
     
     public boolean hasValueChangedListeners() {
-        return this.listener != null || this.getForm().hasFormHandler();
+        return this.listener != null;
     }
 
     public void broadcastEvent(WidgetEvent event) {

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java?rev=328140&r1=328139&r2=328140&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Field.java Mon Oct 24
12:22:55 2005
@@ -191,7 +191,7 @@
         // (null allows to reset validation error)
         if (changed || newValue == null) {
             // Do we need to call listeners? If yes, keep (and parse if needed) old value.
-            boolean callListeners = changed && hasValueChangedListeners();
+            boolean callListeners = changed && (hasValueChangedListeners() || this.getForm().hasFormHandler());
             Object oldValue = callListeners ? getValue() : null;
 
             this.value = newValue;
@@ -251,7 +251,7 @@
 
             // If we have some value-changed listeners, we must make sure the current value
has been
             // parsed, to fill the event. Otherwise, we don't need to spend that extra CPU
time.
-            boolean hasListeners = hasValueChangedListeners();
+            boolean hasListeners = hasValueChangedListeners() || this.getForm().hasFormHandler();
             Object oldValue = hasListeners ? getValue() : null;
 
             enteredValue = newEnteredValue;
@@ -526,7 +526,7 @@
     }
 
     public boolean hasValueChangedListeners() {
-        return this.listener != null || this.getForm().hasFormHandler();
+        return this.listener != null;
     }
 
     public void broadcastEvent(WidgetEvent event) {

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java?rev=328140&r1=328139&r2=328140&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Output.java Mon Oct 24
12:22:55 2005
@@ -118,7 +118,7 @@
         if (!ObjectUtils.equals(value, object)) {
             Object oldValue = value;
             value = object;
-            if (this.hasValueChangedListeners()) {
+            if (this.hasValueChangedListeners() || this.getForm().hasFormHandler()) {
                 getForm().addWidgetEvent(new ValueChangedEvent(this, oldValue, value));
             }
             getForm().addWidgetUpdate(this);
@@ -134,7 +134,7 @@
     }
 
     public boolean hasValueChangedListeners() {
-        return this.listener != null || this.getForm().hasFormHandler();
+        return this.listener != null;
     }
 
     public void broadcastEvent(WidgetEvent event) {

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java?rev=328140&r1=328139&r2=328140&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/formmodel/Upload.java Mon Oct 24
12:22:55 2005
@@ -136,7 +136,7 @@
     }
     
     private void changed() {
-        if (this.hasValueChangedListeners()) {
+        if (this.hasValueChangedListeners() || this.getForm().hasFormHandler()) {
             this.getForm().addWidgetEvent(new ValueChangedEvent(this, null, this.part));
         }
         getForm().addWidgetUpdate(this);
@@ -235,7 +235,7 @@
     }
     
     public boolean hasValueChangedListeners() {
-        return this.listener != null || this.getForm().hasFormHandler();
+        return this.listener != null;
     }
 
     public void broadcastEvent(WidgetEvent event) {



Mime
View raw message