incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r516496 - in /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: renderkit/core/xhtml/OutputUtils.java skin/SkinStyleSheetParserUtils.java
Date Fri, 09 Mar 2007 18:31:43 GMT
Author: jwaldman
Date: Fri Mar  9 10:31:42 2007
New Revision: 516496

URL: http://svn.apache.org/viewvc?view=rev&rev=516496
Log:
fixes for ADFFaces-404 & ADFFaces-403

http://issues.apache.org/jira/browse/ADFFACES-404
absolute urls do not work in skinning
Fixed in SkinStyleSheetParserUtils.java

http://issues.apache.org/jira/browse/ADFFACES-403
need new method outputUtils.renderImage that takes a style class
Fixed in OutputUtils.java

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java?view=diff&rev=516496&r1=516495&r2=516496
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
Fri Mar  9 10:31:42 2007
@@ -312,7 +312,7 @@
     ) throws IOException
   {
     renderImage(context, arc, absoluteUri,
-                width, height, id, altText, comp, null);
+                width, height, id, altText, comp, null, null);
   }
 
   static public void renderImage(
@@ -327,6 +327,23 @@
     String           inlineStyle
     ) throws IOException
   {
+    renderImage(context, arc, absoluteUri,
+                width, height, id, altText, comp, inlineStyle, null);
+  }
+    
+  static public void renderImage(
+    FacesContext     context,
+    RenderingContext arc,
+    Object           absoluteUri,
+    Object           width,
+    Object           height,
+    Object           id,
+    Object           altText,
+    UIComponent      comp,
+    String           inlineStyle,
+    String           styleClass
+    ) throws IOException
+  {
     if (absoluteUri == null)
       return;
 
@@ -354,6 +371,11 @@
     if (inlineStyle != null)
     {
       writer.writeAttribute("style", inlineStyle, null);
+    }
+    
+    if (styleClass != null)
+    {
+      writer.writeAttribute("class", styleClass, null);
     }
 
     writer.endElement("img");

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=516496&r1=516495&r2=516496
==============================================================================
--- 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
Fri Mar  9 10:31:42 2007
@@ -137,13 +137,15 @@
    * */
   public static String trimQuotes(String in)
   {
+    int length = in.length();
+    if (length <= 1)
+      return in;
     // strip off the starting/ending quotes if there are any
     char firstChar = in.charAt(0);
     int firstCharIndex = 0;
     if ((firstChar == '\'') || (firstChar == '"'))
       firstCharIndex = 1;
 
-    int length = in.length();
     char lastChar = in.charAt(length-1);
     if ((lastChar == '\'') || (lastChar == '"'))
       length--;
@@ -447,7 +449,11 @@
     int endIndex = -1;
     int index = url.indexOf("url(");
     StringBuilder builder = new StringBuilder();
-    builder.append(url, 0 , index);
+    // this loops takes care of the usecase where there can be more than
+    // one url, like this: 
+    // background-image: url("/skins/purple/images/btns.gif"), 
+    // url("/skins/purple/images/checkdn.gif");
+
     while(index >= 0)
     {
       // Appends values before url()
@@ -526,6 +532,12 @@
         // relative values will be resolved relative to the
         // generated style sheet, not the source CSS file.
         builder.append(_getAbsoluteURLValue(baseUrl, uri, sourceName, selectorName));
+      }
+      else if (uri.startsWith("http:"))
+      {
+        builder.append("url(");
+        builder.append(uri);
+        builder.append(')');
       }
       
       index = url.indexOf("url(", endIndex);



Mime
View raw message