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 2007/01/17 23:57:28 UTC

svn commit: r497223 - in /myfaces/tobago/trunk/tobago-tool/gendoc/src/main: java/org/apache/myfaces/tobago/example/reference/TreeCommandController.java webapp/WEB-INF/faces-config.xml webapp/screenshot/treeCommand.jsp

Author: lofwyr
Date: Wed Jan 17 14:57:27 2007
New Revision: 497223

URL: http://svn.apache.org/viewvc?view=rev&rev=497223
Log:
sample for a tree with commands inside

Added:
    myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/TreeCommandController.java
    myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeCommand.jsp
Modified:
    myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml

Added: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/TreeCommandController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/TreeCommandController.java?view=auto&rev=497223
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/TreeCommandController.java (added)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/java/org/apache/myfaces/tobago/example/reference/TreeCommandController.java Wed Jan 17 14:57:27 2007
@@ -0,0 +1,78 @@
+package org.apache.myfaces.tobago.example.reference;
+
+/*
+ * 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.
+ */
+
+import org.apache.myfaces.tobago.model.TreeState;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+public class TreeCommandController {
+
+  private static final Log LOG = LogFactory.getLog(TreeCommandController.class);
+
+
+  private DefaultMutableTreeNode tree;
+  private TreeState state;
+
+
+  public TreeCommandController() {
+    tree = new DefaultMutableTreeNode("Category");
+    tree.insert(new DefaultMutableTreeNode("Sports"), 0);
+    tree.insert(new DefaultMutableTreeNode("Movies"), 0);
+    DefaultMutableTreeNode music = new DefaultMutableTreeNode("Music");
+    tree.insert(music, 0);
+    tree.insert(new DefaultMutableTreeNode("Games"), 0);
+    DefaultMutableTreeNode temp = new DefaultMutableTreeNode("Science");
+    temp.insert(
+        new DefaultMutableTreeNode("Geography"), 0);
+    temp.insert(
+        new DefaultMutableTreeNode("Mathematics"), 0);
+    DefaultMutableTreeNode temp2 = new DefaultMutableTreeNode("Astronomy");
+    temp2.insert(new DefaultMutableTreeNode("Education"), 0);
+    temp2.insert(new DefaultMutableTreeNode("Pictures"), 0);
+    temp.insert(temp2, 2);
+    tree.insert(temp, 2);
+    state = new TreeState();
+    state.addExpandState(tree);
+    state.addExpandState(temp);
+    state.setMarker(music);
+  }
+
+  public String command() {
+    LOG.info(state.getMarker());
+    return null;
+  }
+
+  public DefaultMutableTreeNode getTree() {
+    return tree;
+  }
+
+  public void setTree(DefaultMutableTreeNode tree) {
+    this.tree = tree;
+  }
+
+  public TreeState getState() {
+    return state;
+  }
+
+  public void setState(TreeState state) {
+    this.state = state;
+  }
+}

Modified: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=497223&r1=497222&r2=497223
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/WEB-INF/faces-config.xml Wed Jan 17 14:57:27 2007
@@ -66,6 +66,12 @@
     <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>
 
+  <managed-bean>
+    <managed-bean-name>treeCommandController</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.reference.TreeCommandController</managed-bean-class>
+    <managed-bean-scope>session</managed-bean-scope>
+  </managed-bean>
+
   <navigation-rule>
     <navigation-case>
       <from-outcome>reset</from-outcome>

Added: myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeCommand.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeCommand.jsp?view=auto&rev=497223
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeCommand.jsp (added)
+++ myfaces/tobago/trunk/tobago-tool/gendoc/src/main/webapp/screenshot/treeCommand.jsp Wed Jan 17 14:57:27 2007
@@ -0,0 +1,45 @@
+<%--
+ * 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.
+--%>
+
+<%@ page import="javax.swing.tree.DefaultMutableTreeNode" %>
+<%@ page import="org.apache.myfaces.tobago.model.TreeState" %>
+
+<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
+
+<layout:screenshot>
+  <f:subview id="tree">
+    <jsp:body>
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout rows="300px;1*"/>
+        </f:facet>
+
+        <tc:tree state="#{treeCommandController.state}" value="#{treeCommandController.tree}"
+                 idReference="userObject" nameReference="userObject" mode="menu">
+          <f:facet name="treeNodeCommand">
+            <tc:link action="#{treeCommandController.command}"/>
+          </f:facet>
+        </tc:tree>
+
+        <tc:cell/>
+
+      </tc:panel>
+    </jsp:body>
+  </f:subview>
+</layout:screenshot>