* Make "sources" and "events" attributes optional in "bind" tag

* Fix minor notifyTopics bug on "binddiv" and "bind" (wrong parameters were passed when the returned text was an empty string)

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@542324 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Musachy Barroso
2007-05-28 21:41:04 +00:00
parent 9542de73aa
commit 2da24979d2
4 changed files with 10 additions and 6 deletions
@@ -137,12 +137,12 @@ public class Bind extends AbstractValidateBean {
addParameter("events", findString(events));
}
@StrutsTagAttribute(description="Comma delimited list of event names to attach to", required=true)
@StrutsTagAttribute(description="Comma delimited list of event names to attach to")
public void setEvents(String events) {
this.events = events;
}
@StrutsTagAttribute(description="Comma delimited list of ids of the elements to attach to", required=true)
@StrutsTagAttribute(description="Comma delimited list of ids of the elements to attach to")
public void setSources(String sources) {
this.sources = sources;
}
@@ -239,7 +239,7 @@ dojo.widget.defineWidget(
if(topicsArray) {
dojo.lang.forEach(topicsArray, function(topic) {
try {
if(data) {
if(data != null) {
dojo.event.topic.publish(topic, data, e, self);
} else {
dojo.event.topic.publish(topic, e, self);
@@ -133,7 +133,7 @@ dojo.widget.defineWidget(
if(topicsArray) {
dojo.lang.forEach(topicsArray, function(topic) {
try {
if(data) {
if(data != null) {
dojo.event.topic.publish(topic, data, e, self);
} else {
dojo.event.topic.publish(topic, e, self);
@@ -1,8 +1,12 @@
<script language="JavaScript" type="text/javascript">
dojo.addOnLoad(function() {
dojo.widget.createWidget("struts:BindEvent", {
"sources": "${parameters.sources?html}",<#rt/>
"events": "${parameters.events?html}",<#rt/>
<#if parameters.sources?if_exists != "">
"sources": "${parameters.sources?html}",<#rt/>
</#if>
<#if parameters.events?if_exists != "">
"events": "${parameters.events?html}",<#rt/>
</#if>
<#if parameters.id?if_exists != "">
"id": "${parameters.id?html}",<#rt/>
</#if>