Author: musachy Date: Sat Mar 17 11:58:20 2007 New Revision: 519410 URL: http://svn.apache.org/viewvc?view=rev&rev=519410 Log: WW-1607 * Remove usage of deprecated attributes "beforeLoading", "afterLoading", "resultDivId", "preInvokeJS", "onLoadJS" * Add examples of attributes "beforeNotifyTopics", "afterNotifyTopics", "errorNotifyTopics"
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example9.jsp struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example9.jsp URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example9.jsp?view=diff&rev=519410&r1=519409&r2=519410 ============================================================================== --- struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example9.jsp (original) +++ struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotediv/example9.jsp Sat Mar 17 11:58:20 2007 @@ -21,11 +21,18 @@ dojo.event.topic.registerPublisher("/startTimer", controller, "start"); dojo.event.topic.registerPublisher("/stopTimer", controller, "stop"); + dojo.event.topic.subscribe("/before", function(data, type, e){ + alert('inside a topic event. before request'); + //data : source element id + //type : "before" + //e : request object + }); + dojo.event.topic.subscribe("/after", function(data, type, e){ - alert('inside a topic event. type='+type); + alert('inside a topic event. after request'); //data : text returned - //type : "before", "load" or "error" - //e : request object + //type : "load" + //e : undefined }); </script> @@ -37,7 +44,7 @@ <s:url id="ajaxTest" value="/AjaxTest.action" /> <sx:div - id="once" + id="div1" cssStyle="border: 1px solid yellow;" href="%{ajaxTest}" listenTopics="/refresh" @@ -45,8 +52,8 @@ stopTimerListenTopics="/stopTimer" updateFreq="10000" autoStart="false" - afterLoading="alert('after request')" - notifyTopics="/after" + beforeNotifyTopics="/before" + afterNotifyTopics="/after" > Initial Content</sx:div> Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp?view=diff&rev=519410&r1=519409&r2=519410 ============================================================================== --- struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp (original) +++ struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/remotelink/index.jsp Sat Mar 17 11:58:20 2007 @@ -14,10 +14,32 @@ dojo.byId(widget.targetsArray[0]).innerHTML = "Done"; } + dojo.event.topic.subscribe("/before", function(data, type, e){ + alert('inside a topic event. before request'); + //data : source element id + //type : "before" + //e : request object + }); + dojo.event.topic.subscribe("/after", function(data, type, e){ + alert('inside a topic event. after request'); + //data : text returned + //type : "load" + //e : undefined + }); + + dojo.event.topic.subscribe("/error", function(data, type, e){ + alert('inside a topic event. on error'); + //data : error object + //type : "error" + //e : undefined + }); + + dojo.event.topic.subscribe("/topics", function(data, type, e){ alert('inside a topic event. type='+type); + debugger; //data : text returned - //type : "before", "load" or "error" + //type : "before", "load", "error" //e : request object }); </script> @@ -37,10 +59,12 @@ <br/><br/> -<sx:a +<sx:a id="link1" href="%{ajaxTest}" indicator="indicator" - targets="t1,t2" notifyTopics="/after" >Update 'Div 1' and 'Div 2', publish topic '/after', use indicator</sx:a> + targets="t1,t2" + beforeNotifyTopics="/before" + afterNotifyTopics="/after" >Update 'Div 1' and 'Div 2', publish topic '/before' and '/after', use indicator</sx:a> <img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/> <br/><br/> @@ -48,7 +72,8 @@ <sx:a id="link2" href="/AjaxNoUrl.jsp" errorText="Error Loading" - targets="t1">Try to update 'Div 1', use custom error message</sx:a> + targets="t1" + errorNotifyTopics="/error">Try to update 'Div 1', publish '/error', use custom error message</sx:a> <br/><br/>