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 2010/08/17 13:53:55 UTC
svn commit: r986275 - in /myfaces/tobago/trunk:
tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/
tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/
tobago-example/tobago-exam...
Author: lofwyr
Date: Tue Aug 17 11:53:53 2010
New Revision: 986275
URL: http://svn.apache.org/viewvc?rev=986275&view=rev
Log:
TOBAGO-377: new tree
- fixing wrong indent in some cases
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/Node.java
myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/SmallTree.java
- copied, changed from r985914, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TrueAndFalseList.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-show-attributes.xhtml
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TreeController.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-simple.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java?rev=986275&r1=986274&r2=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java Tue Aug 17 11:53:53 2010
@@ -43,35 +43,4 @@ public class CategoryTree {
return tree;
}
- public static class Node {
-
- private String name;
-
- private String id;
-
- public Node(String name, String id) {
- this.name = name;
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String toString() {
- return "Node name=" + name + " id=" + id;
- }
- }
}
Added: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/Node.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/Node.java?rev=986275&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/Node.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/Node.java Tue Aug 17 11:53:53 2010
@@ -0,0 +1,50 @@
+package org.apache.myfaces.tobago.example.data;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Node {
+
+ private String name;
+
+ private String id;
+
+ public Node(String name, String id) {
+ this.name = name;
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String toString() {
+ return "Node name=" + name + " id=" + id;
+ }
+}
Copied: myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/SmallTree.java (from r985914, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/SmallTree.java?p2=myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/SmallTree.java&p1=myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java&r1=985914&r2=986275&rev=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/CategoryTree.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/java/org/apache/myfaces/tobago/example/data/SmallTree.java Tue Aug 17 11:53:53 2010
@@ -18,60 +18,15 @@ package org.apache.myfaces.tobago.exampl
*/
import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.MutableTreeNode;
-public class CategoryTree {
+public class SmallTree {
public static DefaultMutableTreeNode createSample() {
DefaultMutableTreeNode tree = new DefaultMutableTreeNode(new Node("Root Node", "root"));
- tree.insert(new DefaultMutableTreeNode(new Node("Sports", "sports")), 0);
- tree.insert(new DefaultMutableTreeNode(new Node("Movies", "movies")), 1);
DefaultMutableTreeNode music = new DefaultMutableTreeNode(new Node("Music", "music"));
- tree.insert(music, 2);
- music.insert(new DefaultMutableTreeNode(new Node("Classic", "classic")), 0);
- music.insert(new DefaultMutableTreeNode(new Node("Pop", "pop")), 1);
- music.insert(new DefaultMutableTreeNode(new Node("World", "world")), 2);
- tree.insert(new DefaultMutableTreeNode(new Node("Games", "games")), 3);
- MutableTreeNode science = new DefaultMutableTreeNode(new Node("Science", "science"));
- science.insert(new DefaultMutableTreeNode(new Node("Geography", "geography")), 0);
- science.insert(new DefaultMutableTreeNode(new Node("Mathematics", "math")), 0);
- DefaultMutableTreeNode astro = new DefaultMutableTreeNode(new Node("Astronomy", "astro"));
- astro.insert(new DefaultMutableTreeNode(new Node("Education", "edu")), 0);
- astro.insert(new DefaultMutableTreeNode(new Node("Pictures", "pic")), 0);
- science.insert(astro, 2);
- tree.insert(science, 4);
+ tree.add(music);
+ music.add(new DefaultMutableTreeNode(new Node("Pop", "pop")));
+ tree.add(new DefaultMutableTreeNode(new Node("Sports", "sports")));
return tree;
}
-
- public static class Node {
-
- private String name;
-
- private String id;
-
- public Node(String name, String id) {
- this.name = name;
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String toString() {
- return "Node name=" + name + " id=" + id;
- }
- }
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TreeController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TreeController.java?rev=986275&r1=986274&r2=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TreeController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TreeController.java Tue Aug 17 11:53:53 2010
@@ -70,6 +70,8 @@ public class TreeController {
tree.add(bulk);
((Node) tree.getUserObject()).setExpanded(true);
((Node) temp.getUserObject()).setExpanded(true);
+ ((Node) tree.getUserObject()).setSelected(true);
+ ((Node) temp.getUserObject()).setSelected(true);
// state
state = new TreeState();
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-simple.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-simple.xhtml?rev=986275&r1=986274&r2=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-simple.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/reference/tree/tree-simple.xhtml Tue Aug 17 11:53:53 2010
@@ -24,9 +24,12 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
- <tc:page label="Tree" id="page">
+ <tc:page label="Simple Tree" id="page">
+ <f:facet name="layout">
+ <tc:gridLayout margin="10px"/>
+ </f:facet>
- <tc:tree>
+ <tc:tree showRoot="true" showRootJunction="true">
<tc:treeData value="#{treeController.tree}" var="node" id="data">
<tc:treeNode id="template" expanded="true">
<tc:treeIndent/>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java?rev=986275&r1=986274&r2=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java Tue Aug 17 11:53:53 2010
@@ -18,6 +18,7 @@ package org.apache.myfaces.tobago.exampl
*/
import org.apache.myfaces.tobago.example.data.CategoryTree;
+import org.apache.myfaces.tobago.example.data.SmallTree;
import javax.swing.tree.DefaultMutableTreeNode;
@@ -25,7 +26,13 @@ public class TreeController {
private DefaultMutableTreeNode tree = CategoryTree.createSample();
+ private DefaultMutableTreeNode small = SmallTree.createSample();
+
public DefaultMutableTreeNode getTree() {
return tree;
}
+
+ public DefaultMutableTreeNode getSmall() {
+ return small;
+ }
}
Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TrueAndFalseList.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TrueAndFalseList.java?rev=986275&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TrueAndFalseList.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TrueAndFalseList.java Tue Aug 17 11:53:53 2010
@@ -0,0 +1,29 @@
+package org.apache.myfaces.tobago.example.test;
+
+import java.util.ArrayList;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TrueAndFalseList extends ArrayList<Boolean> {
+
+ public TrueAndFalseList() {
+ super(2);
+ add(true);
+ add(false);
+ }
+}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml?rev=986275&r1=986274&r2=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml Tue Aug 17 11:53:53 2010
@@ -113,6 +113,12 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>trueAndFalseList</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.test.TrueAndFalseList</managed-bean-class>
+ <managed-bean-scope>none</managed-bean-scope>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>navigation</from-outcome>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-show-attributes.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-show-attributes.xhtml?rev=986275&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-show-attributes.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-show-attributes.xhtml Tue Aug 17 11:53:53 2010
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+
+<f:view xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:tx="http://myfaces.apache.org/tobago/extension"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core">
+
+ <tc:page label="Different show attributes" id="page">
+ <f:facet name="layout">
+ <tc:gridLayout columns="300px;200px;200px;200px;200px" rows="20px;20px;100px;100px;100px;100px;*"/>
+ </f:facet>
+
+ <tc:panel/>
+ <tc:label value="show junctions = true">
+ <tc:gridLayoutConstraint columnSpan="2"/>
+ </tc:label>
+ <tc:label value="show junctions = false">
+ <tc:gridLayoutConstraint columnSpan="2"/>
+ </tc:label>
+
+ <tc:panel/>
+ <tc:label value="show icons = true"/>
+ <tc:label value="show icons = false"/>
+ <tc:label value="show icons = true"/>
+ <tc:label value="show icons = false"/>
+
+ <tc:panel>
+ <tc:gridLayoutConstraint rowSpan="4"/>
+ <f:facet name="layout">
+ <tc:gridLayout columns="100px;195px" rows="100px;100px;100px;100px"/>
+ </f:facet>
+
+ <tc:label value="show root = true">
+ <tc:gridLayoutConstraint rowSpan="2"/>
+ </tc:label>
+ <tc:label value="show root junctions = true"/>
+ <tc:label value="show root junctions = false"/>
+
+ <tc:label value="show root = false">
+ <tc:gridLayoutConstraint rowSpan="2"/>
+ </tc:label>
+ <tc:label value="show root junctions = true"/>
+ <tc:label value="show root junctions = false"/>
+
+ </tc:panel>
+
+ <c:forEach items="#{trueAndFalseList}" var="showRoot">
+ <c:forEach items="#{trueAndFalseList}" var="showRootJunction">
+ <c:forEach items="#{trueAndFalseList}" var="showJunctions">
+ <c:forEach items="#{trueAndFalseList}" var="showIcons">
+
+ <tc:box
+ label="#{showRoot}, #{showRootJunction}, #{showJunctions}, #{showIcons}"
+ tip="show root = #{showRoot}, show root junctions = #{showRootJunction}, show junctions = #{showJunctions}, show icons = #{showIcons}">
+ <tc:tree showRoot="#{showRoot}" showRootJunction="#{showRootJunction}">
+ <tc:treeData value="#{tree.small}" var="node" id="data">
+ <tc:treeNode id="template" expanded="true">
+ <tc:treeIndent showJunctions="#{showJunctions}"/>
+ <tc:treeIcon rendered="#{showIcons}"/>
+ <tc:treeCommand label="#{node.userObject.name}" action="#{node.userObject.action}"/>
+ </tc:treeNode>
+ </tc:treeData>
+ </tc:tree>
+ </tc:box>
+
+ </c:forEach>
+ </c:forEach>
+ </c:forEach>
+ </c:forEach>
+
+ </tc:page>
+</f:view>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.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/TreeIndentRenderer.java?rev=986275&r1=986274&r2=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeIndentRenderer.java Tue Aug 17 11:53:53 2010
@@ -50,28 +50,29 @@ public class TreeIndentRenderer extends
final boolean hasNextSibling = node.isHasNextSibling();
final List<Boolean> junctions = node.getJunctions();
- final boolean showRoot = ((UITree) tree).isShowRoot(); //XXX
+ final boolean showRoot = ((UITree) tree).isShowRoot();
final boolean showJunctions = indent.isShowJunctions();
- final boolean showRootJunction = ((UITree) tree).isShowRootJunction(); //XXX
+ final boolean showRootJunction = ((UITree) tree).isShowRootJunction();
final boolean expanded = node.isExpanded() || !showRoot && level == 0;
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
- encodeIndent(facesContext, writer, node, showJunctions, junctions);
+ encodeIndent(facesContext, writer, node, showJunctions, !showRoot || !showRootJunction && showJunctions, junctions);
- encodeTreeJunction(facesContext, writer, node, showJunctions, showRootJunction, showRoot, expanded,
- folder, level, hasNextSibling);
+ encodeTreeJunction(
+ facesContext, writer, node, !showJunctions, !showRootJunction, expanded, folder, level == 0, hasNextSibling);
}
private void encodeIndent(
final FacesContext facesContext, final TobagoResponseWriter writer, final UITreeNode node,
- final boolean showJunctions, final List<Boolean> junctions)
+ final boolean showJunctions, final boolean dropFirst, final List<Boolean> junctions)
throws IOException {
final String blank = ResourceManagerUtils.getImageWithPath(facesContext, "image/blank.gif");
final String perpendicular = ResourceManagerUtils.getImageWithPath(facesContext, "image/I.gif");
- for (Boolean junction : junctions) {
+ for (int i = dropFirst ? 1 : 0; i < junctions.size(); i++) {
+ Boolean junction = junctions.get(i);
writer.startElement(HtmlElements.IMG, null);
writer.writeClassAttribute(Classes.create(node, "junction"));
writer.writeAttribute(HtmlAttributes.ALT, "", false);
@@ -86,53 +87,52 @@ public class TreeIndentRenderer extends
private void encodeTreeJunction(
FacesContext facesContext, TobagoResponseWriter writer, UITreeNode node,
- boolean showJunctions, boolean showRootJunction, boolean showRoot, boolean expanded, boolean folder,
- int level, boolean hasNextSibling)
+ boolean hideJunctions, boolean hideRootJunction, boolean expanded, boolean folder,
+ boolean root, boolean hasNextSibling)
throws IOException {
- if (!(!showJunctions
- || !showRootJunction && level == 0
- || !showRootJunction && !showRoot && level == 1)) {
- writer.startElement(HtmlElements.IMG, null);
- writer.writeClassAttribute(Classes.create(node, "toggle", Markup.NULL));
+ if (hideJunctions || hideRootJunction && root) {
+ return;
+ }
+ writer.startElement(HtmlElements.IMG, null);
+ writer.writeClassAttribute(Classes.create(node, "toggle", Markup.NULL));
- final String open;
- final String close;
- if (level == 0) {
- open = "Rminus.gif";
- close = "Rplus.gif";
+ final String open;
+ final String close;
+ if (root) {
+ open = "Rminus.gif";
+ close = "Rplus.gif";
+ } else {
+ if (hasNextSibling) {
+ if (folder) {
+ open = "Tminus.gif";
+ close = "Tplus.gif";
+ } else {
+ open = "T.gif";
+ close = "T.gif";
+ }
} else {
- if (hasNextSibling) {
- if (folder) {
- open = "Tminus.gif";
- close = "Tplus.gif";
- } else {
- open = "T.gif";
- close = "T.gif";
- }
+ if (folder) {
+ open = "Lminus.gif";
+ close = "Lplus.gif";
} else {
- if (folder) {
- open = "Lminus.gif";
- close = "Lplus.gif";
- } else {
- open = "L.gif";
- close = "L.gif";
- }
+ open = "L.gif";
+ close = "L.gif";
}
}
+ }
- final String srcOpen = ResourceManagerUtils.getImageWithPath(facesContext, "image/" + open);
- final String srcClose = ResourceManagerUtils.getImageWithPath(facesContext, "image/" + close);
- final String src = expanded ? srcOpen : srcClose;
- writer.writeAttribute(HtmlAttributes.SRC, src, true);
- if (folder) {
- writer.writeAttribute(HtmlAttributes.SRCOPEN, srcOpen, true);
- writer.writeAttribute(HtmlAttributes.SRCCLOSE, srcClose, true);
+ final String srcOpen = ResourceManagerUtils.getImageWithPath(facesContext, "image/" + open);
+ final String srcClose = ResourceManagerUtils.getImageWithPath(facesContext, "image/" + close);
+ final String src = expanded ? srcOpen : srcClose;
+ writer.writeAttribute(HtmlAttributes.SRC, src, true);
+ if (folder) {
+ writer.writeAttribute(HtmlAttributes.SRCOPEN, srcOpen, true);
+ writer.writeAttribute(HtmlAttributes.SRCCLOSE, srcClose, true);
- writer.writeAttribute("onclick", "tobagoTreeNodeToggle(this)", false);
- }
- writer.writeAttribute(HtmlAttributes.ALT, "", false);
- writer.endElement(HtmlElements.IMG);
+ writer.writeAttribute("onclick", "tobagoTreeNodeToggle(this)", false);
}
+ writer.writeAttribute(HtmlAttributes.ALT, "", false);
+ writer.endElement(HtmlElements.IMG);
}
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.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/TreeNodeRenderer.java?rev=986275&r1=986274&r2=986275&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Tue Aug 17 11:53:53 2010
@@ -122,15 +122,10 @@ public class TreeNodeRenderer extends La
final String id = node.getClientId(facesContext);
final int level = node.getLevel();
final boolean root = level == 0;
- final List<Boolean> junctions = node.getJunctions();
final boolean showRoot = ((UITree) tree).isShowRoot();
// if the root is hidden, the root node must be expanded (otherwise you will see nothing)
final boolean expanded = node.isExpanded() || !showRoot && root;
- if (!showRoot && junctions.size() > 0) {
- junctions.remove(0);
- }
-
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
if (showRoot || !root) {