Author: gvanmatre
Date: Sat Sep 17 20:50:31 2005
New Revision: 289884

URL: http://svn.apache.org/viewcvs?rev=289884&view=rev
Log:
Optimized the loop for moving HTML attributes over the corresponding defined in 
the XML config files.  

Modified:
    
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java

Modified: 
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java
URL: 
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java?rev=289884&r1=289883&r2=289884&view=diff
==============================================================================
--- 
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java
 (original)
+++ 
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/parser/builder/Builder.java
 Sat Sep 17 20:50:31 2005
@@ -276,20 +276,23 @@
     /**
      * <p>
      * This method applies the HTML attribute overrides to the declarative
-     * component.
+     * component, an object representation of the XML configuration.
      * </p>
      */    
     protected void assignAttributes(Node node, ElementBean target) {
         // override with html attributes
        
-        Iterator ai = target.getAttributes().entrySet().iterator();
-        while (ai.hasNext()) {
-            Map.Entry e = (Map.Entry) ai.next();
-            AttributeBean attr = (AttributeBean) e.getValue();
-            if (!attr.getName().equals("jsfid") && 
node.getAttributes().containsKey(attr.getName())) {
-                String value = (String) 
node.getAttributes().get(attr.getName());
-                if (value != null) 
-                   createAttribute(attr.getName(), value, target);
+        Iterator ai = node.getAttributes().keySet().iterator();
+        next: while (ai.hasNext()) {
+            String key = (String) ai.next(); 
+           
+            if (key.equals("jsfid"))
+               continue next;
+            
+            if (target.getAttributes().containsKey(key)) {
+                String value = null;
+                if ((value = (String) node.getAttributes().get(key)) != null) 
+                   createAttribute(key, value, target);
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to