You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/11/01 14:58:48 UTC

svn commit: r1196000 - in /myfaces/tobago/trunk/tobago-theme: tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/st...

Author: lofwyr
Date: Tue Nov  1 13:58:48 2011
New Revision: 1196000

URL: http://svn.apache.org/viewvc?rev=1196000&view=rev
Log:
TOBAGO-377: Tree
 - fix custom image icons

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java?rev=1196000&r1=1195999&r2=1196000&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIconRenderer.java Tue Nov  1 13:58:48 2011
@@ -65,7 +65,7 @@ public class TreeIconRenderer extends La
     if (folder) {
       if (imageUrl != null) { // application image
         openSource = ResourceManagerUtils.getImageWithPath(facesContext,
-            ResourceUtils.addPostfixToFilename(imageUrl, "open"), true);
+            ResourceUtils.addPostfixToFilename(imageUrl, "-open"), true);
       } else { // theme image
         openSource = ResourceManagerUtils.getImageWithPath(facesContext, OPEN_FOLDER);
       }
@@ -74,13 +74,16 @@ public class TreeIconRenderer extends La
       openSource = null;
       if (imageUrl != null) { // application image
         source = ResourceManagerUtils.getImageWithPath(facesContext,
-            ResourceUtils.addPostfixToFilename(imageUrl, "leaf"), true);
+            ResourceUtils.addPostfixToFilename(imageUrl, "-leaf"), true);
       } else { // theme image
         source = ResourceManagerUtils.getImageWithPath(facesContext, LEAF);
       }
-      if (source == null) {
-        source = closedSource;
-      }
+    }
+    if (source == null) {
+      source = closedSource;
+    }
+    if (source == null) {
+      source = openSource;
     }
 
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1196000&r1=1195999&r2=1196000&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Tue Nov  1 13:58:48 2011
@@ -3144,6 +3144,7 @@ Tobago.TabGroup.ensureScrollPosition = f
 Tobago.Tree = {};
 
 Tobago.Tree.toggleNode = function(element) {
+  var src;
   var node = element.closest(".tobago-treeNode, .tobago-treeMenuNode");
   var content = jQuery(Tobago.Utils.escapeClientId(node.attr("id") + Tobago.SUB_COMPONENT_SEP + "content"));
   var expanded = node.find(".tobago-treeMenuNode-expanded, .tobago-treeNode-expanded");
@@ -3151,7 +3152,11 @@ Tobago.Tree.toggleNode = function(elemen
   if (content.css("display") == "none") {
     content.css("display", "block");
     toggle.each(function() {
-      jQuery(this).attr("src", jQuery(this).data("tobago-srcopen"));
+      src = jQuery(this).data("tobago-srcopen");
+      if (src == null) { // use the close icon if there is no open icon
+        src = jQuery(this).data("tobago-srcclose");
+      }
+      jQuery(this).attr("src", src);
       Tobago.fixPngAlpha(this);
     });
     expanded.attr("value", "true");
@@ -3160,7 +3165,11 @@ Tobago.Tree.toggleNode = function(elemen
   } else {
     content.css("display", "none");
     toggle.each(function() {
-      jQuery(this).attr("src", jQuery(this).attr("tobago-srcclose"));
+      src = jQuery(this).data("tobago-srcclose");
+      if (src == null) { // use the open icon if there is no close icon
+        src = jQuery(this).data("tobago-srcopen");
+      }
+      jQuery(this).attr("src", src);
       Tobago.fixPngAlpha(this);
     });
     expanded.attr("value", "false");