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 10:37:48 UTC

svn commit: r1788215 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java

Author: lofwyr
Date: Thu Mar 23 10:37:48 2017
New Revision: 1788215

URL: http://svn.apache.org/viewvc?rev=1788215&view=rev
Log:
TOBAGO-1726: Tree icons from <tc:treeIndent> are not toggled correctly.
* cleanup

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java?rev=1788215&r1=1788214&r2=1788215&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/TreeIndentRenderer.java Thu Mar 23 10:37:48 2017
@@ -65,11 +65,17 @@ public class TreeIndentRenderer extends
     HtmlRendererUtils.writeDataAttributes(facesContext, writer, indent);
     writer.writeClassAttribute(Classes.create(node, "toggle", Markup.NULL));
 
-    encodeIndent(
-        facesContext, writer, node, showLines, showIcons, showRootJunction, showRoot, junctions);
+    // encode indent
+    final boolean dropFirst = !showRoot || !showRootJunction && (showLines || showIcons);
+    for (int i = dropFirst ? 1 : 0; i < junctions.size() - 1; i++) {
+      writer.writeIcon(Icons.SQUARE_O, BootstrapClass.INVISIBLE);
+    }
 
-    encodeTreeJunction(
-        facesContext, writer, node, showLines, showIcons, showRootJunction, junctions, expanded, folder, level == 0);
+    // encode tree junction
+    if (!showIcons || !showRootJunction && level == 0) {
+      return;
+    }
+    writer.writeIcon(folder ? expanded ? Icons.MINUS_SQUARE_O : Icons.PLUS_SQUARE_O : Icons.SQUARE_O);
   }
 
   @Override
@@ -78,27 +84,4 @@ public class TreeIndentRenderer extends
     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 {
-
-    final boolean dropFirst = !showRoot || !showRootJunction && (showLines || showIcons);
-
-    for (int i = dropFirst ? 1 : 0; i < junctions.size() - 1; i++) {
-      writer.writeIcon(Icons.SQUARE_O, BootstrapClass.INVISIBLE); // FIXME TOBAGO-1495
-    }
-  }
-
-  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) {
-      return;
-    }
-    writer.writeIcon(folder ? expanded ? Icons.MINUS_SQUARE_O : Icons.PLUS_SQUARE_O : Icons.SQUARE_O);
-  }
 }