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/02/26 21:04:45 UTC

svn commit: r511978 - in /myfaces/tobago/trunk/example/sandbox/src/main: java/org/apache/myfaces/tobago/example/sandbox/Controller.java webapp/navigation.jsp webapp/tree-editor.jsp

Author: lofwyr
Date: Mon Feb 26 12:04:44 2007
New Revision: 511978

URL: http://svn.apache.org/viewvc?view=rev&rev=511978
Log:
Start of the example for an editable tree.

Added:
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-editor.jsp
Modified:
    myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
    myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp

Modified: myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java?view=diff&rev=511978&r1=511977&r2=511978
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/java/org/apache/myfaces/tobago/example/sandbox/Controller.java Mon Feb 26 12:04:44 2007
@@ -74,6 +74,16 @@
     return null;
   }
 
+  public String createNode() {
+    DefaultMutableTreeNode marker = state.getMarker();
+    if (marker != null) {
+      marker.insert(new DefaultMutableTreeNode(new Node("New Node")), 0);
+    } else {
+      // todo: print a warning or use root?
+    }
+    return null;
+  }
+
   public DefaultMutableTreeNode getTree() {
     return tree;
   }

Modified: myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp?view=diff&rev=511978&r1=511977&r2=511978
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp (original)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/navigation.jsp Mon Feb 26 12:04:44 2007
@@ -36,6 +36,8 @@
 
     <tc:link link="tree-menu.jsp" label="tree-menu.jsp" target="View"/>
 
+    <tc:link link="tree-editor.jsp" label="tree-editor.jsp" target="View"/>
+
     <tc:cell/>
   </tc:page>
 </f:view>

Added: myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-editor.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-editor.jsp?view=auto&rev=511978
==============================================================================
--- myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-editor.jsp (added)
+++ myfaces/tobago/trunk/example/sandbox/src/main/webapp/tree-editor.jsp Mon Feb 26 12:04:44 2007
@@ -0,0 +1,52 @@
+<%--
+ * 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.
+--%>
+
+<%@ taglib uri="http://myfaces.apache.org/tobago/sandbox" prefix="tcs" %>
+<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<f:view>
+  <tc:loadBundle basename="demo" var="bundle"/>
+
+  <tc:page label="Sandbox - Tree Editor" id="page"
+           width="500px" height="800px">
+    <f:facet name="layout">
+      <tc:gridLayout margin="10px" rows="fixed;300px;*"/>
+    </f:facet>
+
+    <tc:toolBar>
+      <tc:toolBarCommand action="#{controller.createNode}" label="New"/>
+    </tc:toolBar>
+
+    <tcs:tree state="#{controller.state}" id="tree">
+      <!--
+      fixme: The helping-node "Root" is required in the moment, has to be removed!
+      -->
+      <tcs:treeNode label="Root">
+        <tcs:treeNodeData value="#{controller.tree}" var="node" id="data">
+          <tcs:treeNode label="#{node.userObject.name}" id="template"
+                        markup="#{node.userObject.markup}"
+                        tip="#{node.userObject.tip}"
+                        action="#{node.userObject.action}" value="#{node}"/>
+        </tcs:treeNodeData>
+      </tcs:treeNode>
+    </tcs:tree>
+
+    <tc:cell/>
+
+  </tc:page>
+</f:view>