cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r642868 - in /cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src: changes/changes.xml main/java/org/apache/cocoon/forms/formmodel/tree/Tree.java
Date Mon, 31 Mar 2008 03:49:28 GMT
Author: joerg
Date: Sun Mar 30 20:49:27 2008
New Revision: 642868

URL: http://svn.apache.org/viewvc?rev=642868&view=rev
Log:
COCOON-2178: Forms: Dispatch only one TreeSelectionEvent on multiple selection rather than
one event for each selected tree item.

Modified:
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/Tree.java

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml?rev=642868&r1=642867&r2=642868&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml Sun Mar 30
20:49:27 2008
@@ -30,7 +30,10 @@
       </action>
     </release>
     <release version="1.0.0" date="2008-??-??" description="unreleased">
-      <action dev="JH" type="fix" fixes-bug="COCOON-2058" due-to="Ralph Collett" due-to-email="ralph.collett@semantico.com">
+      <action dev="joerg" type="fix" fixes-bug="COCOON-2178" due-to="Harald Entner" due-to-email="harald.entner@workflow.at">
+        Dispatch only one TreeSelectionEvent on multiple selection rather than one event
for each selected tree item.
+      </action>
+      <action dev="joerg" type="fix" fixes-bug="COCOON-2058" due-to="Ralph Collett" due-to-email="ralph.collett@semantico.com">
         Fix ambiguous rule issue with Forms stylesheets when using Saxon.
       </action>
       <action dev="vgritsenko" type="fix">

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/Tree.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/Tree.java?rev=642868&r1=642867&r2=642868&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/Tree.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/Tree.java
Sun Mar 30 20:49:27 2008
@@ -16,9 +16,11 @@
  */
 package org.apache.cocoon.forms.formmodel.tree;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 
@@ -198,6 +200,11 @@
         getForm().addWidgetUpdate(this);
     }
 
+    private void markForRefresh(List paths) {
+        this.changedPaths.addAll(paths);
+        getForm().addWidgetUpdate(this);
+    }
+
     //---------------------------------------------------------------------------------------------
     // Selection
     //---------------------------------------------------------------------------------------------
@@ -269,11 +276,15 @@
         if (this.selectionModel == SINGLE_SELECTION) {
             setSelectionPath(paths[0]);
         } else {
-            for (int i = 0; i < paths.length; i++) {
-                addSelectionPath(paths[i]);
-                // FIXME: use array-based constructors of TreeSelectionEvent
+            List pathsList = Arrays.asList(paths);
+            if (this.selectedPaths.addAll(pathsList)) {
+                markForRefresh(pathsList);
+                if (this.expandSelectedPath) {
+                    this.expandedPaths.addAll(pathsList);
+                }
+                this.getForm().addWidgetEvent(new TreeSelectionEvent(this, paths, true));
             }
-        }
+        }       
     }
 
     public void removeSelectionPath(TreePath path) {
@@ -285,9 +296,10 @@
     }
 
     public void removeSelectionPaths(TreePath paths[]) {
-        for (int i = 0; i < paths.length; i++) {
-            removeSelectionPath(paths[i]);
-            // FIXME: use array-based constructors of TreeSelectionEvent
+        List pathsList = Arrays.asList(paths);
+        if (this.selectedPaths.removeAll(pathsList)) {
+            markForRefresh(pathsList);
+            this.getForm().addWidgetEvent(new TreeSelectionEvent(this, paths, false));
         }
     }
 



Mime
View raw message