struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r528866 - in /struts/struts2/trunk: apps/showcase/src/main/java/org/apache/struts2/showcase/ apps/showcase/src/main/webapp/tags/ui/ plugins/dojo/src/main/java/org/apache/struts2/dojo/components/ plugins/dojo/src/main/resources/template/ajax/
Date Sat, 14 Apr 2007 20:19:21 GMT
Author: musachy
Date: Sat Apr 14 13:19:20 2007
New Revision: 528866

URL: http://svn.apache.org/viewvc?view=rev&rev=528866
Log:
WW-1813 Tree Tag's treeSelectedTopic attribute doesn't work.
* Fix tree tag topic notification
* Fix showcase examples

Modified:
    struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java
    struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp
    struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
    struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl

Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java?view=diff&rev=528866&r1=528865&r2=528866
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/DynamicTreeSelectAction.java
Sat Apr 14 13:19:20 2007
@@ -47,7 +47,7 @@
 
 
     public String getNodeName() {
-        return currentCategory.getName();
+        return currentCategory != null ? currentCategory.getName() : "Node not found";
     }
 }
 

Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp?view=diff&rev=528866&r1=528865&r2=528866
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleDynamic.jsp Sat
Apr 14 13:19:20 2007
@@ -10,25 +10,24 @@
 
 <!-- START SNIPPET: treeExampleDynamicJsp -->
 
-<script>
-    function treeNodeSelected(nodeId) {
+<script language="JavaScript" type="text/javascript">
+    dojo.event.topic.subscribe("treeSelected", function treeNodeSelected(node) {
         dojo.io.bind({
-            url: "<s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action' />?nodeId="+nodeId,
+            url: "<s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action'/>?nodeId="+node.node.widgetId,
             load: function(type, data, evt) {
-                var displayDiv = dojo.byId("displayId");
-                displayDiv.innerHTML = data;
+                var divDisplay = dojo.byId("displayId");
+                divDisplay.innerHTML=data;
             },
             mimeType: "text/html"
         });
-    };
-
-    dojo.event.topic.subscribe("treeSelected", this, "treeNodeSelected");
+    });
 </script>
 
 
 
 <div style="float:left; margin-right: 50px;">
 <sx:tree 
+    id="tree"
     rootNode="%{treeRootNode}" 
     childCollectionProperty="children" 
     nodeIdProperty="id"

Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp?view=diff&rev=528866&r1=528865&r2=528866
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/treeExampleStatic.jsp Sat Apr
14 13:19:20 2007
@@ -9,19 +9,17 @@
 
 <!-- START SNIPPET: treeExampleStaticJsp -->
 
-<script>
-    function treeNodeSelected(nodeId) {
+<script language="JavaScript" type="text/javascript">
+    dojo.event.topic.subscribe("treeSelected", function treeNodeSelected(node) {
         dojo.io.bind({
-            url: "<s:url value='/tags/ui/ajax/staticTreeSelectAction.action'/>?nodeId="+nodeId,
+            url: "<s:url value='/tags/ui/ajax/staticTreeSelectAction.action'/>?nodeId="+node.node.title,
             load: function(type, data, evt) {
                 var divDisplay = dojo.byId("displayIt");
                 divDisplay.innerHTML=data;
             },
             mimeType: "text/html"
         });
-    };
-
-    dojo.event.topic.subscribe("treeSelected", this, "treeNodeSelected");
+    });
 </script>
 
 

Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java?view=diff&rev=528866&r1=528865&r2=528866
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
(original)
+++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
Sat Apr 14 13:19:20 2007
@@ -38,7 +38,8 @@
  * Renders a tree widget with AJAX support.<p/>
  *
  * The id attribute is normally specified, such that it could be looked up using
- * javascript if necessary.<p/>
+ * javascript if necessary. The id attribute is required, if the "treeSelectedTopic"
+ * is going to be used.<p/>
  *
  * <!-- END SNIPPET: javadoc -->
  *

Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl?view=diff&rev=528866&r1=528865&r2=528866
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl Sat Apr 14
13:19:20 2007
@@ -6,6 +6,10 @@
         // dojo.hostenv.writeIncludes();
         -->
  </script>
+ <#if parameters.treeSelectedTopic?exists>
+ <dojo:TreeSelector widgetId="treeSelector_${parameters.id?default("")}" eventNames="select:${parameters.treeSelectedTopic?html}">
+ </dojo:TreeSelector> 
+ </#if>
 <div dojoType="Tree"   
 	<#if parameters.blankIconSrc?exists>
 	gridIconSrcT="<@s.url value='${parameters.blankIconSrc}' encode="false" includeParams='none'/>"
@@ -59,7 +63,7 @@
     id="${parameters.id?html}"
     </#if>
     <#if parameters.treeSelectedTopic?exists>
-    publishSelectionTopic="${parameters.treeSelectedTopic?html}"
+    selector="treeSelector_${parameters.id?default("")}"
     </#if>
     <#if parameters.treeExpandedTopic?exists>
     publishExpandedTopic="${parameters.treeExpandedTopic?html}"



Mime
View raw message