mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-1925 Add a "transport" attribute to tags Bind, Anchor and Submit, and Div
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@543218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -50,6 +50,7 @@ public abstract class AbstractRemoteBean extends ClosingUIBean implements Remote
|
||||
protected String highlightColor;
|
||||
protected String highlightDuration;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
|
||||
public AbstractRemoteBean(ValueStack stack, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
@@ -97,6 +98,8 @@ public abstract class AbstractRemoteBean extends ClosingUIBean implements Remote
|
||||
addParameter("highlightDuration", findString(highlightDuration));
|
||||
if (separateScripts != null)
|
||||
addParameter("separateScripts", findValue(separateScripts, Boolean.class));
|
||||
if (transport != null)
|
||||
addParameter("transport", findString(transport));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -225,4 +228,9 @@ public abstract class AbstractRemoteBean extends ClosingUIBean implements Remote
|
||||
public void setSeparateScripts(String separateScripts) {
|
||||
this.separateScripts = separateScripts;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Transport used by Dojo to make the request", defaultValue="XMLHTTPTransport")
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ public abstract class AbstractValidateBean extends AbstractRemoteBean {
|
||||
this.validate = validate;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description = "Make an asynchronous request if validation succeeds. Only valid is 'validate' is 'true'", type="Boolean",
|
||||
@StrutsTagAttribute(description = "Make an asynchronous request if validation succeeds. Only valid if 'validate' is 'true'", type="Boolean",
|
||||
defaultValue = "false")
|
||||
public void setAjaxAfterValidation(String ajaxAfterValidation) {
|
||||
this.ajaxAfterValidation = ajaxAfterValidation;
|
||||
|
||||
@@ -148,6 +148,7 @@ public class Autocompleter extends ComboBox {
|
||||
protected String errorNotifyTopics;
|
||||
protected String valueNotifyTopics;
|
||||
protected String resultsLimit;
|
||||
protected String transport;
|
||||
|
||||
public Autocompleter(ValueStack stack, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
@@ -218,6 +219,8 @@ public class Autocompleter extends ComboBox {
|
||||
keyName = name + "Key";
|
||||
addParameter("keyName", findString(keyName));
|
||||
}
|
||||
if (transport != null)
|
||||
addParameter("transport", findString(transport));
|
||||
|
||||
String keyNameExpr = "%{" + keyName + "}";
|
||||
addParameter("key", findString(keyNameExpr));
|
||||
@@ -401,8 +404,13 @@ public class Autocompleter extends ComboBox {
|
||||
this.valueNotifyTopics = valueNotifyTopics;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Limit how many results are shown as autocompletion options", defaultValue="30")
|
||||
@StrutsTagAttribute(description="Limit how many results are shown as autocompletion options, set to -1 for unlimited results", defaultValue="30")
|
||||
public void setResultsLimit(String resultsLimit) {
|
||||
this.resultsLimit = resultsLimit;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Transport used by Dojo to make the request", defaultValue="XMLHTTPTransport")
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* <p>
|
||||
* This tag will generated event listeners for multiple events on multiple sources,
|
||||
* This tag will generate event listeners for multiple events on multiple sources,
|
||||
* making an asynchronous request to the specified href, and updating multiple targets.
|
||||
* </p>
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
@@ -304,4 +304,9 @@ public class Bind extends AbstractValidateBean {
|
||||
public void setSeparateScripts(String separateScripts) {
|
||||
this.separateScripts = separateScripts;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Transport used by Dojo to make the request", defaultValue="XMLHTTPTransport")
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,4 +64,6 @@ public interface RemoteBean {
|
||||
void setHighlightDuration(String color);
|
||||
|
||||
void setSeparateScripts(String separateScripts);
|
||||
|
||||
void setTransport(String transport);
|
||||
}
|
||||
|
||||
@@ -175,6 +175,7 @@ public class Submit extends FormButton implements RemoteBean {
|
||||
protected String validate;
|
||||
protected String ajaxAfterValidation;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
|
||||
public Submit(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -239,6 +240,8 @@ public class Submit extends FormButton implements RemoteBean {
|
||||
addParameter("highlightDuration", findString(highlightDuration));
|
||||
if (separateScripts != null)
|
||||
addParameter("separateScripts", findValue(separateScripts, Boolean.class));
|
||||
if (transport != null)
|
||||
addParameter("transport", findString(transport));
|
||||
|
||||
Boolean validateValue = false;
|
||||
if (validate != null) {
|
||||
@@ -432,7 +435,7 @@ public class Submit extends FormButton implements RemoteBean {
|
||||
this.validate = validate;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description = "Make an asynchronous request if validation succeeds. Only valid is 'validate' is 'true'", type="Boolean",
|
||||
@StrutsTagAttribute(description = "Make an asynchronous request if validation succeeds. Only valid if 'validate' is 'true'", type="Boolean",
|
||||
defaultValue = "false")
|
||||
public void setAjaxAfterValidation(String ajaxAfterValidation) {
|
||||
this.ajaxAfterValidation = ajaxAfterValidation;
|
||||
@@ -447,4 +450,9 @@ public class Submit extends FormButton implements RemoteBean {
|
||||
public void setSeparateScripts(String separateScripts) {
|
||||
this.separateScripts = separateScripts;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Transport used by Dojo to make the request", defaultValue="XMLHTTPTransport")
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public abstract class AbstractRemoteTag extends AbstractClosingTag {
|
||||
protected String highlightColor;
|
||||
protected String highlightDuration;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
|
||||
protected void populateParams() {
|
||||
super.populateParams();
|
||||
@@ -63,6 +64,7 @@ public abstract class AbstractRemoteTag extends AbstractClosingTag {
|
||||
remote.setHighlightColor(highlightColor);
|
||||
remote.setHighlightDuration(highlightDuration);
|
||||
remote.setSeparateScripts(separateScripts);
|
||||
remote.setTransport(transport);
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
@@ -136,4 +138,8 @@ public abstract class AbstractRemoteTag extends AbstractClosingTag {
|
||||
public void setSeparateScripts(String separateScripts) {
|
||||
this.separateScripts = separateScripts;
|
||||
}
|
||||
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class AutocompleterTag extends ComboBoxTag {
|
||||
protected String errorNotifyTopics;
|
||||
protected String valueNotifyTopics;
|
||||
protected String resultsLimit;
|
||||
protected String transport;
|
||||
|
||||
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
|
||||
return new Autocompleter(stack, req, res);
|
||||
@@ -94,6 +95,7 @@ public class AutocompleterTag extends ComboBoxTag {
|
||||
autocompleter.setErrorNotifyTopics(errorNotifyTopics);
|
||||
autocompleter.setValueNotifyTopics(valueNotifyTopics);
|
||||
autocompleter.setResultsLimit(resultsLimit);
|
||||
autocompleter.setTransport(transport);
|
||||
}
|
||||
|
||||
public void setAutoComplete(String autoComplete) {
|
||||
@@ -199,4 +201,8 @@ public class AutocompleterTag extends ComboBoxTag {
|
||||
public void setResultsLimit(String resultsLimit) {
|
||||
this.resultsLimit = resultsLimit;
|
||||
}
|
||||
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public class SubmitTag extends AbstractUITag {
|
||||
protected String validate;
|
||||
protected String ajaxAfterValidation;
|
||||
protected String separateScripts;
|
||||
protected String transport;
|
||||
|
||||
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
|
||||
return new Submit(stack, req, res);
|
||||
@@ -95,6 +96,7 @@ public class SubmitTag extends AbstractUITag {
|
||||
submit.setValidate(validate);
|
||||
submit.setAjaxAfterValidation(ajaxAfterValidation);
|
||||
submit.setSeparateScripts(separateScripts);
|
||||
submit.setTransport(transport);
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
@@ -200,4 +202,8 @@ public class SubmitTag extends AbstractUITag {
|
||||
public void setSeparateScripts(String separateScripts) {
|
||||
this.separateScripts = separateScripts;
|
||||
}
|
||||
|
||||
public void setTransport(String transport) {
|
||||
this.transport = transport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ dojo.widget.defineWidget(
|
||||
scriptSeparation : true,
|
||||
//scope for the cript separation
|
||||
scriptScope : null,
|
||||
transport : "",
|
||||
|
||||
postCreate : function() {
|
||||
var self = this;
|
||||
@@ -306,6 +307,7 @@ dojo.widget.defineWidget(
|
||||
preventCache: true,
|
||||
formNode: self.formNode,
|
||||
formFilter: window[self.formFilter],
|
||||
transport: self.transport,
|
||||
handler: function(type, data, e) {
|
||||
dojo.lang.hitch(self, "bindHandler")(type, data, e);
|
||||
},
|
||||
|
||||
+3
@@ -62,6 +62,8 @@ dojo.widget.defineWidget(
|
||||
//only used when inside a tabbedpanel
|
||||
disabled : false,
|
||||
|
||||
transport : "",
|
||||
|
||||
onDownloadStart : function(event) {
|
||||
if(!this.showLoading) {
|
||||
event.returnValue = false;
|
||||
@@ -257,6 +259,7 @@ dojo.widget.defineWidget(
|
||||
mimetype: "text/html",
|
||||
formNode: dojo.byId(self.formId),
|
||||
formFilter: window[self.formFilter],
|
||||
transport: self.transport,
|
||||
handler: function(type, data, e) {
|
||||
//hide indicator
|
||||
dojo.html.hide(self.indicator);
|
||||
|
||||
+5
-1
@@ -17,7 +17,8 @@ struts.widget.ComboBoxDataProvider = function(combobox, node){
|
||||
this.cbox = combobox;
|
||||
this.formId = this.cbox.formId;
|
||||
this.formFilter = this.cbox.formFilter;
|
||||
|
||||
this.transport = this.cbox.transport;
|
||||
|
||||
this.getData = function(/*String*/ url){
|
||||
//show indicator
|
||||
dojo.html.show(this.cbox.indicator);
|
||||
@@ -26,6 +27,7 @@ struts.widget.ComboBoxDataProvider = function(combobox, node){
|
||||
url: url,
|
||||
formNode: dojo.byId(this.formId),
|
||||
formFilter: window[this.formFilter],
|
||||
transport: this.transport,
|
||||
handler: dojo.lang.hitch(this, function(type, data, evt) {
|
||||
//hide indicator
|
||||
dojo.html.hide(this.cbox.indicator);
|
||||
@@ -250,6 +252,8 @@ dojo.widget.defineWidget(
|
||||
//how many results are shown
|
||||
searchLimit : 30,
|
||||
|
||||
transport : "",
|
||||
|
||||
//from Dojo's ComboBox
|
||||
showResultList: function() {
|
||||
// Our dear friend IE doesnt take max-height so we need to calculate that on our own every time
|
||||
|
||||
@@ -76,3 +76,6 @@
|
||||
<#if parameters.separateScripts?exists>
|
||||
scriptSeparation="${parameters.separateScripts?string?html}"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.transport?if_exists != "">
|
||||
transport="${parameters.transport?html}"<#rt/>
|
||||
</#if>
|
||||
|
||||
@@ -107,6 +107,9 @@
|
||||
<#if parameters.searchLimit?if_exists != "">
|
||||
searchLimit="${parameters.searchLimit?html}"
|
||||
</#if>
|
||||
<#if parameters.transport?if_exists != "">
|
||||
transport="${parameters.transport?html}"<#rt/>
|
||||
</#if>
|
||||
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
|
||||
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
|
||||
<#if parameters.href?exists>
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
</#if>
|
||||
<#if parameters.separateScripts?exists>
|
||||
"scriptSeparation": ${parameters.separateScripts?string?html},<#rt/>
|
||||
</#if>
|
||||
<#if parameters.transport?if_exists != "">
|
||||
"transport": "${parameters.transport?html}"<#rt/>
|
||||
</#if>
|
||||
});
|
||||
});
|
||||
|
||||
@@ -53,6 +53,7 @@ public class AnchorTest extends AbstractUITagTest {
|
||||
tag.setValidate("true");
|
||||
tag.setAjaxAfterValidation("true");
|
||||
tag.setSeparateScripts("true");
|
||||
tag.setTransport("o");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class AutocompleterTest extends AbstractUITagTest {
|
||||
tag.setDataFieldName("k");
|
||||
tag.setValueNotifyTopics("l");
|
||||
tag.setResultsLimit("2");
|
||||
tag.setTransport("m");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ public class BindTest extends AbstractUITagTest {
|
||||
tag.setHighlightDuration("q");
|
||||
tag.setValidate("true");
|
||||
tag.setSeparateScripts("true");
|
||||
tag.setTransport("q");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ public class DivTest extends AbstractUITagTest {
|
||||
tag.setClosable("true");
|
||||
tag.setHighlightColor("o");
|
||||
tag.setHighlightDuration("p");
|
||||
tag.setTransport("q");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class SubmitAjaxTest extends AbstractUITagTest {
|
||||
tag.setAjaxAfterValidation("true");
|
||||
tag.setSeparateScripts("true");
|
||||
tag.setTabindex("1");
|
||||
tag.setTransport("p");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
+3
-1
@@ -19,4 +19,6 @@
|
||||
buttonSrc="i"
|
||||
templateCssPath="j"
|
||||
dataFieldName="k"
|
||||
searchLimit="2"/>
|
||||
searchLimit="2"
|
||||
transport="m"
|
||||
/>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"validate": true,
|
||||
"ajaxAfterValidation":false,
|
||||
"scriptSeparation": true,
|
||||
"transport": "q"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -21,5 +21,6 @@
|
||||
showLoading="true"
|
||||
highlightColor="o"
|
||||
highlightDuration="p"
|
||||
scriptSeparation="false">
|
||||
scriptSeparation="false"
|
||||
transport="q">
|
||||
</div>
|
||||
|
||||
@@ -18,5 +18,6 @@
|
||||
showLoading="true"
|
||||
highlightColor="m"
|
||||
highlightDuration="n"
|
||||
scriptSeparation="true">
|
||||
scriptSeparation="true"
|
||||
transport="o">
|
||||
</a>
|
||||
|
||||
@@ -22,4 +22,5 @@
|
||||
highlightColor="n"
|
||||
highlightDuration="o"
|
||||
scriptSeparation="true"
|
||||
transport="p"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user