click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r965033 - in /click/trunk/click: extras/src/org/apache/click/extras/control/ framework/src/org/apache/click/control/ framework/src/org/apache/click/element/
Date Sat, 17 Jul 2010 08:49:07 GMT
Author: sabob
Date: Sat Jul 17 08:49:06 2010
New Revision: 965033

URL: http://svn.apache.org/viewvc?rev=965033&view=rev
Log:
fixed concurrentModificationExceptions when rendering controls and elements. CLK-712

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
    click/trunk/click/framework/src/org/apache/click/control/FieldSet.java
    click/trunk/click/framework/src/org/apache/click/control/Form.java
    click/trunk/click/framework/src/org/apache/click/element/CssImport.java
    click/trunk/click/framework/src/org/apache/click/element/JsImport.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java?rev=965033&r1=965032&r2=965033&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java Sat Jul 17
08:49:06 2010
@@ -837,14 +837,10 @@ public class PickList extends Field {
         HtmlStringBuffer attributesBuffer = new HtmlStringBuffer();
 
         // Add the CSS class 'picklist' to buffer
-        String cssClass = null;
         if (hasAttribute("class")) {
-            cssClass = getAttribute("class");
+            String cssClass = getAttribute("class");
             attributesBuffer.append("class=\"");
             if (cssClass != null) {
-                // If class attribute exists, temporarily remove it
-                setAttribute("class", null);
-
                 attributesBuffer.append(cssClass).append(" ");
             }
             attributesBuffer.append("picklist\"");
@@ -853,12 +849,13 @@ public class PickList extends Field {
         }
 
         if (hasAttributes()) {
-            attributesBuffer.appendAttributes(getAttributes());
-        }
-
-        // Restore class attribute
-        if (cssClass != null) {
-            setAttribute("class", cssClass);
+            Map<String, String> localAttributes = getAttributes();
+            for (String attrName : localAttributes.keySet()) {
+                if (!attrName.equals("id") && !attrName.equals("class")) {
+                    Object attrValue = localAttributes.get(attrName);
+                    attributesBuffer.appendAttributeEscaped(attrName, attrValue);
+                }
+            }
         }
 
         Map<String, Object> model = new HashMap<String, Object>();

Modified: click/trunk/click/framework/src/org/apache/click/control/FieldSet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/FieldSet.java?rev=965033&r1=965032&r2=965033&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/FieldSet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/FieldSet.java Sat Jul 17 08:49:06
2010
@@ -1052,17 +1052,12 @@ public class FieldSet extends Field impl
                     }
 
                     if (label.hasAttributes()) {
-                        //Temporarily remove the style attribute
-                        String tempStyle = null;
-                        if (label.hasAttribute("style")) {
-                            tempStyle = label.getAttribute("style");
-                            label.setAttribute("style", null);
-                        }
-                        buffer.appendAttributes(label.getAttributes());
-
-                        //Put style back in attribute map
-                        if (tempStyle != null) {
-                            label.setAttribute("style", tempStyle);
+                        Map<String, String> labelAttributes = label.getAttributes();
+                        for (String labelAttrName : labelAttributes.keySet()) {
+                            if (!labelAttrName.equals("id") && !labelAttrName.equals("style"))
{
+                                Object labelAttrValue = labelAttributes.get(labelAttrName);
+                                buffer.appendAttributeEscaped(labelAttrName, labelAttrValue);
+                            }
                         }
                     }
                     buffer.append(">");

Modified: click/trunk/click/framework/src/org/apache/click/control/Form.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Form.java?rev=965033&r1=965032&r2=965033&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Form.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Form.java Sat Jul 17 08:49:06
2010
@@ -2509,17 +2509,12 @@ public class Form extends AbstractContai
                     }
 
                     if (label.hasAttributes()) {
-                        //Temporarily remove the style attribute
-                        String tempStyle = null;
-                        if (label.hasAttribute("style")) {
-                            tempStyle = label.getAttribute("style");
-                            label.setAttribute("style", null);
-                        }
-                        buffer.appendAttributes(label.getAttributes());
-
-                        //Put style back in attribute map
-                        if (tempStyle != null) {
-                            label.setAttribute("style", tempStyle);
+                        Map<String, String> labelAttributes = label.getAttributes();
+                        for (String labelAttrName : labelAttributes.keySet()) {
+                            if (!labelAttrName.equals("id") && !labelAttrName.equals("style"))
{
+                                Object labelAttrValue = labelAttributes.get(labelAttrName);
+                                buffer.appendAttributeEscaped(labelAttrName, labelAttrValue);
+                            }
                         }
                     }
                     buffer.append(">");

Modified: click/trunk/click/framework/src/org/apache/click/element/CssImport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/CssImport.java?rev=965033&r1=965032&r2=965033&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/CssImport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/CssImport.java Sat Jul 17 08:49:06
2010
@@ -18,6 +18,7 @@
  */
 package org.apache.click.element;
 
+import java.util.Map;
 import org.apache.click.Context;
 import org.apache.click.util.ClickUtils;
 import org.apache.click.util.HtmlStringBuffer;
@@ -216,13 +217,13 @@ public class CssImport extends ResourceE
         String href = getHref();
         renderResourcePath(buffer, "href", href);
 
-        // Temporarily remove href attribute while other attributes are rendered
-        setAttribute("href", null);
-
-        appendAttributes(buffer);
-
-        // Restore href attribute
-        setAttribute("href", href);
+        Map<String, String> localAttributes = getAttributes();
+        for (String name : localAttributes.keySet()) {
+            if (!name.equals("id") && !name.equals("href")) {
+                Object value = localAttributes.get(name);
+                buffer.appendAttributeEscaped(name, value);
+            }
+        }
 
         buffer.elementEnd();
 

Modified: click/trunk/click/framework/src/org/apache/click/element/JsImport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/JsImport.java?rev=965033&r1=965032&r2=965033&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/JsImport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/JsImport.java Sat Jul 17 08:49:06
2010
@@ -18,6 +18,7 @@
  */
 package org.apache.click.element;
 
+import java.util.Map;
 import org.apache.click.Context;
 import org.apache.click.util.ClickUtils;
 import org.apache.click.util.HtmlStringBuffer;
@@ -215,13 +216,13 @@ public class JsImport extends ResourceEl
         String src = getSrc();
         renderResourcePath(buffer, "src", src);
 
-        // Temporarily remove src attribute while other attributes are rendered
-        setAttribute("src", null);
-
-        appendAttributes(buffer);
-
-        // Restore src attribute
-        setAttribute("src", src);
+        Map<String, String> localAttributes = getAttributes();
+        for (String name : localAttributes.keySet()) {
+            if (!name.equals("id") && !name.equals("src")) {
+                Object value = localAttributes.get(name);
+                buffer.appendAttributeEscaped(name, value);
+            }
+        }
 
         buffer.closeTag();
 



Mime
View raw message