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 2017/03/23 14:01:18 UTC

svn commit: r1788245 - in /myfaces/tobago/branches/TOBAGO-1719: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/ tobago-core/src/main/resources/scss/ ...

Author: lofwyr
Date: Thu Mar 23 14:01:18 2017
New Revision: 1788245

URL: http://svn.apache.org/viewvc?rev=1788245&view=rev
Log:
Merged from trunk
TOBAGO-1726: Tree icons from <tc:treeIndent> are not toggled correctly.
* cleanup [from revision 1788196]
TOBAGO-1726: Tree icons from <tc:treeIndent> are not toggled correctly.
* cleanup [from revision 1788214]
TOBAGO-1726: Tree icons from <tc:treeIndent> are not toggled correctly.
* cleanup [from revision 1788215]
TOBAGO-1726: Tree icons from <tc:treeIndent> are not toggled correctly.
* implementing the toggle for icons (font awesome) [from revision 1788239]

Added:
    myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/image/feather-closed.png
      - copied unchanged from r1788239, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/image/feather-closed.png
Removed:
    myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/image/feather.png
Modified:
    myfaces/tobago/branches/TOBAGO-1719/   (props changed)
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIconRenderer.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/IconEncoder.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/resources/scss/_tobago.scss   (contents, props changed)
    myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml   (contents, props changed)
    myfaces/tobago/branches/TOBAGO-1719/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-tree.js

Propchange: myfaces/tobago/branches/TOBAGO-1719/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 23 14:01:18 2017
@@ -1,4 +1,4 @@
 /myfaces/tobago/branches/tobago-1.5.x:1356585,1357124
 /myfaces/tobago/branches/tobago-3.0.x:1781306,1781310,1781380
 /myfaces/tobago/branches/tobago-tree-table:1226794-1341423
-/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1656507,1657180,1657269,1657276,1657279,1658343,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665486,1665521,1665549,1665569-1665570,1666464,1667304,1667306-1667307,1667309,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636,1676030,1676035,1676038,1679031,1680197,1681981,1682187,1682448,1682545,1682548,1683231,1683306,1683373,1683664
 ,1686204,1687354,1693426,1696720,1698292,1698297,1700742,1700795,1701249,1701251,1701256,1701980,1709006,1725894,1726691,1726986,1727161,1731050-1731051,1731054,1731057,1731218-1731219,1787403,1787422,1787443,1787651,1787780,1787926,1788112,1788115,1788125
+/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1656507,1657180,1657269,1657276,1657279,1658343,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665486,1665521,1665549,1665569-1665570,1666464,1667304,1667306-1667307,1667309,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636,1676030,1676035,1676038,1679031,1680197,1681981,1682187,1682448,1682545,1682548,1683231,1683306,1683373,1683664
 ,1686204,1687354,1693426,1696720,1698292,1698297,1700742,1700795,1701249,1701251,1701256,1701980,1709006,1725894,1726691,1726986,1727161,1731050-1731051,1731054,1731057,1731218-1731219,1787403,1787422,1787443,1787651,1787780,1787926,1788112,1788115,1788125,1788196,1788214-1788215,1788239

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIconRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIconRenderer.java?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIconRenderer.java (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIconRenderer.java Thu Mar 23 14:01:18 2017
@@ -21,13 +21,12 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.component.UITreeIcon;
 import org.apache.myfaces.tobago.component.UITreeNode;
-import org.apache.myfaces.tobago.context.Markup;
 import org.apache.myfaces.tobago.internal.component.AbstractUIData;
 import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.css.FontAwesomeIconEncoder;
+import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -40,8 +39,20 @@ import java.io.IOException;
 
 public class TreeIconRenderer extends RendererBase {
 
+  /**
+   * @deprecated since Tobago 3.0.0
+   */
+  @Deprecated
   protected static final String OPEN_FOLDER = "image/treeNode-icon-open";
+  /**
+   * @deprecated since Tobago 3.0.0
+   */
+  @Deprecated
   protected static final String CLOSED_FOLDER = "image/treeNode-icon";
+  /**
+   * @deprecated since Tobago 3.0.0
+   */
+  @Deprecated
   protected static final String LEAF = "image/treeNode-icon-leaf";
 
   @Override
@@ -53,10 +64,18 @@ public class TreeIconRenderer extends Re
     final boolean folder = node.isFolder();
     final boolean expanded = folder && data.getExpandedState().isExpanded(node.getPath());
 
-    String value = (String) image.getValue();
+    final String value = (String) image.getValue();
     String closed = image.getClosed();
     String open = image.getOpen();
 
+    if (closed == null) {
+      closed = value;
+    }
+
+    if (open == null) {
+      open = closed;
+    }
+
     final String source;
     if (folder) {
       if (expanded) {
@@ -70,11 +89,21 @@ public class TreeIconRenderer extends Re
 
     final TobagoResponseWriter writer = getResponseWriter(facesContext);
 
+    writer.startElement(HtmlElements.SPAN);
+    writer.writeIdAttribute(image.getClientId());
+    writer.writeClassAttribute(TobagoClass.TREE_NODE__TOGGLE);
+
     if (StringUtils.startsWith(source, "fa-")) {
-      writer.writeIcon(null, image.getStyle(), FontAwesomeIconEncoder.generateClass(source));
+      writer.startElement(HtmlElements.I);
+      writer.writeStyleAttribute(image.getStyle());
+      writer.writeClassAttribute(FontAwesomeIconEncoder.FA, FontAwesomeIconEncoder.generateClass(source));
+      if (folder) {
+        writer.writeAttribute(DataAttributes.SRC_OPEN, open, true);
+        writer.writeAttribute(DataAttributes.SRC_CLOSED, closed, true);
+      }
+      writer.endElement(HtmlElements.I);
     } else {
       writer.startElement(HtmlElements.IMG);
-      writer.writeClassAttribute(Classes.create(node, "toggle", Markup.NULL));
       HtmlRendererUtils.writeDataAttributes(facesContext, writer, image);
       writer.writeAttribute(HtmlAttributes.SRC, source, true);
       if (folder) {
@@ -84,5 +113,7 @@ public class TreeIconRenderer extends Re
       writer.writeAttribute(HtmlAttributes.ALT, "", false);
       writer.endElement(HtmlElements.IMG);
     }
+
+    writer.endElement(HtmlElements.SPAN);
   }
 }

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java Thu Mar 23 14:01:18 2017
@@ -21,14 +21,15 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.component.UITree;
 import org.apache.myfaces.tobago.component.UITreeIndent;
-import org.apache.myfaces.tobago.context.Markup;
 import org.apache.myfaces.tobago.internal.component.AbstractUIData;
 import org.apache.myfaces.tobago.internal.component.AbstractUITreeNodeBase;
 import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.css.FontAwesomeIconEncoder;
 import org.apache.myfaces.tobago.renderkit.css.Icons;
+import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -63,110 +64,34 @@ public class TreeIndentRenderer extends
     writer.startElement(HtmlElements.SPAN);
     writer.writeIdAttribute(indent.getClientId(facesContext));
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, indent);
-    writer.writeClassAttribute(Classes.create(node, "toggle", Markup.NULL));
-
-    encodeIndent(
-        facesContext, writer, node, showLines, showIcons, showRootJunction, showRoot, junctions);
-
-    encodeTreeJunction(
-        facesContext, writer, node, showLines, showIcons, showRootJunction, junctions, expanded, folder, level == 0);
-  }
-
-  @Override
-  public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
-    final TobagoResponseWriter writer = getResponseWriter(facesContext);
-    writer.endElement(HtmlElements.SPAN);
-  }
-
-  private void encodeIndent(
-      final FacesContext facesContext, final TobagoResponseWriter writer, final AbstractUITreeNodeBase node,
-      final boolean showLines, final boolean showIcons, final boolean showRootJunction, final boolean showRoot,
-      final List<Boolean> junctions)
-      throws IOException {
+    writer.writeClassAttribute(TobagoClass.TREE_NODE__TOGGLE);
 
+    // encode indent
     final boolean dropFirst = !showRoot || !showRootJunction && (showLines || showIcons);
-//    final String blank = ResourceManagerUtils.getImage(facesContext, "image/blank");
-//    final String perpendicular = ResourceManagerUtils.getImage(facesContext, "image/I");
-
     for (int i = dropFirst ? 1 : 0; i < junctions.size() - 1; i++) {
-      final Boolean junction = junctions.get(i);
-/*
-      writer.startElement(HtmlElements.IMG, null);
-      writer.writeClassAttribute(Classes.create(node, "junction"));
-      writer.writeAttribute(HtmlAttributes.alt, "", false);
-      if (junction && showLines) {
-        writer.writeAttribute("src", perpendicular, true);
-      } else {
-        writer.writeAttribute("src", blank, true);
-      }
-      writer.endElement(HtmlElements.IMG);
-*/
-      writer.writeIcon(Icons.SQUARE_O, BootstrapClass.INVISIBLE); // FIXME TOBAGO-1495
+      writer.writeIcon(Icons.SQUARE_O, BootstrapClass.INVISIBLE);
     }
-  }
 
-  private void encodeTreeJunction(
-      final FacesContext facesContext, final TobagoResponseWriter writer, final AbstractUITreeNodeBase node,
-      final boolean showLines, final boolean showIcons, final boolean showRootJunction, final List<Boolean> junctions,
-      final boolean expanded, final boolean folder, final boolean root)
-      throws IOException {
-    if (!showIcons || !showRootJunction && root) {
+    // encode tree junction
+    if (!showIcons || !showRootJunction && level == 0) {
       return;
     }
-    final boolean hasNextSibling = junctions.get(junctions.size() - 1); // last element
-
-    writer.writeIcon(folder ? expanded ? Icons.MINUS_SQUARE_O : Icons.PLUS_SQUARE_O : Icons.SQUARE_O);
-
-/*
-    writer.startElement(HtmlElements.IMG, null);
-    writer.writeClassAttribute(Classes.create(node, "toggle", Markup.NULL));
-
-    final String open;
-    final String close;
-    if (showLines) {
-      if (root) {
-        open = "Rminus";
-        close = "Rplus";
-      } else {
-        if (hasNextSibling) {
-          if (folder) {
-            open = "Tminus";
-            close = "Tplus";
-          } else {
-            open = "T";
-            close = "T";
-          }
-        } else {
-          if (folder) {
-            open = "Lminus";
-            close = "Lplus";
-          } else {
-            open = "L";
-            close = "L";
-          }
-        }
-      }
-    } else {
-      if (folder) {
-        open = "minus";
-        close = "plus";
-      } else {
-        open = "blank";
-        close = "blank";
-      }
-    }
-
-    final String srcOpen = ResourceManagerUtils.getImage(facesContext, "image/" + open);
-    final String srcClose = ResourceManagerUtils.getImage(facesContext, "image/" + close);
-    final String src = expanded ? srcOpen : srcClose;
-    writer.writeAttribute(HtmlAttributes.src, src, true);
+    final Icons icon = folder ? expanded ? Icons.MINUS_SQUARE_O : Icons.PLUS_SQUARE_O : Icons.SQUARE_O;
+    writer.startElement(HtmlElements.I);
+    writer.writeClassAttribute(FontAwesomeIconEncoder.FA, FontAwesomeIconEncoder.generateClass(icon));
     if (folder) {
-      writer.writeAttribute(DataAttributes.SRC_OPEN, srcOpen, true);
-      writer.writeAttribute(DataAttributes.SRC_CLOSED, srcClose, true);
+      writer.writeAttribute(
+          DataAttributes.SRC_OPEN, FontAwesomeIconEncoder.generateClass(Icons.MINUS_SQUARE_O).getName(), false);
+      writer.writeAttribute(
+          DataAttributes.SRC_CLOSED, FontAwesomeIconEncoder.generateClass(Icons.PLUS_SQUARE_O).getName(), false);
     }
-    writer.writeAttribute(HtmlAttributes.alt, "", false);
-    writer.endElement(HtmlElements.IMG);
-*/
+    writer.endElement(HtmlElements.I);
+  }
+
+  @Override
+  public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
+    final TobagoResponseWriter writer = getResponseWriter(facesContext);
+    writer.endElement(HtmlElements.SPAN);
   }
 
 }

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/FontAwesomeIconEncoder.java Thu Mar 23 14:01:18 2017
@@ -28,22 +28,25 @@ import java.io.IOException;
 import java.util.EnumMap;
 import java.util.regex.Pattern;
 
+/**
+ * @deprecated since Tobago 3.1.0. May be subject of change in later versions!
+ */
+@Deprecated
 public class FontAwesomeIconEncoder implements IconEncoder {
 
   private static final Logger LOG = LoggerFactory.getLogger(FontAwesomeIconEncoder.class);
 
-  private static final CssItem FA = new FontAwesomeCssItem("fa");
+  public static final CssItem FA = new FontAwesomeCssItem("fa");
 
   private static final Pattern PATTERN = Pattern.compile("^(fa(-[a-z]+)+)$");
 
 
-  private EnumMap<Icons, CssItem> icons;
+  private static final EnumMap<Icons, CssItem> ICONS;
 
-
-  public FontAwesomeIconEncoder() {
-    icons = new EnumMap<Icons, CssItem>(Icons.class);
+  static {
+    ICONS = new EnumMap<Icons, CssItem>(Icons.class);
     for (Icons icon : Icons.values()) {
-      icons.put(icon, new FontAwesomeCssItem("fa-" + icon.name().toLowerCase().replaceAll("_", "-")));
+      ICONS.put(icon, new FontAwesomeCssItem("fa-" + icon.name().toLowerCase().replaceAll("_", "-")));
     }
   }
 
@@ -56,11 +59,11 @@ public class FontAwesomeIconEncoder impl
     writer.endElement(HtmlElements.I);
   }
 
-  private CssItem generateClass(final Icons icon) {
+  public static CssItem generateClass(final Icons icon) {
     if (icon == null) {
       return null;
     }
-    CssItem result = icons.get(icon);
+    CssItem result = ICONS.get(icon);
     if (result == null) {
       LOG.warn("Missing icon: '" + icon + "'");
     }
@@ -73,8 +76,6 @@ public class FontAwesomeIconEncoder impl
 
       @Override
       public String getName() {
-        // XXX cleanup, should be resolved with the ResourceManager... ? TBD
-        // todo: regexp check
         if (PATTERN.matcher(name).matches()) {
           return name;
         } else {

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/IconEncoder.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/IconEncoder.java?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/IconEncoder.java (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/IconEncoder.java Thu Mar 23 14:01:18 2017
@@ -23,6 +23,10 @@ import org.apache.myfaces.tobago.webapp.
 
 import java.io.IOException;
 
+/**
+ * @deprecated since Tobago 3.1.0. May be subject of change in later versions!
+ */
+@Deprecated
 public interface IconEncoder {
 
   void encode(TobagoResponseWriter writer, Icons icon, Style style, final CssItem... cssItems) throws IOException;

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/TobagoClass.java Thu Mar 23 14:01:18 2017
@@ -89,7 +89,8 @@ public enum TobagoClass implements CssIt
   SHEET__CELL__MARKUP__RIGHT("tobago-sheet-cell-markup-right"),
   SHEET__CELL__MARKUP__CENTER("tobago-sheet-cell-markup-center"),
   SHEET__CELL__MARKUP__JUSTIFY("tobago-sheet-cell-markup-justify"),
-  SUGGEST("tobago-suggest");
+  SUGGEST("tobago-suggest"),
+  TREE_NODE__TOGGLE("tobago-treeNode-toggle");
 
   private static final Logger LOG = LoggerFactory.getLogger(TobagoClass.class);
 

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/resources/scss/_tobago.scss
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/resources/scss/_tobago.scss?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/resources/scss/_tobago.scss (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/resources/scss/_tobago.scss Thu Mar 23 14:01:18 2017
@@ -32,6 +32,10 @@ Todo: check, if this is needed? (It does
 */
 
 /*
+.tobago-treeNode-toggle // XXX dummy: only occurs in JavaScript, is here to satisfy the Test
+ */
+
+/*
  * theme: standard
  * agent: standard
  */

Propchange: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/resources/scss/_tobago.scss
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 23 14:01:18 2017
@@ -1,4 +1,4 @@
 /myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css:1356585,1357124
 /myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css:1226794-1341423
-/myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss:1787403,1787422,1788112,1788125
+/myfaces/tobago/trunk/tobago-core/src/main/resources/scss/_tobago.scss:1787403,1787422,1788112,1788125,1788239
 /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1656507,1657180,1657269,1657276,1657279,1658343,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665486,1665521,1665549,1665569-1665570,1666464,1667304,1667306-1667307,1667309,1668147,1668153,1668249,1675330,1675565,1675584,16755
 88-1675589,1675636,1676030,1676035,1676038,1679031,1680197,1681981,1682187,1682448,1682545,1682548,1683231,1683306,1683373,1683664,1686204,1687354,1693426,1696720,1698292,1698297,1700742,1700795,1701249,1701251,1701256,1701980,1709006,1725894,1726691,1726986,1727161,1731050-1731051,1731054,1731057,1731218-1731219

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml Thu Mar 23 14:01:18 2017
@@ -63,17 +63,19 @@
 
   <tc:section label="Icon">
     <p>An icon can be added to a node with
-      <code class="language-markup">&lt;tc:treeIcon value="image/feather.png"/></code>.
-      In this case, the targeted image is 'feather.png'. It is displayed for closed nodes.
-      For opened nodes, an image with a '-open'-suffix is used, here it's 'feather-open.png'.
-      For the leafs of the tree, an image with a '-leaf'-suffix is used. Therefor 'feather-leaf.png' is the displayed
-      image.</p>
+      <code class="language-markup">&lt;tc:treeIcon value="image/feather-leaf.png" closed="image/feather-closed.png" open="image/feather-open.png"/></code>.
+      In this case, the targeted image is 'feather-leaf.png'. It is displayed for leaf nodes.
+      For open or closed folder there are explicit attributes.
+      If these attributes are not used, defaults are used.</p>
     <tc:tree value="#{treeController.sample}" var="node">
       <tc:treeNode>
         <tc:treeIndent/>
-        <tc:treeIcon value="#{request.contextPath}/image/feather.png" />
+        <tc:treeIcon value="#{request.contextPath}/image/feather-leaf.png"
+                     closed="#{request.contextPath}/image/feather-closed.png"
+                     open="#{request.contextPath}/image/feather-open.png" />
         <tc:treeIcon value="fa-file-o"
-                     closed="fa-folder-o" open="fa-folder-open-o" />
+                     closed="fa-folder-o"
+                     open="fa-folder-open-o" />
         <tc:treeLabel value="#{node.userObject.name}" />
       </tc:treeNode>
     </tc:tree>

Propchange: myfaces/tobago/branches/TOBAGO-1719/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 23 14:01:18 2017
@@ -1 +1,2 @@
 /myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/content/03-tree/tree.xhtml:1239020-1341423
+/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/090-tree/tree.xhtml:1788239

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-tree.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-tree.js?rev=1788245&r1=1788244&r2=1788245&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-tree.js (original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-tree.js Thu Mar 23 14:01:18 2017
@@ -17,48 +17,61 @@
 
 Tobago.Tree = {};
 
-Tobago.Tree.toggleNode = function(element, event) {
+Tobago.Tree.toggleNode = function($element, event) {
   var src;
-  var node = element.closest(".tobago-treeNode, .tobago-treeMenuNode");
-  var data = node.closest(".tobago-treeMenu, .tobago-tree, .tobago-sheet");
-  var expanded = data.children(".tobago-treeMenu-expanded, .tobago-tree-expanded, .tobago-sheet-expanded");
-  var toggle = node.find(".tobago-treeMenuNode-toggle, .tobago-treeNode-toggle");
-  var rowIndex = Tobago.Tree.rowIndex(node);
-  if (Tobago.Tree.isExpanded(node, expanded)) {
-    Tobago.Tree.hideChildren(node);
-    toggle.each(function() {
-      src = jQuery(this).data("tobago-src-closed");
-      if (src == null) { // use the open icon if there is no close icon
-        src = jQuery(this).data("tobago-src-open");
+  var $node = $element.closest(".tobago-treeNode, .tobago-treeMenuNode");
+  var $data = $node.closest(".tobago-treeMenu, .tobago-tree, .tobago-sheet");
+  var $expanded = $data.children(".tobago-treeMenu-expanded, .tobago-tree-expanded, .tobago-sheet-expanded");
+  var $toggle = $node.find(".tobago-treeMenuNode-toggle, .tobago-treeNode-toggle");
+  var rowIndex = Tobago.Tree.rowIndex($node);
+  if (Tobago.Tree.isExpanded($node, $expanded)) {
+    Tobago.Tree.hideChildren($node);
+    $toggle.find("i").each(function() {
+      var $t = jQuery(this);
+      var o = $t.data("tobago-src-open");
+      var c = $t.data("tobago-src-closed");
+      $t.removeClass(o).addClass(c);
+    });
+    $toggle.find("img").each(function() {
+      var $t = jQuery(this);
+      src = $t.data("tobago-src-closed");
+      if (src === undefined) { // use the open icon if there is no close icon
+        src = $t.data("tobago-src-open");
       }
-      jQuery(this).attr("src", src);
+      $t.attr("src", src);
     });
-    expanded.val(expanded.val().replace(new RegExp("," + rowIndex + ","), ","));
-    node.filter(".tobago-treeNode").removeClass("tobago-treeNode-markup-expanded");
-    node.filter(".tobago-treeMenuNode").removeClass("tobago-treeMenuNode-markup-expanded");
+    $expanded.val($expanded.val().replace(new RegExp("," + rowIndex + ","), ","));
+    $node.filter(".tobago-treeNode").removeClass("tobago-treeNode-markup-expanded");
+    $node.filter(".tobago-treeMenuNode").removeClass("tobago-treeMenuNode-markup-expanded");
   } else {
-    var reload = Tobago.Tree.showChildren(node, expanded);
-    expanded.val(expanded.val() + rowIndex + ",");
+    var reload = Tobago.Tree.showChildren($node, $expanded);
+    $expanded.val($expanded.val() + rowIndex + ",");
     if (reload) {
-      //Tobago.reloadComponent(element, data.attr("id"), toggle.parent().attr("id"), {});
       jsf.ajax.request(
-          toggle.parent().attr("id"),
+          $toggle.parent().attr("id"),
           event,
           {
             //"javax.faces.behavior.event": "click",
-            execute: data.attr("id"),
-            render: data.attr("id")
+            execute: $data.attr("id"),
+            render: $data.attr("id")
           });
     } else {
-      toggle.each(function() {
-        src = jQuery(this).data("tobago-src-open");
-        if (src == null) { // use the close icon if there is no open icon
-          src = jQuery(this).data("tobago-src-closed");
+      $toggle.find("i").each(function() {
+        var $t = jQuery(this);
+        var c = $t.data("tobago-src-closed");
+        var o = $t.data("tobago-src-open");
+        $t.removeClass(c).addClass(o);
+      });
+      $toggle.find("img").each(function() {
+        var $t = jQuery(this);
+        src = $t.data("tobago-src-open");
+        if (src === undefined) { // use the close icon if there is no open icon
+          src = $t.data("tobago-src-closed");
         }
-        jQuery(this).attr("src", src);
+        $t.attr("src", src);
       });
-      node.filter(".tobago-treeNode").addClass("tobago-treeNode-markup-expanded");
-      node.filter(".tobago-treeMenuNode").addClass("tobago-treeMenuNode-markup-expanded");
+      $node.filter(".tobago-treeNode").addClass("tobago-treeNode-markup-expanded");
+      $node.filter(".tobago-treeMenuNode").addClass("tobago-treeMenuNode-markup-expanded");
     }
   }
 };