You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/02/20 09:51:51 UTC

svn commit: r509466 - in /myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag: ButtonRenderer.java LinkRenderer.java

Author: bommel
Date: Tue Feb 20 00:51:51 2007
New Revision: 509466

URL: http://svn.apache.org/viewvc?view=rev&rev=509466
Log:
(TOBAGO-293) Image of Link and Button should support external Images and absolute Images like the Image tag

Modified:
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java?view=diff&rev=509466&r1=509465&r2=509466
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java Tue Feb 20 00:51:51 2007
@@ -86,11 +86,17 @@
     String imageName = (String) component.getAttributes().get(ATTR_IMAGE);
     if (imageName != null) {
       String image = null;
-      if (disabled) {
-        image = ResourceManagerUtil.getDisabledImageWithPath(facesContext, imageName);
-      }
-      if (image == null) {
-        image = ResourceManagerUtil.getImageWithPath(facesContext, imageName);
+      if (imageName.startsWith("HTTP:") || imageName.startsWith("FTP:")
+                || imageName.startsWith("/")) {
+        image = imageName;
+        // absolute Path to image : nothing to do
+      } else {
+        if (disabled) {
+          image = ResourceManagerUtil.getDisabledImageWithPath(facesContext, imageName);
+        }
+        if (image == null) {
+          image = ResourceManagerUtil.getImageWithPath(facesContext, imageName);
+        }
       }
       writer.startElement(HtmlConstants.IMG, null);
       writer.writeAttribute(HtmlAttributes.SRC, image, null);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java?view=diff&rev=509466&r1=509465&r2=509466
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LinkRenderer.java Tue Feb 20 00:51:51 2007
@@ -131,7 +131,12 @@
 //  image
     String image = (String) component.getAttributes().get(ATTR_IMAGE);
     if (image != null) {
-      image = ResourceManagerUtil.getImageWithPath(facesContext, image);
+      if (image.startsWith("HTTP:") || image.startsWith("FTP:")
+                || image.startsWith("/")) {
+        // absolute Path to image : nothing to do
+      } else {
+        image = ResourceManagerUtil.getImageWithPath(facesContext, image);
+      }
       writer.startElement(HtmlConstants.IMG, null);
       writer.writeAttribute(HtmlAttributes.SRC, image, null);
       writer.writeAttribute(HtmlAttributes.ALT, "", null);