mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-2220 Autocompleter tag does not provide a way to specify initial key value
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@580386 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -228,6 +228,7 @@ public class Autocompleter extends ComboBox {
|
||||
protected String resultsLimit;
|
||||
protected String transport;
|
||||
protected String preload;
|
||||
protected String keyValue;
|
||||
|
||||
public Autocompleter(ValueStack stack, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
@@ -303,8 +304,13 @@ public class Autocompleter extends ComboBox {
|
||||
if (preload != null)
|
||||
addParameter("preload", findValue(preload, Boolean.class));
|
||||
|
||||
String keyNameExpr = "%{" + keyName + "}";
|
||||
addParameter("key", findString(keyNameExpr));
|
||||
if (keyValue != null)
|
||||
addParameter("nameKeyValue", findString(keyValue));
|
||||
else {
|
||||
String keyNameExpr = "%{" + keyName + "}";
|
||||
addParameter("nameKeyValue", findString(keyNameExpr));
|
||||
}
|
||||
|
||||
|
||||
if (beforeNotifyTopics != null)
|
||||
addParameter("beforeNotifyTopics", findString(beforeNotifyTopics));
|
||||
@@ -507,4 +513,9 @@ public class Autocompleter extends ComboBox {
|
||||
public void setPreload(String preload) {
|
||||
this.preload = preload;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Initial key value")
|
||||
public void setKeyValue(String keyValue) {
|
||||
this.keyValue = keyValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class AutocompleterTag extends ComboBoxTag {
|
||||
protected String resultsLimit;
|
||||
protected String transport;
|
||||
protected String preload;
|
||||
protected String keyValue;
|
||||
|
||||
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
|
||||
return new Autocompleter(stack, req, res);
|
||||
@@ -98,6 +99,7 @@ public class AutocompleterTag extends ComboBoxTag {
|
||||
autocompleter.setResultsLimit(resultsLimit);
|
||||
autocompleter.setTransport(transport);
|
||||
autocompleter.setPreload(preload);
|
||||
autocompleter.setKeyValue(keyValue);
|
||||
}
|
||||
|
||||
public void setAutoComplete(String autoComplete) {
|
||||
@@ -211,4 +213,8 @@ public class AutocompleterTag extends ComboBoxTag {
|
||||
public void setPreload(String preload) {
|
||||
this.preload = preload;
|
||||
}
|
||||
|
||||
public void setKeyValue(String keyValue) {
|
||||
this.keyValue = keyValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@
|
||||
<#if parameters.nameValue?if_exists != "">
|
||||
initialValue="${parameters.nameValue}"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.key?if_exists != "">
|
||||
initialKey="${parameters.key}"<#rt/>
|
||||
<#if parameters.nameKeyValue?if_exists != "">
|
||||
initialKey="${parameters.nameKeyValue}"<#rt/>
|
||||
</#if>
|
||||
<#if parameters.readonly?default(false)>
|
||||
readonly="readonly"<#rt/>
|
||||
|
||||
@@ -52,6 +52,7 @@ public class AutocompleterTest extends AbstractUITagTest {
|
||||
tag.setResultsLimit("2");
|
||||
tag.setTransport("m");
|
||||
tag.setPreload("true");
|
||||
tag.setKeyValue("key");
|
||||
tag.doStartTag();
|
||||
tag.doEndTag();
|
||||
|
||||
|
||||
+1
@@ -11,6 +11,7 @@
|
||||
name="f"
|
||||
keyName="i"
|
||||
initialValue="g"
|
||||
initialKey="key"
|
||||
valueNotifyTopics="l"
|
||||
indicator="h"
|
||||
loadOnType="true"
|
||||
|
||||
Reference in New Issue
Block a user