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/05/01 22:35:32 UTC
svn commit: r534232 - in
/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget:
Bind.js BindDiv.js
Author: musachy
Date: Tue May 1 13:35:31 2007
New Revision: 534232
URL: http://svn.apache.org/viewvc?view=rev&rev=534232
Log:
Simplify before/after/error notify topics
Modified:
struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js
struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js?view=diff&rev=534232&r1=534231&r2=534232
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js Tue May 1 13:35:31 2007
@@ -211,7 +211,7 @@
if(this.notifyTopicsArray) {
dojo.lang.forEach(this.notifyTopicsArray, function(topic) {
try {
- dojo.event.topic.publish(topic, data, type, e);
+ dojo.event.topic.publish(topic, data, type, e, self);
} catch(ex){
self.log(ex);
}
@@ -222,25 +222,27 @@
var topicsArray = null;
switch(type) {
case "before":
- topicsArray = this.beforeNotifyTopicsArray;
+ this.notifyTo(this.beforeNotifyTopicsArray, null, e);
break;
case "load":
- topicsArray = this.afterNotifyTopicsArray;
+ this.notifyTo(this.afterNotifyTopicsArray, data, e);
break;
case "error":
- topicsArray = this.errorNotifyTopicsArray;
+ this.notifyTo(this.errorNotifyTopicsArray, data, e);
break;
}
-
- this.notifyTo(topicsArray, data, type, e);
},
- notifyTo : function(topicsArray, data, type, e) {
+ notifyTo : function(topicsArray, data, e) {
var self = this;
if(topicsArray) {
dojo.lang.forEach(topicsArray, function(topic) {
try {
- dojo.event.topic.publish(topic, data, type, e);
+ if(data) {
+ dojo.event.topic.publish(topic, data, e, self);
+ } else {
+ dojo.event.topic.publish(topic, e, self);
+ }
} catch(ex){
self.log(ex);
}
Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js?view=diff&rev=534232&r1=534231&r2=534232
==============================================================================
--- struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js (original)
+++ struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js Tue May 1 13:35:31 2007
@@ -103,7 +103,7 @@
var self = this;
dojo.lang.forEach(this.notifyTopicsArray, function(topic) {
try {
- dojo.event.topic.publish(topic, data, type, e);
+ dojo.event.topic.publish(topic, data, type, e, self);
} catch(ex) {
self.log(ex);
}
@@ -114,28 +114,30 @@
var topicsArray = null;
switch(type) {
case "before":
- topicsArray = this.beforeNotifyTopicsArray;
+ this.notifyTo(this.beforeNotifyTopicsArray, null, e);
break;
case "load":
- topicsArray = this.afterNotifyTopicsArray;
+ this.notifyTo(this.afterNotifyTopicsArray, data, e);
break;
case "error":
- topicsArray = this.errorNotifyTopicsArray;
+ this.notifyTo(this.errorNotifyTopicsArray, data, e);
break;
}
-
- this.notifyTo(topicsArray, data, type, e);
},
- notifyTo : function(topicsArray, data, type, e) {
+ notifyTo : function(topicsArray, data, e) {
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 {
+ if(data) {
+ dojo.event.topic.publish(topic, data, e, self);
+ } else {
+ dojo.event.topic.publish(topic, e, self);
}
+ } catch(ex){
+ self.log(ex);
+ }
});
}
},