You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mu...@apache.org on 2007/04/15 00:49:06 UTC
svn commit: r528884 - in
/struts/struts2/trunk/plugins/dojo/src/main/resources:
org/apache/struts2/static/dojo/struts/widget/StrutsTreeSelector.js
org/apache/struts2/static/dojo/struts/widget/__package__.js
template/ajax/tree.ftl
Author: musachy
Date: Sat Apr 14 15:49:05 2007
New Revision: 528884
URL: http://svn.apache.org/viewvc?view=rev&rev=528884
Log:
WW-1813 Tree Tag's treeCollapsedTopic and treeExpandedTopic attribute don't work.
Added:
struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeSelector.js
Modified:
struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js
struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/tree.ftl
Added: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeSelector.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeSelector.js?view=auto&rev=528884
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeSelector.js (added)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeSelector.js Sat Apr 14 15:49:05 2007
@@ -0,0 +1,41 @@
+dojo.provide("struts.widget.StrutsTreeSelector");
+
+dojo.require("dojo.widget.TreeSelector");
+
+dojo.widget.defineWidget(
+ "struts.widget.StrutsTreeSelector",
+ dojo.widget.TreeSelector, {
+ widgetType : "StrutsTreeSelector",
+
+ eventNamesDefault: {
+ select : "select",
+ destroy : "destroy",
+ deselect : "deselect",
+ dblselect: "dblselect", // select already selected node.. Edit or whatever
+ expand: "expand",
+ collapse: "collapse"
+ },
+
+ listenTree: function(tree) {
+ dojo.event.topic.subscribe(tree.eventNames.collapse, this, "collapse");
+ dojo.event.topic.subscribe(tree.eventNames.expand, this, "expand");
+ struts.widget.StrutsTreeSelector.superclass.unlistenTree.apply(this, [tree]);
+ },
+
+ unlistenTree: function(tree) {
+ dojo.event.topic.unsubscribe(tree.eventNames.collapse, this, "collapse");
+ dojo.event.topic.unsubscribe(tree.eventNames.expand, this, "expand");
+ struts.widget.StrutsTreeSelector.superclass.unlistenTree.apply(this, [tree]);
+ },
+
+ expand: function(message) {
+ var node = message.source;
+ dojo.event.topic.publish(this.eventNames.expand, {node: node} );
+ },
+
+ collapse: function(message) {
+ var node = message.source;
+ dojo.event.topic.publish(this.eventNames.collapse, {node: node} );
+ },
+
+});
\ No newline at end of file
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js?view=diff&rev=528884&r1=528883&r2=528884
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js Sat Apr 14 15:49:05 2007
@@ -5,6 +5,7 @@
"struts.widget.ComboBox",
"struts.widget.StrutsTimePicker",
"struts.widget.StrutsDatePicker",
- "struts.widget.BindEvent"]
+ "struts.widget.BindEvent",
+ "struts.widget.StrutsTreeSelector"]
});
dojo.provide("struts.widget.*");
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=528884&r1=528883&r2=528884
==============================================================================
--- 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 15:49:05 2007
@@ -6,9 +6,20 @@
// dojo.hostenv.writeIncludes();
-->
</script>
- <#if parameters.treeSelectedTopic?exists>
- <dojo:TreeSelector widgetId="treeSelector_${parameters.id?default("")}" eventNames="select:${parameters.treeSelectedTopic?html}">
- </dojo:TreeSelector>
+ <#if parameters.treeSelectedTopic?exists || parameters.treeExpandedTopic?exists
+ || parameters.treeCollapsedTopic?exists>
+ <#assign eventNames = "" >
+ <#if parameters.treeSelectedTopic?exists>
+ <#assign eventNames = "select:" + parameters.treeSelectedTopic?html + ";">
+ </#if>
+ <#if parameters.treeExpandedTopic?exists>
+ <#assign eventNames = eventNames + "expand:" + parameters.treeExpandedTopic?html + ";">
+ </#if>
+ <#if parameters.treeCollapsedTopic?exists>
+ <#assign eventNames = eventNames + "collapse:" + parameters.treeCollapsedTopic?html>
+ </#if>
+ <struts:StrutsTreeSelector widgetId="treeSelector_${parameters.id?default("")}" eventNames="${eventNames}">
+ </struts:StrutsTreeSelector>
</#if>
<div dojoType="Tree"
<#if parameters.blankIconSrc?exists>
@@ -64,9 +75,6 @@
</#if>
<#if parameters.treeSelectedTopic?exists>
selector="treeSelector_${parameters.id?default("")}"
- </#if>
- <#if parameters.treeExpandedTopic?exists>
- publishExpandedTopic="${parameters.treeExpandedTopic?html}"
</#if>
<#if parameters.treeCollapsedTopic?exists>
publishCollapsedTopic="${parameters.treeCollapsedTopic?html}"