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 2012/04/18 16:09:35 UTC
svn commit: r1327514 - in
/myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main:
java/org/apache/myfaces/tobago/example/demo/Navigation.java
webapp/navigation.jsp
Author: lofwyr
Date: Wed Apr 18 14:09:34 2012
New Revision: 1327514
URL: http://svn.apache.org/viewvc?rev=1327514&view=rev
Log:
tree state
Modified:
myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java?rev=1327514&r1=1327513&r2=1327514&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java Wed Apr 18 14:09:34 2012
@@ -22,6 +22,7 @@ import org.apache.myfaces.tobago.context
import org.apache.myfaces.tobago.example.demo.jsp.JspFormatter;
import org.apache.myfaces.tobago.model.ExpandedState;
import org.apache.myfaces.tobago.model.MarkedState;
+import org.apache.myfaces.tobago.model.TreePath;
import org.apache.myfaces.tobago.model.TreeState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -172,11 +173,9 @@ public class Navigation implements Seria
}
protected String gotoNode(Node node) {
- currentNode.setMarked(false);
currentNode = node;
- currentNode.setMarked(true);
- currentNode.setExpanded(true);
- LOG.info("Navigate to '" + currentNode.outcome + "'");
+ state.getExpandedState().expand(new TreePath(node));
+ LOG.info("Navigate to '" + currentNode.getOutcome() + "'");
return currentNode.getOutcome();
}
@@ -222,8 +221,6 @@ public class Navigation implements Seria
private String branch;
private String title;
private String outcome;
- private boolean expanded;
- private boolean marked;
public Node(String path) {
@@ -302,22 +299,6 @@ public class Navigation implements Seria
this.outcome = outcome;
}
- public boolean isExpanded() {
- return expanded;
- }
-
- public void setExpanded(boolean expanded) {
- this.expanded = expanded;
- }
-
- public boolean isMarked() {
- return marked;
- }
-
- public void setMarked(boolean marked) {
- this.marked = marked;
- }
-
@Override
public String toString() {
return outcome;
Modified: myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp?rev=1327514&r1=1327513&r2=1327514&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp (original)
+++ myfaces/tobago/branches/tobago-tree-table/tobago-example/tobago-example-demo/src/main/webapp/navigation.jsp Wed Apr 18 14:09:34 2012
@@ -18,19 +18,13 @@
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:subview id="navigator">
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout rows="*"/>
- </f:facet>
-
- <tc:treeMenu id="nav" value="#{navigation.tree}" var="node">
- <tc:treeNode expanded="#{node.expanded}">
- <tc:treeCommand
- label="#{node.title}"
- action="#{node.action}"
- immediate="true"/>
- </tc:treeNode>
- </tc:treeMenu>
-
- </tc:panel>
+ <tc:treeMenu id="nav" value="#{navigation.tree}" var="node" state="#{navigation.state}">
+ <tc:treeNode id="node">
+ <tc:treeCommand
+ id="cmd"
+ label="#{node.title}"
+ action="#{node.action}"
+ immediate="true"/>
+ </tc:treeNode>
+ </tc:treeMenu>
</f:subview>