Author: musachy Date: Sat Mar 17 11:57:22 2007 New Revision: 519409 URL: http://svn.apache.org/viewvc?view=rev&rev=519409 Log: WW-1607 * Remove unused files * Remove deprecated attributes "beforeLoading", "afterLoading", "resultDivId", "preInvokeJS", "onLoadJS" * Add attributes "beforeNotifyTopics", "afterNotifyTopics", "errorNotifyTopics"
Removed: struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/Util.js struts/struts2/trunk/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widgets/ Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java 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 struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/ajax-common.ftl struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/submit.ftl struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTest.java struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/SubmitAjaxTest.java struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/div-1.txt struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/href-1.txt struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-1.txt struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-2.txt struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/submit-ajax-3.txt Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java Sat Mar 17 11:57:22 2007 @@ -34,8 +34,6 @@ protected String href; protected String errorText; - protected String afterLoading; - protected String beforeLoading; protected String executeScripts; protected String loadingText; protected String listenTopics; @@ -46,7 +44,10 @@ protected String showErrorTransportText; protected String indicator; protected String showLoadingText; - + protected String beforeNotifyTopics; + protected String afterNotifyTopics; + protected String errorNotifyTopics; + public AbstractRemoteCallUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); @@ -61,10 +62,6 @@ addParameter("errorText", findString(errorText)); if (loadingText != null) addParameter("loadingText", findString(loadingText)); - if (afterLoading != null) - addParameter("afterLoading", findString(afterLoading)); - if (beforeLoading != null) - addParameter("beforeLoading", findString(beforeLoading)); if (executeScripts != null) addParameter("executeScripts", findValue(executeScripts, Boolean.class)); if (listenTopics != null) @@ -85,6 +82,12 @@ addParameter("showErrorTransportText", true); if (showLoadingText != null) addParameter("showLoadingText", findString(showLoadingText)); + if (beforeNotifyTopics != null) + addParameter("beforeNotifyTopics", findString(beforeNotifyTopics)); + if (afterNotifyTopics != null) + addParameter("afterNotifyTopics", findString(afterNotifyTopics)); + if (errorNotifyTopics != null) + addParameter("errorNotifyTopics", findString(errorNotifyTopics)); } @Override @@ -114,23 +117,6 @@ this.errorText = errorText; } - - /* (non-Javadoc) - * @see org.apache.struts2.components.RemoteUICallBean#setAfterLoading(java.lang.String) - */ - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - - - /* (non-Javadoc) - * @see org.apache.struts2.components.RemoteUICallBean#setBeforeLoading(java.lang.String) - */ - public void setBeforeLoading(String beforeLoading) { - this.beforeLoading = beforeLoading; - } - - @StrutsTagAttribute(description="Javascript code in the fetched content will be executed", type="Boolean", defaultValue="false") public void setExecuteScripts(String executeScripts) { this.executeScripts = executeScripts; @@ -158,7 +144,7 @@ this.formId = formId; } - @StrutsTagAttribute(description="Topics that will published when the remote call completes") + @StrutsTagAttribute(description="Comma delimmited list of topics that will published before and after the request, and on errors") public void setNotifyTopics(String notifyTopics) { this.notifyTopics = notifyTopics; } @@ -197,5 +183,20 @@ @StrutsTagAttribute(description="The name to set for element") public void setName(String name) { super.setName(name); + } + + @StrutsTagAttribute(description="Comma delimmited list of topics that will published after the request(if the request succeeds)") + public void setAfterNotifyTopics(String afterNotifyTopics) { + this.afterNotifyTopics = afterNotifyTopics; + } + + @StrutsTagAttribute(description="Comma delimmited list of topics that will published before the request") + public void setBeforeNotifyTopics(String beforeNotifyTopics) { + this.beforeNotifyTopics = beforeNotifyTopics; + } + + @StrutsTagAttribute(description="Comma delimmited list of topics that will published after the request(if the request fails)") + public void setErrorNotifyTopics(String errorNotifyTopics) { + this.errorNotifyTopics = errorNotifyTopics; } } Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java Sat Mar 17 11:57:22 2007 @@ -118,15 +118,4 @@ public void setTargets(String targets) { this.targets = targets; } - - @StrutsTagAttribute(name="onLoadJS", description="Deprecated. Use 'notifyTopics'. Javascript code execute after reload") - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - - - @StrutsTagAttribute(name="preInvokeJS", description="Deprecated. Use 'notifyTopics'. Javascript code execute before reload") - public void setBeforeLoading(String beforeLoading) { - this.beforeLoading = beforeLoading; - } } Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java Sat Mar 17 11:57:22 2007 @@ -134,11 +134,6 @@ this.refreshOnShow = refreshOnShow; } - @StrutsTagAttribute(description="Deprecated. Use 'notifyTopics'. Javascript code execute after reload") - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - @StrutsTagAttribute(description="Run scripts in a separate scope, unique for each Div", defaultValue="true") public void setSeparateScripts(String separateScripts) { this.separateScripts = separateScripts; Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java Sat Mar 17 11:57:22 2007 @@ -31,9 +31,11 @@ void setErrorText(String errorText); - void setAfterLoading(String afterLoading); + void setAfterNotifyTopics(String afterNotifyTopics); - void setBeforeLoading(String beforeLoading); + void setBeforeNotifyTopics(String beforeNotifyTopics); + + void setErrorNotifyTopics(String errorNotifyTopics); void setExecuteScripts(String executeScripts); Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java Sat Mar 17 11:57:22 2007 @@ -112,13 +112,10 @@ protected String showErrorTransportText; protected String indicator; protected String showLoadingText; - //these two are called "preInvokeJS" and "onLoadJS" on the tld - //Names changed here to keep some consistency - protected String beforeLoading; - protected String afterLoading; - - //this one is called "resultDivId" on the tld protected String targets; + protected String beforeNotifyTopics; + protected String afterNotifyTopics; + protected String errorNotifyTopics; public Submit(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); @@ -149,10 +146,6 @@ addParameter("errorText", findString(errorText)); if (loadingText != null) addParameter("loadingText", findString(loadingText)); - if (afterLoading != null) - addParameter("afterLoading", findString(afterLoading)); - if (beforeLoading != null) - addParameter("beforeLoading", findString(beforeLoading)); if (executeScripts != null) addParameter("executeScripts", findValue(executeScripts, Boolean.class)); if (listenTopics != null) @@ -173,6 +166,14 @@ addParameter("targets", findString(targets)); if (showLoadingText != null) addParameter("showLoadingText", findString(showLoadingText)); + if (showLoadingText != null) + addParameter("showLoadingText", findString(showLoadingText)); + if (beforeNotifyTopics != null) + addParameter("beforeNotifyTopics", findString(beforeNotifyTopics)); + if (afterNotifyTopics != null) + addParameter("afterNotifyTopics", findString(afterNotifyTopics)); + if (errorNotifyTopics != null) + addParameter("errorNotifyTopics", findString(errorNotifyTopics)); } @Override @@ -229,17 +230,6 @@ this.errorText = errorText; } - @StrutsTagAttribute(name="onLoadJS", description="Deprecated. Use 'notifyTopics'. Javascript code execute after reload") - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - - - @StrutsTagAttribute(name="preInvokeJS", description="Deprecated. Use 'notifyTopics'. Javascript code execute before reload") - public void setBeforeLoading(String beforeLoading) { - this.beforeLoading = beforeLoading; - } - @StrutsTagAttribute(description="Javascript code in the fetched content will be executed", type="Boolean", defaultValue="false") public void setExecuteScripts(String executeScripts) { this.executeScripts = executeScripts; @@ -275,12 +265,11 @@ this.targets = targets; } - @StrutsTagAttribute(description="Topics that will published when the remote call completes") + @StrutsTagAttribute(description="Comma delimmited list of topics that will published before and after the request, and on errors") public void setNotifyTopics(String notifyTopics) { this.notifyTopics = notifyTopics; } - @StrutsTagAttribute(description="Set whether errors will be shown or not", type="Boolean", defaultValue="true") public void setShowErrorTransportText(String showErrorTransportText) { this.showErrorTransportText = showErrorTransportText; @@ -330,5 +319,20 @@ @StrutsTagAttribute(description="Label expression used for rendering a element specific label") public void setLabel(String label) { super.setLabel(label); + } + + @StrutsTagAttribute(description="Comma delimmited list of topics that will published after the request(if the request succeeds)") + public void setAfterNotifyTopics(String afterNotifyTopics) { + this.afterNotifyTopics = afterNotifyTopics; + } + + @StrutsTagAttribute(description="Comma delimmited list of topics that will published before the request") + public void setBeforeNotifyTopics(String beforeNotifyTopics) { + this.beforeNotifyTopics = beforeNotifyTopics; + } + + @StrutsTagAttribute(description="Comma delimmited list of topics that will published after the request(if the request fails)") + public void setErrorNotifyTopics(String errorNotifyTopics) { + this.errorNotifyTopics = errorNotifyTopics; } } Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java Sat Mar 17 11:57:22 2007 @@ -27,8 +27,6 @@ protected String notifyTopics; protected String loadingText; protected String errorText; - protected String beforeLoading; - protected String afterLoading; protected String executeScripts; protected String handler; protected String formId; @@ -36,6 +34,9 @@ protected String showErrorTransportText; protected String indicator; protected String showLoadingText; + protected String beforeNotifyTopics; + protected String afterNotifyTopics; + protected String errorNotifyTopics; protected void populateParams() { super.populateParams(); @@ -45,8 +46,6 @@ remote.setListenTopics(listenTopics); remote.setLoadingText(loadingText); remote.setErrorText(errorText); - remote.setAfterLoading(afterLoading); - remote.setBeforeLoading(beforeLoading); remote.setExecuteScripts(executeScripts); remote.setHandler(handler); remote.setFormFilter(formFilter); @@ -55,6 +54,9 @@ remote.setShowErrorTransportText(showErrorTransportText); remote.setIndicator(indicator); remote.setShowLoadingText(showLoadingText); + remote.setAfterNotifyTopics(afterNotifyTopics); + remote.setBeforeNotifyTopics(beforeNotifyTopics); + remote.setErrorNotifyTopics(errorNotifyTopics); } public void setHref(String href) { @@ -73,14 +75,6 @@ this.listenTopics = listenTopics; } - public void setAfterLoading(String afterLoading) { - this.afterLoading = afterLoading; - } - - public void setBeforeLoading(String beforeLoading) { - this.beforeLoading = beforeLoading; - } - public void setExecuteScripts(String executeScripts) { this.executeScripts = executeScripts; } @@ -105,14 +99,23 @@ this.showErrorTransportText = showErrorTransportText; } - /** - * @param indicator The indicator to set. - */ public void setIndicator(String indicator) { this.indicator = indicator; } public void setShowLoadingText(String showLoadingText) { this.showLoadingText = showLoadingText; + } + + public void setAfterNotifyTopics(String afterNotifyTopics) { + this.afterNotifyTopics = afterNotifyTopics; + } + + public void setBeforeNotifyTopics(String beforeNotifyTopics) { + this.beforeNotifyTopics = beforeNotifyTopics; + } + + public void setErrorNotifyTopics(String errorNotifyTopics) { + this.errorNotifyTopics = errorNotifyTopics; } } Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java Sat Mar 17 11:57:22 2007 @@ -52,11 +52,6 @@ public void setTargets(String targets) { this.targets = targets; } - - @Deprecated() - public void setPreInvokeJS(String preInvokeJS) { - this.beforeLoading = preInvokeJS; - } } Modified: struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java (original) +++ struts/struts2/trunk/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java Sat Mar 17 11:57:22 2007 @@ -53,14 +53,10 @@ protected String showErrorTransportText; protected String indicator; protected String showLoadingText; - - //these two are called "preInvokeJS" and "onLoadJS" on the tld - //Names changed here to keep some consistency - protected String beforeLoading; - protected String afterLoading; - - //this one is called "resultDivId" on the tld protected String targets; + protected String beforeNotifyTopics; + protected String afterNotifyTopics; + protected String errorNotifyTopics; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Submit(stack, req, res); @@ -78,8 +74,6 @@ submit.setListenTopics(listenTopics); submit.setLoadingText(loadingText); submit.setErrorText(errorText); - submit.setAfterLoading(afterLoading); - submit.setBeforeLoading(beforeLoading); submit.setExecuteScripts(executeScripts); submit.setHandler(handler); submit.setFormFilter(formFilter); @@ -90,6 +84,9 @@ submit.setShowErrorTransportText(showErrorTransportText); submit.setIndicator(indicator); submit.setShowLoadingText(showLoadingText); + submit.setAfterNotifyTopics(afterNotifyTopics); + submit.setBeforeNotifyTopics(beforeNotifyTopics); + submit.setErrorNotifyTopics(errorNotifyTopics); } public void setAction(String action) { @@ -152,21 +149,6 @@ this.targets = targets; } - @Deprecated - public void setResultDivId(String id) { - this.targets = id; - } - - @Deprecated - public void setOnLoadJS(String postJS) { - this.afterLoading = postJS; - } - - @Deprecated - public void setPreInvokeJS(String preJS) { - this.beforeLoading = preJS; - } - public void setNotifyTopics(String notifyTopics) { this.notifyTopics = notifyTopics; } @@ -181,5 +163,17 @@ public void setShowLoadingText(String showLoadingText) { this.showLoadingText = showLoadingText; + } + + public void setAfterNotifyTopics(String afterNotifyTopics) { + this.afterNotifyTopics = afterNotifyTopics; + } + + public void setBeforeNotifyTopics(String beforeNotifyTopics) { + this.beforeNotifyTopics = beforeNotifyTopics; + } + + public void setErrorNotifyTopics(String errorNotifyTopics) { + this.errorNotifyTopics = errorNotifyTopics; } } 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=519409&r1=519408&r2=519409 ============================================================================== --- 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 Sat Mar 17 11:57:22 2007 @@ -28,11 +28,7 @@ afterNotifyTopics : "", afterNotifyTopicsArray : null, errorNotifyTopics : "", - errorNotifyTopicsArray : "", - - //callbacks - beforeLoading : "", - afterLoading : "", + errorNotifyTopicsArray : null, formId : "", formFilter : "", @@ -62,18 +58,18 @@ } //before topics - if(!dojo.string.isBlank(this.beforeNotifyTopcis)) { - this.beforeNotifyTopcisArray = this.beforeNotifyTopics.split(","); + if(!dojo.string.isBlank(this.beforeNotifyTopics)) { + this.beforeNotifyTopicsArray = this.beforeNotifyTopics.split(","); } //after topics - if(!dojo.string.isBlank(this.afterNotifyTopcis)) { - this.afterNotifyTopcisArray = this.afterNotifyTopics.split(","); + if(!dojo.string.isBlank(this.afterNotifyTopics)) { + this.afterNotifyTopicsArray = this.afterNotifyTopics.split(","); } //error topics - if(!dojo.string.isBlank(this.errorNotifyTopcis)) { - this.errorNotifyTopcisArray = this.errorNotifyTopics.split(","); + if(!dojo.string.isBlank(this.errorNotifyTopics)) { + this.errorNotifyTopicsArray = this.errorNotifyTopics.split(","); } if(!dojo.string.isBlank(this.targets)) { @@ -129,11 +125,6 @@ //hide indicator dojo.html.hide(this.indicator); - //post script - if(!dojo.string.isBlank(this.afterLoading)) { - this.log("Executing " + this.afterLoading); - eval(this.afterLoading); - } //publish topics this.notify(data, type, e); @@ -189,7 +180,7 @@ break; } - this.notifyTo(topicsArray, data, e); + this.notifyTo(topicsArray, data, type, e); }, notifyTo : function(topicsArray, data, e) { @@ -206,36 +197,18 @@ }, onDownloadStart : function(event) { - if(!dojo.string.isBlank(this.beforeLoading)) { - //for backward compatibility - var data = null; - var type = null; - - eval(this.beforeLoading); - } if(this.showLoading && !dojo.string.isBlank(this.loadingText)) { event.text = this.loadingText; } }, reloadContents : function(evt) { - if(!dojo.string.isBlank(this.handler)) { //use custom handler this.log("Invoking handler: " + this.handler); window[this.handler](this, this.domNode); } else { - //pre script - if(!dojo.string.isBlank(this.beforeLoading)) { - this.log("Executing " + this.beforeLoading); - //backward compatibility - var data = null; - var type = null; - - eval(this.beforeLoading); - } - try { var self = this; var request = {cancel: false}; @@ -245,8 +218,7 @@ return; } - //if the href is null, we still call the "beforeLoading" - // and publish the notigy topics + //if the href is null, we still publish the notify topics if(dojo.string.isBlank(this.href)) { return; } @@ -280,8 +252,10 @@ }); } catch(ex) { - var message = dojo.string.isBlank(this.errorText) ? ex : this.errorText; - this.setContent(message); + if(this.showError) { + var message = dojo.string.isBlank(this.errorText) ? ex : this.errorText; + this.setContent(message); + } } } }, 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=519409&r1=519408&r2=519409 ============================================================================== --- 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 Sat Mar 17 11:57:22 2007 @@ -35,6 +35,13 @@ notifyTopicsArray : null, stopTimerListenTopics : "", startTimerListenTopics : "", + beforeNotifyTopics : "", + beforeNotifyTopicsArray : null, + afterNotifyTopics : "", + afterNotifyTopicsArray : null, + errorNotifyTopics : "", + errorNotifyTopicsArray : null, + //callbacks beforeLoading : "", @@ -50,13 +57,6 @@ parseContent : true, onDownloadStart : function(event) { - if(!dojo.string.isBlank(this.beforeLoading)) { - this.log("Executing " + this.beforeLoading); - var result = eval(this.beforeLoading); - if(result !== null && !result) { - return; - } - } if(!this.showLoading) { event.returnValue = false; return; @@ -99,6 +99,35 @@ } }); } + + //before, after and error topics + var topicsArray = null; + switch(type) { + case "before": + topicsArray = this.beforeNotifyTopicsArray; + break; + case "load": + topicsArray = this.afterNotifyTopicsArray; + break; + case "error": + topicsArray = this.errorNotifyTopicsArray; + break; + } + + this.notifyTo(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, e); + } catch(ex){ + self.log(ex); + } + }); + } }, postCreate : function(args, frag) { @@ -160,10 +189,6 @@ } } - if(!dojo.string.isBlank(this.notifyTopics)) { - this.notifyTopicsArray = this.notifyTopics.split(","); - } - if(!dojo.string.isBlank(this.stopTimerListenTopics)) { this.log("Listening to " + this.stopTimerListenTopics + " to stop timer"); var stopTopics = this.stopTimerListenTopics.split(","); @@ -183,6 +208,26 @@ }); } } + + //notify topics + if(!dojo.string.isBlank(this.notifyTopics)) { + this.notifyTopicsArray = this.notifyTopics.split(","); + } + + //before topics + if(!dojo.string.isBlank(this.beforeNotifyTopics)) { + this.beforeNotifyTopicsArray = this.beforeNotifyTopics.split(","); + } + + //after topics + if(!dojo.string.isBlank(this.afterNotifyTopics)) { + this.afterNotifyTopicsArray = this.afterNotifyTopics.split(","); + } + + //error topics + if(!dojo.string.isBlank(this.errorNotifyTopics)) { + this.errorNotifyTopicsArray = this.errorNotifyTopics.split(","); + } }, _downloadExternalContent: function(url, useCache) { @@ -215,12 +260,7 @@ //hide indicator dojo.html.hide(self.indicator); - if(!dojo.string.isBlank(self.afterLoading)) { - self.log("Executing " + self.afterLoading); - eval(self.afterLoading); - } - - self.notify(data, type, null); + self.notify(data, type, e); if(type == "load") { self.onDownloadEnd.call(self, url, data); Modified: struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/ajax-common.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/ajax-common.ftl?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/ajax-common.ftl (original) +++ struts/struts2/trunk/plugins/dojo/src/main/resources/template/ajax/ajax-common.ftl Sat Mar 17 11:57:22 2007 @@ -43,11 +43,14 @@ <#if parameters.notifyTopics?if_exists != ""> notifyTopics="${parameters.notifyTopics?html}"<#rt/> </#if> - <#if parameters.beforeLoading?if_exists != ""> - beforeLoading="${parameters.beforeLoading?html}"<#rt/> + <#if parameters.beforeNotifyTopics?if_exists != ""> + beforeNotifyTopics="${parameters.beforeNotifyTopics?html}"<#rt/> </#if> - <#if parameters.afterLoading?if_exists != ""> - afterLoading="${parameters.afterLoading?html}"<#rt/> + <#if parameters.afterNotifyTopics?if_exists != ""> + afterNotifyTopics="${parameters.afterNotifyTopics?html}"<#rt/> + </#if> + <#if parameters.errorNotifyTopics?if_exists != ""> + errorNotifyTopics="${parameters.errorNotifyTopics?html}"<#rt/> </#if> <#if parameters.targets?if_exists != ""> targets="${parameters.targets?html}"<#rt/> 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=519409&r1=519408&r2=519409 ============================================================================== --- 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 Sat Mar 17 11:57:22 2007 @@ -1,9 +1,3 @@ -<tr> - <td colspan="2"><div <#rt/> -<#if parameters.align?exists> - align="${parameters.align?html}"<#t/> -</#if> -><#t/> <#if parameters.type?exists && parameters.type=="button"> <input type="button" dojoType="struts:Bind" event="onclick"<#rt/> <#include "/${parameters.templateDir}/ajax/ajax-common.ftl"/> @@ -36,6 +30,3 @@ <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> /> </#if> - -</div><#t/> -<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /> Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTest.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTest.java (original) +++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTest.java Sat Mar 17 11:57:22 2007 @@ -38,8 +38,8 @@ tag.setHref("a"); tag.setErrorText("c"); tag.setLoadingText("d"); - tag.setAfterLoading("e"); - tag.setBeforeLoading("f"); + tag.setBeforeNotifyTopics("e"); + tag.setAfterNotifyTopics("f"); tag.setListenTopics("g"); tag.setTargets("h"); tag.setHandler("i"); @@ -47,6 +47,7 @@ tag.setIndicator("k"); tag.setShowErrorTransportText("true"); tag.setShowLoadingText("true"); + tag.setErrorNotifyTopics("l"); tag.doStartTag(); tag.doEndTag(); Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java (original) +++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/DivTest.java Sat Mar 17 11:57:22 2007 @@ -44,13 +44,14 @@ tag.setListenTopics("g"); tag.setStartTimerListenTopics("h"); tag.setStopTimerListenTopics("i"); - tag.setBeforeLoading("j"); - tag.setAfterLoading("k"); + tag.setBeforeNotifyTopics("j"); + tag.setAfterNotifyTopics("k"); tag.setRefreshOnShow("true"); tag.setHandler("l"); tag.setIndicator("m"); tag.setShowLoadingText("true"); tag.setSeparateScripts("false"); + tag.setErrorNotifyTopics("n"); tag.doStartTag(); tag.doEndTag(); Modified: struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/SubmitAjaxTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/SubmitAjaxTest.java?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/SubmitAjaxTest.java (original) +++ struts/struts2/trunk/plugins/dojo/src/test/java/org/apache/struts2/dojo/views/jsp/ui/SubmitAjaxTest.java Sat Mar 17 11:57:22 2007 @@ -35,14 +35,15 @@ tag.setLoadingText("c"); tag.setErrorText("d"); tag.setListenTopics("e"); - tag.setPreInvokeJS("f"); - tag.setOnLoadJS("g"); + tag.setBeforeNotifyTopics("f"); + tag.setAfterNotifyTopics("g"); tag.setHandler("h"); tag.setType("submit"); tag.setLabel("i"); tag.setNotifyTopics("k"); tag.setIndicator("l"); tag.setShowLoadingText("true"); + tag.setErrorNotifyTopics("m"); tag.doStartTag(); tag.doEndTag(); @@ -62,13 +63,14 @@ tag.setLoadingText("c"); tag.setErrorText("d"); tag.setListenTopics("e"); - tag.setPreInvokeJS("f"); - tag.setOnLoadJS("g"); + tag.setBeforeNotifyTopics("f"); + tag.setAfterNotifyTopics("g"); tag.setHandler("h"); tag.setType("button"); tag.setLabel("i"); tag.setNotifyTopics("k"); tag.setIndicator("l"); + tag.setErrorNotifyTopics("m"); tag.doStartTag(); tag.doEndTag(); @@ -88,14 +90,15 @@ tag.setLoadingText("c"); tag.setErrorText("d"); tag.setListenTopics("e"); - tag.setPreInvokeJS("f"); - tag.setOnLoadJS("g"); + tag.setBeforeNotifyTopics("f"); + tag.setAfterNotifyTopics("g"); tag.setHandler("h"); tag.setType("image"); tag.setLabel("i"); tag.setSrc("j"); tag.setNotifyTopics("k"); tag.setIndicator("l"); + tag.setErrorNotifyTopics("m"); tag.doStartTag(); tag.doEndTag(); Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/div-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/div-1.txt?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/div-1.txt (original) +++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/div-1.txt Sat Mar 17 11:57:22 2007 @@ -12,8 +12,9 @@ loadingText="b" errorText="c" listenTopics="g" - beforeLoading="j" - afterLoading="k" + beforeNotifyTopics="j" + afterNotifyTopics="k" + errorNotifyTopics="n" handler="l" indicator="m" showError="true" Modified: struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/href-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/href-1.txt?view=diff&rev=519409&r1=519408&r2=519409 ============================================================================== --- struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/href-1.txt (original) +++ struts/struts2/trunk/plugins/dojo/src/test/resources/org/apache/struts2/dojo/views/jsp/ui/href-1.txt Sat Mar 17 11:57:22 2007 @@ -6,8 +6,9 @@ errorText="c" listenTopics="g" notifyTopics="j" - beforeLoading="f" - afterLoading="e" + beforeNotifyTopics="e" + afterNotifyTopics="f" + errorNotifyTopics="l" targets="h" handler="i" indicator="k" 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=519409&r1=519408&r2=519409 ============================================================================== --- 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 Sat Mar 17 11:57:22 2007 @@ -1,5 +1,3 @@ -<tr> - <td colspan="2"><div align="right"> <input type="submit" dojoType="struts:Bind" @@ -12,12 +10,10 @@ errorText="d" listenTopics="e" notifyTopics="k" - beforeLoading="f" - afterLoading="g" + beforeNotifyTopics="f" + afterNotifyTopics="g" + errorNotifyTopics="m" handler="h" indicator="l" showLoading="true" /> - </div> - </td> - </tr> 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=519409&r1=519408&r2=519409 ============================================================================== --- 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 Sat Mar 17 11:57:22 2007 @@ -1,5 +1,3 @@ -<tr> - <td colspan="2"><div align="right"> <input type="button" dojoType="struts:Bind" @@ -11,12 +9,10 @@ errorText="d" listenTopics="e" notifyTopics="k" - beforeLoading="f" - afterLoading="g" + beforeNotifyTopics="f" + afterNotifyTopics="g" + errorNotifyTopics="m" handler="h" indicator="l" value="i" - /> - </div> - </td> - </tr> + /> \ No newline at end of file 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=519409&r1=519408&r2=519409 ============================================================================== --- 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 Sat Mar 17 11:57:22 2007 @@ -1,5 +1,3 @@ -<tr> - <td colspan="2"><div align="right"> <input type="image" dojoType="struts:Bind" @@ -14,11 +12,9 @@ errorText="d" listenTopics="e" notifyTopics="k" - beforeLoading="f" - afterLoading="g" + beforeNotifyTopics="f" + afterNotifyTopics="g" + errorNotifyTopics="m" handler="h" indicator="l" - /> - </div> - </td> - </tr> + /> \ No newline at end of file