You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by hu...@apache.org on 2006/11/28 03:34:14 UTC
svn commit: r479854 - in /struts/struts2/trunk:
apps/showcase/src/main/webapp/ajax/
apps/showcase/src/main/webapp/ajax/autocompleter/
core/src/main/java/org/apache/struts2/components/
core/src/main/resources/META-INF/ core/src/main/resources/org/apache...
Author: husted
Date: Mon Nov 27 18:34:13 2006
New Revision: 479854
URL: http://svn.apache.org/viewvc?view=rev&rev=479854
Log:
WW-1522 "Automatic Alias ActionConfigs" - Apply second patch.
Added:
struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/JSONList.js
struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/autocompleter/
struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/autocompleter/index.jsp
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Autocompleter.java
struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js
struts/struts2/trunk/core/src/main/resources/template/ajax/dojoRequire.js
Added: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/JSONList.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/JSONList.js?view=auto&rev=479854
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/JSONList.js (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/JSONList.js Mon Nov 27 18:34:13 2006
@@ -0,0 +1,63 @@
+[
+ ["Alabama","AL"],
+ ["Alaska","AK"],
+ ["American Samoa","AS"],
+ ["Arizona","AZ"],
+ ["Arkansas","AR"],
+ ["Armed Forces Europe","AE"],
+ ["Armed Forces Pacific","AP"],
+ ["Armed Forces the Americas","AA"],
+ ["California","CA"],
+ ["Colorado","CO"],
+ ["Connecticut","CT"],
+ ["Delaware","DE"],
+ ["District of Columbia","DC"],
+ ["Federated States of Micronesia","FM"],
+ ["Florida","FL"],
+ ["Georgia","GA"],
+ ["Guam","GU"],
+ ["Hawaii","HI"],
+ ["Idaho","ID"],
+ ["Illinois","IL"],
+ ["Indiana","IN"],
+ ["Iowa","IA"],
+ ["Kansas","KS"],
+ ["Kentucky","KY"],
+ ["Louisiana","LA"],
+ ["Maine","ME"],
+ ["Marshall Islands","MH"],
+ ["Maryland","MD"],
+ ["Massachusetts","MA"],
+ ["Michigan","MI"],
+ ["Minnesota","MN"],
+ ["Mississippi","MS"],
+ ["Missouri","MO"],
+ ["Montana","MT"],
+ ["Nebraska","NE"],
+ ["Nevada","NV"],
+ ["New Hampshire","NH"],
+ ["New Jersey","NJ"],
+ ["New Mexico","NM"],
+ ["New York","NY"],
+ ["North Carolina","NC"],
+ ["North Dakota","ND"],
+ ["Northern Mariana Islands","MP"],
+ ["Ohio","OH"],
+ ["Oklahoma","OK"],
+ ["Oregon","OR"],
+ ["Pennsylvania","PA"],
+ ["Puerto Rico","PR"],
+ ["Rhode Island","RI"],
+ ["South Carolina","SC"],
+ ["South Dakota","SD"],
+ ["Tennessee","TN"],
+ ["Texas","TX"],
+ ["Utah","UT"],
+ ["Vermont","VT"],
+ ["Virgin Islands, U.S.","VI"],
+ ["Virginia","VA"],
+ ["Washington","WA"],
+ ["West Virginia","WV"],
+ ["Wisconsin","WI"],
+ ["Wyoming","WY"]
+]
Added: struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/autocompleter/index.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/autocompleter/index.jsp?view=auto&rev=479854
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/autocompleter/index.jsp (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/ajax/autocompleter/index.jsp Mon Nov 27 18:34:13 2006
@@ -0,0 +1,57 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<html>
+<head>
+ <title>Ajax Examples</title>
+
+ <!--// START SNIPPET: common-include-->
+ <jsp:include page="/ajax/commonInclude.jsp"/>
+ <!--// END SNIPPET: common-include-->
+</head>
+
+<body>
+
+Using a JSON list returned from an action (href="/JSONList.action"), without autoComplete (autoComplete="false")
+<br/>
+<s:autocompleter theme="ajax" href="/JSONList.action" cssStyle="width: 200px;" autoComplete="false" id="ii"/>
+
+<br/>
+<br/>
+
+Using a JSON list returned from an action (href="/JSONList.action"), with autoComplete (autoComplete="true")
+<br/>
+<s:autocompleter theme="ajax" href="/JSONList.action" cssStyle="width: 200px;" autoComplete="true" id="ii"/>
+
+<br/>
+<br/>
+
+Using a local list (list="{'apple','banana','grape','pear'}")
+<br/>
+<s:autocompleter theme="simple" list="{'apple','banana','grape','pear'}" name="Aa" cssStyle="width: 150px;"/>
+
+<br/>
+<br/>
+
+Force valid options (forceValidOption="true")
+<br/>
+<s:autocompleter theme="ajax" href="/JSONList.action" cssStyle="width: 200px;" forceValidOption="true"/>
+
+<br/>
+<br/>
+
+Make dropdown's height to 180px (dropdownHeight="180")
+<br/>
+<s:autocompleter theme="ajax" href="/JSONList.action" cssStyle="width: 200px;" dropdownHeight="180"/>
+
+<br/>
+<br/>
+
+Disabled combobox (disabled="true")
+<br/>
+<s:autocompleter theme="ajax" href="/JSONList.action" cssStyle="width: 200px;" disabled="true"/>
+
+<br/>
+
+<s:include value="../footer.jsp"/>
+</body>
+</html>
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Autocompleter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Autocompleter.java?view=diff&rev=479854&r1=479853&r2=479854
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Autocompleter.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Autocompleter.java Mon Nov 27 18:34:13 2006
@@ -37,7 +37,7 @@
* ["Text 1","Value1"],
* ["Text 2","Value2"],
* ["Text 3","Value3"]
- * ]
+ * ]
* </pre>
* <B>THE FOLLOWING IS ONLY VALID WHEN AJAX IS CONFIGURED</B>
* <ul>
@@ -56,8 +56,8 @@
private String searchDelay;
private String disabled;
private String href;
- private String listLength;
-
+ private String dropdownWidth;
+ private String dropdownHeight;
public Autocompleter(ValueStack stack, HttpServletRequest request,
HttpServletResponse response) {
@@ -67,7 +67,7 @@
protected String getDefaultTemplate() {
return TEMPLATE;
}
-
+
public String getComponentName() {
return COMPONENT_NAME;
}
@@ -90,13 +90,14 @@
addParameter("href", UrlHelper.buildUrl(findString(href), request,
response, null));
addParameter("mode", "remote");
- }
- if (listLength != null)
- addParameter("listLength", findValue(listLength, Integer.class));
-
+ }
+ if (dropdownHeight != null)
+ addParameter("dropdownHeight", findValue(dropdownHeight, Integer.class));
+ if (dropdownWidth != null)
+ addParameter("dropdownWidth", findValue(dropdownWidth, Integer.class));
}
-
+
protected Object findListValue() {
return (list != null) ? findValue(list, Object.class) : null;
}
@@ -124,7 +125,7 @@
public void setForceValidOption(String forceValidOption) {
this.forceValidOption = forceValidOption;
}
-
+
/**
* The URL to call to obtain the content
* @s.tagattribute required="false" type="String"
@@ -134,14 +135,6 @@
}
/**
- * limits list of visible rows, scroll on rest
- * @s.tagattribute required="false" type="Integer" default="8"
- */
- public void setListLength(String listLength) {
- this.listLength = listLength;
- }
-
- /**
* set delay before making the search
* @s.tagattribute required="false" type="Integer" default="100"
*/
@@ -151,10 +144,26 @@
/**
- * set how the serach bust be preformed, optionas are: "startstring", "startword" and "substring"
+ * set how the serach bust be preformed, optionas are: "startstring", "startword" and "substring"
* @s.tagattribute required="false" default="stringstart" type="String"
*/
public void setSearchType(String searchType) {
this.searchType = searchType;
}
-}
\ No newline at end of file
+
+ /**
+ * set the height of the dropdown in pixels
+ * @s.tagattribute required="false" default="120" type="Integer"
+ */
+ public void setDropdownHeight(String height) {
+ this.dropdownHeight = height;
+ }
+
+ /**
+ * set the width of the drodown, by default the same as the combobox
+ * @s.tagattribute required="false" type="Integer"
+ */
+ public void setDropdownWidth(String width) {
+ this.dropdownWidth = width;
+ }
+}
Modified: struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld?view=diff&rev=479854&r1=479853&r2=479854
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld (original)
+++ struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld Mon Nov 27 18:34:13 2006
@@ -2835,11 +2835,19 @@
</attribute>
<attribute>
- <name>listLength</name>
+ <name>dropdownWidth</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
- <description><![CDATA[limits list of visible rows, scroll on rest ]]></description>
+ <description><![CDATA[width in pixels of the dropdown (defaults to combobox width) ]]></description>
+
+ </attribute>
+ <attribute>
+ <name>dropdownHeight</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ <description><![CDATA[height in pixels of the dropdown (defaults to 120) ]]></description>
</attribute>
<attribute>
Modified: struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js?view=diff&rev=479854&r1=479853&r2=479854
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js (original)
+++ struts/struts2/trunk/core/src/main/resources/org/apache/struts2/static/dojo/struts/widget/__package__.js Mon Nov 27 18:34:13 2006
@@ -1,6 +1,7 @@
dojo.kwCompoundRequire({
common: ["struts.widget.Bind",
"struts.widget.BindDiv",
- "struts.widget.BindAnchor"]
+ "struts.widget.BindAnchor",
+ "struts.widget.ComboBox"]
});
dojo.provide("struts.widget.*");
Modified: struts/struts2/trunk/core/src/main/resources/template/ajax/dojoRequire.js
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/ajax/dojoRequire.js?view=diff&rev=479854&r1=479853&r2=479854
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/template/ajax/dojoRequire.js (original)
+++ struts/struts2/trunk/core/src/main/resources/template/ajax/dojoRequire.js Mon Nov 27 18:34:13 2006
@@ -8,5 +8,6 @@
dojo.require("struts.widget.Bind");
dojo.require("struts.widget.BindDiv");
dojo.require("struts.widget.BindAnchor");
+dojo.require("struts.widget.ComboBox");
dojo.require("dojo.widget.Editor");
dojo.hostenv.writeIncludes(); // not needed, but allows the Venkman debugger to work with the includes