Author: musachy Date: Thu Feb 15 18:07:56 2007 New Revision: 508280 URL: http://svn.apache.org/viewvc?view=rev&rev=508280 Log: WW-1570: Add "showLoading" attribute to ajax tags
Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Anchor.java struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Div.java struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/RemoteUICallBean.java struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Submit.java struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/ajax/ajax-common.ftl struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/a.html struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/div.html struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/submit.html struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/div-1.txt struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-1.txt struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/submit-ajax-1.txt Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java Thu Feb 15 18:07:56 2007 @@ -49,6 +49,7 @@ protected String notifyTopics; protected String showErrorTransportText; protected String indicator; + protected String showLoadingText; public AbstractRemoteCallUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { @@ -86,6 +87,8 @@ addParameter("showErrorTransportText", findValue(showErrorTransportText, Boolean.class)); else addParameter("showErrorTransportText", true); + if (showLoadingText != null) + addParameter("showLoadingText", findString(showLoadingText)); } @@ -165,4 +168,8 @@ this.indicator = indicator; } + @StrutsTagAttribute(description="Show loading text on targets", type="Boolean", defaultValue="true") + public void setShowLoadingText(String showLoadingText) { + this.showLoadingText = showLoadingText; + } } Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Anchor.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Anchor.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Anchor.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Anchor.java Thu Feb 15 18:07:56 2007 @@ -71,6 +71,7 @@ * 'listenTopics' comma separated list of topics names, that will trigger a request * 'indicator' element to be shown while the request executing * 'showErrorTransportText': whether errors should be displayed (on 'targets')</p> + * 'showLoadingText' show loading text on targets</p> * 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:<p/> * <ul> * <li>data: html or json object when type='load' or type='error'</li> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Div.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Div.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Div.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Div.java Thu Feb 15 18:07:56 2007 @@ -76,6 +76,7 @@ * 'listenTopics' comma separated list of topics names, that will trigger a request * 'indicator' element to be shown while the request executing * 'showErrorTransportText': whether errors should be displayed (on 'targets')</p> + * 'showLoadingText' show loading text on targets</p> * 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed: * <ul> * <li>data: html or json object when type='load' or type='error'</li> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/RemoteUICallBean.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/RemoteUICallBean.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/RemoteUICallBean.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/RemoteUICallBean.java Thu Feb 15 18:07:56 2007 @@ -47,6 +47,8 @@ void setShowErrorTransportText(String showError); + void setShowLoadingText(String showLoadingText); + void setIndicator(String indicator); } Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Submit.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Submit.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Submit.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/components/Submit.java Thu Feb 15 18:07:56 2007 @@ -101,6 +101,7 @@ * 'listenTopics' comma separated list of topics names, that will trigger a request * 'indicator' element to be shown while the request executing * 'showErrorTransportText': whether errors should be displayed (on 'targets')</p> + * 'showLoadingText' show loading text on targets</p> * 'notifyTopics' comma separated list of topics names, that will be published. Three parameters are passed:<p/> * <ul> * <li>data: html or json object when type='load' or type='error'</li> @@ -154,7 +155,7 @@ protected String notifyTopics; 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; @@ -214,6 +215,8 @@ addParameter("indicator", findString(indicator)); if (targets != null) addParameter("targets", findString(targets)); + if (showLoadingText != null) + addParameter("showLoadingText", findString(showLoadingText)); } /** @@ -326,5 +329,10 @@ @StrutsTagAttribute(description="Set indicator") public void setIndicator(String indicator) { this.indicator = indicator; + } + + @StrutsTagAttribute(description="Show loading text on targets", type="Boolean", defaultValue="true") + public void setShowLoadingText(String showLoadingText) { + this.showLoadingText = showLoadingText; } } Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java Thu Feb 15 18:07:56 2007 @@ -34,6 +34,7 @@ protected String formFilter; protected String showErrorTransportText; protected String indicator; + protected String showLoadingText; protected void populateParams() { super.populateParams(); @@ -52,6 +53,7 @@ remote.setNotifyTopics(notifyTopics); remote.setShowErrorTransportText(showErrorTransportText); remote.setIndicator(indicator); + remote.setShowLoadingText(showLoadingText); } public void setHref(String href) { @@ -107,5 +109,9 @@ */ public void setIndicator(String indicator) { this.indicator = indicator; + } + + public void setShowLoadingText(String showLoadingText) { + this.showLoadingText = showLoadingText; } } Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java Thu Feb 15 18:07:56 2007 @@ -51,6 +51,7 @@ protected String src; 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 @@ -87,6 +88,7 @@ submit.setNotifyTopics(notifyTopics); submit.setShowErrorTransportText(showErrorTransportText); submit.setIndicator(indicator); + submit.setShowLoadingText(showLoadingText); } public void setAction(String action) { @@ -174,5 +176,9 @@ public void setIndicator(String indicator) { this.indicator = indicator; + } + + public void setShowLoadingText(String showLoadingText) { + this.showLoadingText = showLoadingText; } } Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/ajax/ajax-common.ftl URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/ajax/ajax-common.ftl?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/ajax/ajax-common.ftl (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/template/ajax/ajax-common.ftl Thu Feb 15 18:07:56 2007 @@ -61,3 +61,6 @@ <#if parameters.showErrorTransportText?exists> showError="${parameters.showErrorTransportText?string?html}"<#rt/> </#if> + <#if parameters.showLoadingText?exists> + showLoading="${parameters.showLoadingText?string?html}"<#rt/> + </#if> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/a.html URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/a.html?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/a.html (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/a.html Thu Feb 15 18:07:56 2007 @@ -340,6 +340,14 @@ <td align="left" valign="top">Set whether errors will be shown or not</td> </tr> <tr> + <td align="left" valign="top">showLoadingText</td> + <td align="left" valign="top">false</td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">Boolean</td> + <td align="left" valign="top">Show loading text on targets</td> + </tr> + <tr> <td align="left" valign="top">tabindex</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/div.html URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/div.html?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/div.html (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/div.html Thu Feb 15 18:07:56 2007 @@ -356,6 +356,14 @@ <td align="left" valign="top">Set whether errors will be shown or not</td> </tr> <tr> + <td align="left" valign="top">showLoadingText</td> + <td align="left" valign="top">false</td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">Boolean</td> + <td align="left" valign="top">Show loading text on targets</td> + </tr> + <tr> <td align="left" valign="top">startTimerListenTopics</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/submit.html URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/submit.html?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/submit.html (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/site/resources/tags/submit.html Thu Feb 15 18:07:56 2007 @@ -356,6 +356,14 @@ <td align="left" valign="top">Set whether errors will be shown or not</td> </tr> <tr> + <td align="left" valign="top">showLoadingText</td> + <td align="left" valign="top">false</td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">Boolean</td> + <td align="left" valign="top">Show loading text on targets</td> + </tr> + <tr> <td align="left" valign="top">src</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java Thu Feb 15 18:07:56 2007 @@ -49,6 +49,7 @@ tag.setNotifyTopics("j"); tag.setIndicator("k"); tag.setShowErrorTransportText("true"); + tag.setShowLoadingText("true"); tag.doStartTag(); tag.doEndTag(); Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/DivTest.java Thu Feb 15 18:07:56 2007 @@ -67,6 +67,7 @@ tag.setRefreshOnShow("true"); tag.setHandler("l"); tag.setIndicator("m"); + tag.setShowLoadingText("true"); tag.doStartTag(); tag.doEndTag(); Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitAjaxTest.java Thu Feb 15 18:07:56 2007 @@ -60,10 +60,11 @@ tag.setLabel("i"); tag.setNotifyTopics("k"); tag.setIndicator("l"); + tag.setShowLoadingText("true"); tag.doStartTag(); tag.doEndTag(); - verify(DivTest.class.getResource("submit-ajax-1.txt")); + verify(SubmitAjaxTest.class.getResource("submit-ajax-1.txt")); } public void testButton() throws Exception { @@ -89,7 +90,7 @@ tag.doStartTag(); tag.doEndTag(); - verify(DivTest.class.getResource("submit-ajax-2.txt")); + verify(SubmitAjaxTest.class.getResource("submit-ajax-2.txt")); } public void testImage() throws Exception { @@ -116,6 +117,6 @@ tag.doStartTag(); tag.doEndTag(); - verify(DivTest.class.getResource("submit-ajax-3.txt")); + verify(SubmitAjaxTest.class.getResource("submit-ajax-3.txt")); } } Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/div-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/div-1.txt?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/div-1.txt (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/div-1.txt Thu Feb 15 18:07:56 2007 @@ -14,5 +14,6 @@ afterLoading="k" handler="l" indicator="m" - showError="true"> + showError="true" + showLoading="true"> </div> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-1.txt?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-1.txt (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/href-1.txt Thu Feb 15 18:07:56 2007 @@ -11,5 +11,6 @@ targets="h" handler="i" indicator="k" - showError="true"> + showError="true" + showLoading="true"> </a> Modified: struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/submit-ajax-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/submit-ajax-1.txt?view=diff&rev=508280&r1=508279&r2=508280 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/submit-ajax-1.txt (original) +++ struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/submit-ajax-1.txt Thu Feb 15 18:07:56 2007 @@ -16,6 +16,7 @@ afterLoading="g" handler="h" indicator="l" + showLoading="true" /> </div> </td>