incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r475931 - in /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin: SkinStyleSheetParserUtils.java icon/BaseImageIcon.java
Date Thu, 16 Nov 2006 21:18:09 GMT
Author: jwaldman
Date: Thu Nov 16 13:18:08 2006
New Revision: 475931

URL: http://svn.apache.org/viewvc?view=rev&rev=475931
Log:
don't create a CSSStyle object if we don't have to.
Don't render style on an image if the string is empty.

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java?view=diff&rev=475931&r1=475930&r2=475931
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
Thu Nov 16 13:18:08 2006
@@ -586,7 +586,7 @@
     boolean createStyleNode = false;
     // append all the styles that are not content, width or height into
     // inline style
-    CSSStyle inlineStyle = new CSSStyle();
+    CSSStyle inlineStyle = null;
 
     for(PropertyNode propertyNode : noTrPropertyNodeList)
     {
@@ -626,6 +626,7 @@
       else
       {
         // create an inlineStyle with all the extraneous style properties
+        inlineStyle = new CSSStyle();
         inlineStyle.setProperty(propertyName, propertyValue);
       }
 
@@ -641,6 +642,8 @@
         // don't allow styleClass from the css parsing file. We can handle
         // this when we have style includes
         // put back the width/height properties if there were some
+        if (heightValue != null || widthValue != null)
+          inlineStyle = new CSSStyle();
         if (heightValue != null)
          inlineStyle.setProperty("height", heightValue);
         if (widthValue != null)
@@ -690,10 +693,9 @@
       }
       else
       {
-        /// neither text or image icon. Must be a StyleClassIcon
+        /// neither text or image icon.
         if (inlineStyle != null)
         {
-         // icon = new StyleClassIcon(selectorName);
          // create a styleNode, too with the inlineStyles.
          createStyleNode = true;
         }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java?view=diff&rev=475931&r1=475930&r2=475931
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java
Thu Nov 16 13:18:08 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright  2003-2006 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.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -185,7 +185,7 @@
     }
     else if (attrs != null)
     {
-      styleClass = (String) attrs.get(Icon.STYLE_CLASS_KEY);    
+      styleClass = (String) attrs.get(Icon.STYLE_CLASS_KEY);
 
     }
 
@@ -195,14 +195,18 @@
     // to at least make sure it is valid.
     if (styleClass != null)
     {
-      String convertedStyleClass = 
+      String convertedStyleClass =
         StyleUtils.convertToValidSelector(arc.getStyleClass(styleClass));
-  
+
       writer.writeAttribute("class", convertedStyleClass, null);
     }
 
     if (_inlineStyle != null)
-      writer.writeAttribute("style", _inlineStyle.toInlineString(), null);
+    {
+      String inlineStyleString = _inlineStyle.toInlineString();
+      if (!("".equals(inlineStyleString)))
+        writer.writeAttribute("style", inlineStyleString, null);
+    }
 
     // Write out alt/title attrs
     Object altText = _getAltText(attrs);
@@ -327,7 +331,7 @@
       // need to set the img align attribute in order to force
       // an icon to line up with its associated text.
       Object align = attrs.get(Icon.ALIGN_KEY);
-      
+
       if (align != null)
       {
         // absmiddle isn't actually a valid alignment value according
@@ -336,7 +340,7 @@
         // seem to have the desired results in all cases.  In particular,
         // when we switch from absmiddle to vertical-align:middle, the
         // dateField's button drops down by two pixels.
-        
+
         writer.writeAttribute("align", align, null);
       }
     }



Mime
View raw message