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 2013/02/26 15:59:38 UTC

svn commit: r1450198 - in /myfaces/tobago/branches/tobago-1.5.x: tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ tobago-example/tobago-example-test/src/main/webapp/tc/tree/ tobago-theme/tobago-theme-scarborough/...

Author: lofwyr
Date: Tue Feb 26 14:59:37 2013
New Revision: 1450198

URL: http://svn.apache.org/r1450198
Log:
TOBAGO-1231: TreeNodeRenderer dont invoke event for tree expansion

Added:
    myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html
    myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.xhtml
Modified:
    myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java
    myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java

Modified: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java?rev=1450198&r1=1450197&r2=1450198&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java Tue Feb 26 14:59:37 2013
@@ -20,9 +20,11 @@
 package org.apache.myfaces.tobago.example.test;
 
 import org.apache.myfaces.tobago.example.data.CategoryTree;
+import org.apache.myfaces.tobago.example.data.Node;
 import org.apache.myfaces.tobago.example.data.SmallTree;
 
 import javax.swing.tree.DefaultMutableTreeNode;
+import java.util.Enumeration;
 
 public class TreeController {
   
@@ -37,4 +39,17 @@ public class TreeController {
   public DefaultMutableTreeNode getSmall() {
     return small;
   }
+
+  public String openAll() {
+    final Enumeration enumeration = tree.depthFirstEnumeration();
+    while (enumeration.hasMoreElements()) {
+      DefaultMutableTreeNode node = (DefaultMutableTreeNode) enumeration.nextElement();
+      if (!node.isLeaf()) {
+        Node userObject = (Node) node.getUserObject();
+        userObject.setExpanded(true);
+      }
+    }
+    return null;
+  }
+
 }

Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html?rev=1450198&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.selenium.html Tue Feb 26 14:59:37 2013
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<!--
+ * 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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8080/faces/test/button/link-attribute.xhtml" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/faces/tc/tree/tree-expanded.xhtml</td>
+	<td></td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:reset</td>
+	<td></td>
+</tr>
+<!--node expanded-->
+<tr>
+	<td>assertAttribute</td>
+	<td>//div[@id='page:tree:data:_0_4:node']@class</td>
+	<td>tobago-treeNode tobago-treeNode-markup-expanded tobago-treeNode-markup-folder</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>//div[@id='page:tree:data:_0_4:node']/img[2]</td>
+	<td></td>
+</tr>
+<!--node expanded-->
+<tr>
+	<td>assertAttribute</td>
+	<td>//div[@id='page:tree:data:_0_4:node']@class</td>
+	<td>tobago-treeNode tobago-treeNode-markup-folder</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>id=page:tree:data:_0_3:command</td>
+	<td></td>
+</tr>
+<!--node collapsed-->
+<tr>
+	<td>assertAttribute</td>
+	<td>//div[@id='page:tree:data:_0_4:node']@class</td>
+	<td>tobago-treeNode tobago-treeNode-markup-folder</td>
+</tr>
+</tbody></table>
+</body>
+</html>

Added: myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.xhtml?rev=1450198&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.xhtml (added)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-example/tobago-example-test/src/main/webapp/tc/tree/tree-expanded.xhtml Tue Feb 26 14:59:37 2013
@@ -0,0 +1,43 @@
+<?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:f="http://java.sun.com/jsf/core">
+
+  <tc:page id="page">
+    <tc:gridLayoutConstraint width="600px" height="300px"/>
+    <f:facet name="layout">
+      <tc:gridLayout rows="auto;auto;*"/>
+    </f:facet>
+
+    <tc:out value="Test expanded state of the tree nodes:"/>
+
+    <tc:button label="Reset" id="reset" action="#{tree.openAll}" immediate="true"/>
+
+    <tc:tree id="tree" showRoot="true" showRootJunction="true">
+      <tc:treeData value="#{tree.tree}" var="node" id="data">
+      <tc:treeNode id="node" expanded="#{node.userObject.expanded}">
+        <tc:treeIndent id="indent"/>
+        <tc:treeCommand id="command" label="#{node.userObject.name}" action="#{node.userObject.action}"/>
+      </tc:treeNode>
+      </tc:treeData>
+    </tc:tree>
+
+  </tc:page>
+</f:view>

Modified: myfaces/tobago/branches/tobago-1.5.x/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/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java?rev=1450198&r1=1450197&r2=1450198&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java Tue Feb 26 14:59:37 2013
@@ -81,12 +81,12 @@ public class TreeNodeRenderer extends La
     final boolean folder = node.isFolder();
 
     // expand state
-    if (folder) {
+//    if (folder) { // XXX the state of folder seems to be not restored!
       boolean expanded = Boolean.parseBoolean(requestParameterMap.get(id + ComponentUtils.SUB_SEPARATOR + "expanded"));
       if (node.isExpanded() != expanded) {
         new TreeExpansionEvent(node, node.isExpanded(), expanded).queue();
       }
-    }
+//    }
 
     // select
     String searchString;