Author: musachy Date: Fri Feb 16 14:50:19 2007 New Revision: 508635 URL: http://svn.apache.org/viewvc?view=rev&rev=508635 Log: WW-1745 Add "templateCssPath" and "iconPath" attributes to Autocompleter
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Autocompleter.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DateTimePicker.java struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java struts/struts2/trunk/core/src/main/resources/template/ajax/autocompleter.ftl struts/struts2/trunk/core/src/main/resources/template/simple/autocompleter.ftl struts/struts2/trunk/core/src/site/resources/tags/autocompleter.html struts/struts2/trunk/core/src/site/resources/tags/datetimepicker.html struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AutocompleterTest.java struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-1.txt struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-2.txt 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=508635&r1=508634&r2=508635 ============================================================================== --- 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 Fri Feb 16 14:50:19 2007 @@ -101,7 +101,9 @@ protected String loadOnTextChange; protected String loadMinimumCount; protected String showDownArrow; - + protected String templateCssPath; + protected String iconPath; + public Autocompleter(ValueStack stack, HttpServletRequest request, HttpServletResponse response) { super(stack, request, response); @@ -159,6 +161,10 @@ addParameter("showDownArrow", findValue(showDownArrow, Boolean.class)); else addParameter("showDownArrow", Boolean.TRUE); + if(templateCssPath != null) + addParameter("templateCssPath", findString(templateCssPath)); + if(iconPath != null) + addParameter("iconPath", findString(iconPath)); //get the key value if(name != null) { String keyNameExpr = "%{" + name + "Key}"; @@ -255,5 +261,15 @@ @StrutsTagAttribute(description="Iteratable source to populate from.") public void setList(String list) { super.setList(list); + } + + @StrutsTagAttribute(description="Template css path") + public void setTemplateCssPath(String templateCssPath) { + this.templateCssPath = templateCssPath; + } + + @StrutsTagAttribute(description="Path to icon used for the dropdown") + public void setIconPath(String iconPath) { + this.iconPath = iconPath; } } Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DateTimePicker.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DateTimePicker.java?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DateTimePicker.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DateTimePicker.java Fri Feb 16 14:50:19 2007 @@ -178,7 +178,7 @@ if(value != null) addParameter("value", findString(value)); if(iconPath != null) - addParameter("iconPath", iconPath); + addParameter("iconPath", findString(iconPath)); if(formatLength != null) addParameter("formatLength", findString(formatLength)); if(displayFormat != null) @@ -261,7 +261,7 @@ this.formatLength = formatLength; } - @StrutsTagAttribute(description=" Path to icon used for the dropdown") + @StrutsTagAttribute(description="Path to icon used for the dropdown") public void setIconPath(String iconPath) { this.iconPath = iconPath; } Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java Fri Feb 16 14:50:19 2007 @@ -50,6 +50,8 @@ protected String loadOnTextChange; protected String loadMinimumCount; protected String showDownArrow; + protected String templateCssPath; + protected String iconPath; public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) { return new Autocompleter(stack, req, res); @@ -75,6 +77,8 @@ autocompleter.setLoadMinimumCount(loadMinimumCount); autocompleter.setLoadOnTextChange(loadOnTextChange); autocompleter.setShowDownArrow(showDownArrow); + autocompleter.setTemplateCssPath(templateCssPath); + autocompleter.setIconPath(iconPath); } public void setAutoComplete(String autoComplete) { @@ -145,4 +149,11 @@ this.showDownArrow = showDownArrow; } + public void setTemplateCssPath(String templateCssPath) { + this.templateCssPath = templateCssPath; + } + + public void setIconPath(String iconPath) { + this.iconPath = iconPath; + } } Modified: struts/struts2/trunk/core/src/main/resources/template/ajax/autocompleter.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/ajax/autocompleter.ftl?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/ajax/autocompleter.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/ajax/autocompleter.ftl Fri Feb 16 14:50:19 2007 @@ -77,6 +77,12 @@ <#if parameters.showDownArrow?exists> visibleDownArrow="${parameters.showDownArrow?string?html}"<#rt/> </#if> +<#if parameters.iconPath?if_exists != ""> + buttonSrc="<@s.url value='${parameters.iconPath}' encode="false" includeParams='none'/>"<#rt/> +</#if> +<#if parameters.templateCssPath?if_exists != ""> + templateCssPath="<@s.url value='${parameters.templateCssPath}' encode="false" includeParams='none'/>" +</#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> > Modified: struts/struts2/trunk/core/src/main/resources/template/simple/autocompleter.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/autocompleter.ftl?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/autocompleter.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/autocompleter.ftl Fri Feb 16 14:50:19 2007 @@ -65,6 +65,12 @@ <#if parameters.notifyTopics?if_exists != ""> notifyTopics="${parameters.notifyTopics?html}"<#rt/> </#if> +<#if parameters.iconPath?if_exists != ""> + buttonSrc="<@s.url value='${parameters.iconPath}' encode="false" includeParams='none'/>"<#rt/> +</#if> +<#if parameters.templateCssPath?if_exists != ""> + templateCssPath="<@s.url value='${parameters.templateCssPath}' encode="false" includeParams='none'/>" +</#if> <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> > <#if parameters.list?exists> Modified: struts/struts2/trunk/core/src/site/resources/tags/autocompleter.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/autocompleter.html?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/autocompleter.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/autocompleter.html Fri Feb 16 14:50:19 2007 @@ -148,6 +148,14 @@ <td align="left" valign="top">The URL used to load the options</td> </tr> <tr> + <td align="left" valign="top">iconPath</td> + <td align="left" valign="top">false</td> + <td align="left" valign="top"></td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">String</td> + <td align="left" valign="top">Path to icon used for the dropdown</td> + </tr> + <tr> <td align="left" valign="top">id</td> <td align="left" valign="top">false</td> <td align="left" valign="top"></td> @@ -442,6 +450,14 @@ <td align="left" valign="top">true</td> <td align="left" valign="top">String</td> <td align="left" valign="top">The template (other than default) to use for rendering the element</td> + </tr> + <tr> + <td align="left" valign="top">templateCssPath</td> + <td align="left" valign="top">false</td> + <td align="left" valign="top"></td> + <td align="left" valign="top">true</td> + <td align="left" valign="top">String</td> + <td align="left" valign="top">Template css path</td> </tr> <tr> <td align="left" valign="top">templateDir</td> Modified: struts/struts2/trunk/core/src/site/resources/tags/datetimepicker.html URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/site/resources/tags/datetimepicker.html?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/site/resources/tags/datetimepicker.html (original) +++ struts/struts2/trunk/core/src/site/resources/tags/datetimepicker.html Fri Feb 16 14:50:19 2007 @@ -113,7 +113,7 @@ <td align="left" valign="top"></td> <td align="left" valign="top">true</td> <td align="left" valign="top">String</td> - <td align="left" valign="top"> Path to icon used for the dropdown</td> + <td align="left" valign="top">Path to icon used for the dropdown</td> </tr> <tr> <td align="left" valign="top">id</td> Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AutocompleterTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AutocompleterTest.java?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AutocompleterTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AutocompleterTest.java Fri Feb 16 14:50:19 2007 @@ -46,6 +46,8 @@ tag.setLoadOnTextChange("true"); tag.setLoadMinimumCount("3"); tag.setShowDownArrow("false"); + tag.setIconPath("i"); + tag.setTemplateCssPath("j"); tag.doStartTag(); tag.doEndTag(); @@ -67,6 +69,8 @@ tag.setSearchType("b"); tag.setDisabled("c"); tag.setName("f"); + tag.setIconPath("i"); + tag.setTemplateCssPath("j"); tag.doStartTag(); tag.doEndTag(); Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-1.txt?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-1.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-1.txt Fri Feb 16 14:50:19 2007 @@ -13,4 +13,6 @@ indicator="h" loadOnType="true" loadMinimum="3" - visibleDownArrow="false"> + visibleDownArrow="false" + buttonSrc="i" + templateCssPath="j"> Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-2.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-2.txt?view=diff&rev=508635&r1=508634&r2=508635 ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-2.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Autocompleter-2.txt Fri Feb 16 14:50:19 2007 @@ -9,6 +9,8 @@ dropdownWidth="10" dropdownHeight="10" name="f" + buttonSrc="i" + templateCssPath="j" > <option value="d">d</option> <option value="e">e</option>