struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r526300 [3/3] - in /struts/struts2/trunk/plugins/dojo/src: main/ main/java/org/apache/struts2/dojo/components/ main/java/org/apache/struts2/dojo/views/ main/java/org/apache/struts2/dojo/views/freemarker/tags/ main/java/org/apache/struts2/do...
Date Fri, 06 Apr 2007 22:29:51 GMT
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js?view=diff&rev=526300&r1=526299&r2=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js
(original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts_dojo.js.uncompressed.js
Fri Apr  6 15:29:44 2007
@@ -22086,7 +22086,7 @@
   formFilter : "",
   formNode : null,
 
-  event : "",
+  events : "",
   indicator : "",
 
   parseContent : true,
@@ -22129,14 +22129,20 @@
       this.targetsArray = this.targets.split(",");
     }
 
-    if(!dojo.string.isBlank(this.event)) {
-      dojo.event.connect(this.domNode, this.event, function(evt) {
-        evt.preventDefault();
-        evt.stopPropagation();
-        self.reloadContents();
-      });
+    if(!dojo.string.isBlank(this.events)) {
+      var eventsArray = this.events.split(",");
+      if(eventsArray && this.domNode) {
+        dojo.lang.forEach(eventsArray, function(event){
+           dojo.event.connect(self.domNode, event, function(evt) {
+             evt.preventDefault();
+             evt.stopPropagation();
+             self.reloadContents();
+           });
+        });
+      }
     }
 
+
     if(dojo.string.isBlank(this.href) && dojo.string.isBlank(this.formId)) {
       //no href and no formId, we must be inside a form
       this.formNode = dojo.dom.getFirstAncestorByTag(this.domNode, "form");
@@ -22163,12 +22169,16 @@
 	  var xmlParser = new dojo.xml.Parse();
       dojo.lang.forEach(this.targetsArray, function(target) {
         var node = dojo.byId(target);
-        node.innerHTML = text;
-
-        if(self.parseContent && text != self.loadingText){
-          var frag  = xmlParser.parseElement(node, null, true);
-          dojo.widget.getParser().createSubComponents(frag, dojo.widget.byId(target));
-		}
+        if(node) {
+          node.innerHTML = text;
+  
+          if(self.parseContent && text != self.loadingText){
+            var frag  = xmlParser.parseElement(node, null, true);
+            dojo.widget.getParser().createSubComponents(frag, dojo.widget.byId(target));
+          }
+        } else {
+          self.log("Unable to find target: " + node);
+        }
       });
     }
   },
@@ -22239,11 +22249,11 @@
     var self = this;
     if(topicsArray) {
       dojo.lang.forEach(topicsArray, function(topic) {
-        try {
-          dojo.event.topic.publish(topic, data, type, e);
-        } catch(ex){
-          self.log(ex);
-        }
+      try {
+        dojo.event.topic.publish(topic, data, type, e);
+      } catch(ex){
+        self.log(ex);
+      }
       });
     }
   },
@@ -22827,7 +22837,7 @@
   struts.widget.Bind, {
   widgetType : "BindAnchor",
 
-  event: "onclick",
+  events: "onclick",
 
   postCreate : function() {
      struts.widget.BindAnchor.superclass.postCreate.apply(this);
@@ -27632,7 +27642,6 @@
 dojo.provide("struts.widget.StrutsDatePicker");
 
 
-
 dojo.widget.defineWidget(
   "struts.widget.StrutsDatePicker",
   dojo.widget.DropdownDatePicker, {
@@ -27653,13 +27662,53 @@
   },
 });
 
+dojo.provide("struts.widget.BindEvent");
+
+
+
+dojo.widget.defineWidget(
+  "struts.widget.BindEvent",
+  struts.widget.Bind, {
+  widgetType : "BindEvent",
+
+  sources: "",
+
+  postCreate : function() {
+    struts.widget.BindEvent.superclass.postCreate.apply(this);
+    var self = this;
+
+    if(!dojo.string.isBlank(this.events) && !dojo.string.isBlank(this.sources)) {
+      var eventsArray = this.events.split(",");
+      var sourcesArray = this.sources.split(",");
+
+      if(eventsArray && this.domNode) {
+        //events
+        dojo.lang.forEach(eventsArray, function(event) {
+          //sources
+          dojo.lang.forEach(sourcesArray, function(source) {
+            var sourceObject = dojo.byId(source);
+            if(sourceObject) {
+              dojo.event.connect(sourceObject, event, function(evt) {
+                evt.preventDefault();
+                evt.stopPropagation();
+                self.reloadContents();
+              });
+            }
+          });
+        });
+      }
+    }
+  }
+});
+
 dojo.kwCompoundRequire({
 	common: ["struts.widget.Bind",
 	         "struts.widget.BindDiv",
 	         "struts.widget.BindAnchor",
 	         "struts.widget.ComboBox",
              "struts.widget.StrutsTimePicker",
-             "struts.widget.StrutsDatePicker"]
+             "struts.widget.StrutsDatePicker",
+             "struts.widget.BindEvent"]
 });
 dojo.provide("struts.widget.*");
 

Added: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind-close.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind-close.ftl?view=auto&rev=526300
==============================================================================
    (empty)

Added: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind.ftl?view=auto&rev=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind.ftl (added)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/bind.ftl Fri Apr  6
15:29:44 2007
@@ -0,0 +1,47 @@
+<script language="JavaScript" type="text/javascript">
+	dojo.addOnLoad(function() {
+		dojo.widget.createWidget("struts:BindEvent", {
+			"sources": "${parameters.sources?html}",
+			"events": "${parameters.events?html}",
+			<#if parameters.id?if_exists != "">
+			  	"id": "${parameters.id?html}",
+		    </#if>
+		    <#if parameters.formId?if_exists != "">
+			  	"formId": "${parameters.formId?html}",
+		    </#if>
+			<#if parameters.formFilter?if_exists != "">
+			  	"formFilter": "${parameters.formFilter?html}",
+			</#if>
+			<#if parameters.href?if_exists != "">
+			  	"href": "${parameters.href}",
+			</#if>
+			<#if parameters.loadingText?if_exists != "">
+			    "loadingText" : "${parameters.loadingText?html}",
+		    </#if>
+			<#if parameters.errorText?if_exists != "">
+			    "errorText" : "${parameters.errorText?html}",
+			</#if>
+			<#if parameters.executeScripts?exists>
+			    "executeScripts": "${parameters.executeScripts?string?html}",
+			</#if>
+			<#if parameters.listenTopics?if_exists != "">
+			    "listenTopics": "${parameters.listenTopics?html}",
+			</#if>
+			<#if parameters.notifyTopics?if_exists != "">
+			    "notifyTopics": "${parameters.notifyTopics?html}",
+			</#if>
+			<#if parameters.targets?if_exists != "">
+			    "targets": "${parameters.targets?html}",
+			</#if>
+			<#if parameters.indicator?if_exists != "">
+			    "indicator": "${parameters.indicator?html}",
+			</#if>
+			<#if parameters.showErrorTransportText?exists>
+			    "showError": "${parameters.showErrorTransportText?string?html}",
+			</#if>
+			<#if parameters.handler?if_exists != "">
+			    "handler": "${parameters.handler?html}"
+		    </#if>
+		});
+	});
+</script>
\ No newline at end of file

Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/dojoRequire.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/dojoRequire.js?view=diff&rev=526300&r1=526299&r2=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/dojoRequire.js (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/dojoRequire.js Fri
Apr  6 15:29:44 2007
@@ -5,11 +5,6 @@
 dojo.require('dojo.widget.*');
 dojo.widget.manager.registerWidgetPackage('struts.widget');
 
-dojo.require("struts.widget.Bind");
-dojo.require("struts.widget.BindDiv");
-dojo.require("struts.widget.BindAnchor");
-dojo.require("struts.widget.ComboBox");
-dojo.require("struts.widget.StrutsTimePicker")
-dojo.require("struts.widget.StrutsDatePicker")
+dojo.require("struts.widget.*");
 dojo.require("dojo.widget.Editor2");
 dojo.hostenv.writeIncludes(); // not needed, but allows the Venkman debugger to work with
the includes

Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl?view=diff&rev=526300&r1=526299&r2=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl Fri Apr
 6 15:29:44 2007
@@ -1,5 +1,5 @@
 <#if parameters.type?exists && parameters.type=="button">
-  <input type="button" dojoType="struts:Bind" event="onclick"<#rt/>
+  <input type="button" dojoType="struts:Bind" events="onclick"<#rt/>
   <#include "/${parameters.templateDir}/ajax/ajax-common.ftl"/>
   <#include "/${parameters.templateDir}/simple/scripting-events.ftl"/>
   <#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
@@ -9,7 +9,7 @@
  />
 <#else>
   <#if parameters.type?exists && parameters.type=="image">
-    <input type="image" dojoType="struts:Bind" event="onclick"<#rt/>
+    <input type="image" dojoType="struts:Bind" events="onclick"<#rt/>
     <#if parameters.label?if_exists != "">
      alt="${parameters.label?html}"<#rt/>
     </#if>
@@ -17,7 +17,7 @@
      src="${parameters.src?html}"<#rt/>
     </#if>
   <#else>
-    <input type="submit" dojoType="struts:Bind" event="onclick"<#rt/>
+    <input type="submit" dojoType="struts:Bind" events="onclick"<#rt/>
   </#if>
     <#if parameters.nameValue?if_exists != "">
      value="${parameters.nameValue?html}"<#rt/>

Added: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/BindTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/BindTest.java?view=auto&rev=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/BindTest.java
(added)
+++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/BindTest.java
Fri Apr  6 15:29:44 2007
@@ -0,0 +1,33 @@
+package org.apache.struts2.dojo.views.jsp.ui;
+
+import org.apache.struts2.dojo.TestAction;
+
+public class BindTest extends AbstractUITagTest {
+    public void testSubmit() throws Exception {
+        TestAction testAction = (TestAction) action;
+        testAction.setFoo("bar");
+
+        BindTag tag = new BindTag();
+        tag.setPageContext(pageContext);
+
+        tag.setId("a");
+        tag.setHref("b");
+        tag.setLoadingText("c");
+        tag.setErrorText("d");
+        tag.setListenTopics("e");
+        tag.setBeforeNotifyTopics("f");
+        tag.setAfterNotifyTopics("g");
+        tag.setHandler("h");
+        tag.setLabel("i");
+        tag.setNotifyTopics("k");
+        tag.setIndicator("l");
+        tag.setShowLoadingText("true");
+        tag.setErrorNotifyTopics("m");
+        tag.setSources("n");
+        tag.setEvents("o");
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(BindTest.class.getResource("Bind-1.txt"));
+    }
+}

Added: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt?view=auto&rev=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt
(added)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/Bind-1.txt
Fri Apr  6 15:29:44 2007
@@ -0,0 +1,17 @@
+<script language="JavaScript" type="text/javascript">
+	dojo.addOnLoad(function() { 
+		dojo.widget.createWidget("struts:BindEvent", {
+			"sources":"n",
+			"events":"o",
+			"id":"a",
+			"href":"b",
+			"loadingText":"c",
+			"errorText":"d",
+			"listenTopics":"e", 
+			"notifyTopics":"k",
+			"indicator":"l",
+			"showError":"true",
+			"handler":"h"
+		});
+	});
+</script>
\ No newline at end of file

Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-1.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-1.txt?view=diff&rev=526300&r1=526299&r2=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-1.txt
(original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-1.txt
Fri Apr  6 15:29:44 2007
@@ -1,7 +1,7 @@
 <input
   type="submit"
   dojoType="struts:Bind"
-  event="onclick"
+  events="onclick"
   value="Submit"
   id="a"
   label="i"

Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-2.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-2.txt?view=diff&rev=526300&r1=526299&r2=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-2.txt
(original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-2.txt
Fri Apr  6 15:29:44 2007
@@ -1,7 +1,7 @@
 <input
   type="button"
   dojoType="struts:Bind"
-  event="onclick"
+  events="onclick"
   id="a"
   label="i"
   href="b"

Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-3.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-3.txt?view=diff&rev=526300&r1=526299&r2=526300
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-3.txt
(original)
+++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-3.txt
Fri Apr  6 15:29:44 2007
@@ -1,7 +1,7 @@
 <input
   type="image"
   dojoType="struts:Bind"
-  event="onclick"
+  events="onclick"
   alt="i"
   src="j"
   value="Submit"



Mime
View raw message