First draft of an inputtransfer select component; Allows text --> select; Similar to OptionTransferSelect

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@495339 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David H. DeWolf
2007-01-11 19:20:51 +00:00
parent a7370c2f18
commit a95f9e4ccc
24 changed files with 1868 additions and 79 deletions
@@ -0,0 +1,115 @@
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import java.util.List;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.ArrayList;
/**
*/
public class MoreSelectsAction extends ActionSupport {
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
private List favouriteNumbers;
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
public List getDefaultFavouriteNumbers() {
List list = new ArrayList();
list.add("Three");
list.add("Seven");
return list;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public List getFavouriteNumbers() {
return favouriteNumbers;
}
public void setFavouriteNumbers(List favouriteNumbers) {
this.favouriteNumbers = favouriteNumbers;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
// actions
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -22,6 +22,7 @@
<result type="velocity">exampleSubmited.vm</result>
<result name="input" type="velocity">example.vm</result>
</action>
<action name="lotsOfOptiontransferselect" class="org.apache.struts2.showcase.LotsOfOptiontransferselectAction" method="input">
<result>lotsOfOptiontransferselect.jsp</result>
</action>
@@ -29,7 +30,15 @@
<result name="input">lotsOfOptiontransferselect.jsp</result>
<result>lotsOfOptiontransferselectSubmit.jsp</result>
</action>
<action name="moreSelects" class="org.apache.struts2.showcase.MoreSelectsAction" method="input">
<result>moreSelects.jsp</result>
</action>
<action name="moreSelectsSubmit" class="org.apache.struts2.showcase.MoreSelectsAction" method="submit">
<result name="input">moreSelects.jsp</result>
<result>moreSelectsSubmit.jsp</result>
</action>
<!-- START SNIPPET: treeExampleDynamicXWorkXml -->
<action name="showDynamicTreeAction" class="org.apache.struts2.showcase.ShowDynamicTreeAction">
@@ -11,6 +11,7 @@
<li><s:url id="url" namespace="/tags/ui" action="example" method="input" /><s:a href="%{url}">UI Example</s:a></li>
<li><s:url id="url" namespace="/tags/ui" action="exampleVelocity" method="input" /><s:a href="%{url}">UI Example (Velocity)</s:a></li>
<li><s:url id="url" namespace="/tags/ui" action="lotsOfOptiontransferselect" method="input" /><s:a href="%{url}">Option Transfer Select UI Example</s:a></li>
<li><s:url id="url" namespace="/tags/ui" action="moreSelects" method="input" /><s:a href="%{url}">More Select Box UI Examples</s:a></li>
<li><s:url id="url" namespace="/tags/ui" value="treeExampleStatic.jsp" /><s:a href="%{url}">Tree Example (static)</s:a>
<li><s:url id="url" namespace="/tags/ui" action="showDynamicTreeAction"/><s:a href="%{url}">Tree Example (dynamic)</s:a>
<li><s:url id="url" value="componentTagExample.jsp"/><s:a href="%{#url}">Component Tag Example</s:a>
@@ -85,48 +85,8 @@
allowSelectAll="false"
/>
<br/>
<s:updownselect
tooltip="Prioritized Your Favourite Cartoon Characters"
label="Prioritised Favourite Cartoon Characters"
list="defaultFavouriteCartoonCharacters"
name="prioritisedFavouriteCartoonCharacters"
headerKey="-1"
headerValue="--- Please Order ---"
emptyOption="true" />
<br/>
<s:updownselect
tooltip="Prioritise Your Favourite Cars"
label="Prioritised Favourite Cars"
list="defaultFavouriteCars"
name="prioritisedFavouriteCars"
headerKey="-10"
headerValue="--- Please Order ---" />
<br/>
<s:updownselect
tooltip="Prioritised Your Favourite Countries"
label="Prioritised Favourite Countries"
list="defaultFavouriteCountries"
name="prioritisedFavouriteCountries"
emptyOption="true"
value="{'england', 'brazil'}" />
<br/>
<s:select label="Favourite Cities"
list="availableCities"
name="favouriteCities"
value="%{defaultFavouriteCities}"
multiple="true" size="4"/>
<s:submit value="Submit It" />
<br/>
</s:form>
</body>
@@ -88,39 +88,6 @@
</s:iterator>
</td>
</tr>
<tr>
<td>Prioritised Favourite Cartoon Characters:</td>
<td>
<s:iterator value="prioritisedFavouriteCartoonCharacters" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
<tr>
<td>Prioritised Favourite Cars:</td>
<td>
<s:iterator value="prioritisedFavouriteCars" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
<tr>
<td>Prioritised Favourite Countries</td>
<td>
<s:iterator value="prioritisedFavouriteCountries" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
<tr>
<td>Favourite Cities</td>
<td>
<s:iterator value="favouriteCities" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
</table>
</body>
@@ -0,0 +1,61 @@
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Show Case - Tags - UI Tags - Optiontransferselect</title>
<s:head />
</head>
<body>
<s:form action="moreSelectsSubmit" namespace="/tags/ui" method="post">
<s:updownselect
tooltip="Prioritized Your Favourite Cartoon Characters"
label="Prioritised Favourite Cartoon Characters"
list="defaultFavouriteCartoonCharacters"
name="prioritisedFavouriteCartoonCharacters"
headerKey="-1"
headerValue="--- Please Order ---"
emptyOption="true" />
<br/>
<s:updownselect
tooltip="Prioritise Your Favourite Cars"
label="Prioritised Favourite Cars"
list="defaultFavouriteCars"
name="prioritisedFavouriteCars"
headerKey="-10"
headerValue="--- Please Order ---" />
<br/>
<s:updownselect
tooltip="Prioritised Your Favourite Countries"
label="Prioritised Favourite Countries"
list="defaultFavouriteCountries"
name="prioritisedFavouriteCountries"
emptyOption="true"
value="{'england', 'brazil'}" />
<br/>
<s:inputtransferselect
list="defaultFavouriteNumbers"
name="favouriteNumbers"
label="Numbers"/>
<s:select label="Favourite Cities"
list="availableCities"
name="favouriteCities"
value="%{defaultFavouriteCities}"
multiple="true" size="4"/>
<s:submit value="Submit It" />
<br/>
</s:form>
</body>
</html>
@@ -0,0 +1,53 @@
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Showcase - Tags - UI Tags - Select Boxes Result</title>
</head>
<body>
<table>
<tr>
<td>Prioritised Favourite Cartoon Characters:</td>
<td>
<s:iterator value="prioritisedFavouriteCartoonCharacters" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
<tr>
<td>Prioritised Favourite Cars:</td>
<td>
<s:iterator value="prioritisedFavouriteCars" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
<tr>
<td>Prioritised Favourite Countries</td>
<td>
<s:iterator value="prioritisedFavouriteCountries" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
<tr>
<td>Favourite Cities</td>
<td>
<s:iterator value="favouriteCities" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
<tr>
<td>Favourite Numbers</td>
<td>
<s:iterator value="favouriteNumbers" status="stat">
<s:property value="%{#stat.count}" />.<s:property />&nbsp;
</s:iterator>
</td>
</tr>
</table>
</body>
</html>
@@ -0,0 +1,319 @@
package org.apache.struts2.components;
import org.apache.struts.annotations.StrutsTag;
import org.apache.struts.annotations.StrutsTagAttribute;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.LinkedHashMap;
/**
* <!-- START SNIPPET: javadoc -->
*
* Create a input transfer select component which is basically an text input
* and &lt;select ...&gt; tag with buttons in the middle of them allowing text
* to be added to the transfer select. Will auto-select all its
* elements upon its containing form submision.
*
* <!-- END SNIPPET: javadoc -->
*
* <p/>
*
*
* <!-- START SNIPPET: notice -->
*
* NOTE: The id and doubleId need not be supplied as they will generated provided
* that the inputtransferselect tag is being used in a form tag. The generated id
* and doubleId will be &lt;form_id&gt;_&lt;inputtransferselect_doubleName&gt; and
* &lt;form_id&gt;_&lt;inputtransferselect_doubleName&gt; respectively.
*
* <!-- END SNIPPET: notice -->
*
* <p/>
*
* <pre>
* <!-- START SNIPPET: example -->
*
* &lt;-- minimum configuration --&gt;
* &lt;s:inputtransferselect
* label="Favourite Cartoons Characters"
* name="cartoons"
* list="{'Popeye', 'He-Man', 'Spiderman'}"
* /&gt;
*
* <!-- END SNIPPET: example -->
* </pre>
*
*/
@StrutsTag(name="inputtransferselect", tldTagClass="org.apache.struts2.views.jsp.ui.InputTransferSelectTag", description="Renders an input form")
public class InputTransferSelect extends ListUIBean {
private static final Log _log = LogFactory.getLog(InputTransferSelect.class);
private static final String TEMPLATE = "inputtransferselect";
protected String size;
protected String multiple;
protected String allowRemoveAll;
protected String allowUpDown;
protected String leftTitle;
protected String rightTitle;
protected String buttonCssClass;
protected String buttonCssStyle;
protected String addLabel;
protected String removeLabel;
protected String removeAllLabel;
protected String upLabel;
protected String downLabel;
protected String headerKey;
protected String headerValue;
public InputTransferSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
super(stack, request, response);
}
protected String getDefaultTemplate() {
return TEMPLATE;
}
public void evaluateExtraParams() {
super.evaluateExtraParams();
if (size == null || size.trim().length() <= 0) {
addParameter("size", "5");
}
if (multiple == null || multiple.trim().length() <= 0) {
addParameter("multiple", Boolean.TRUE);
}
// allowUpDown
addParameter("allowUpDown", allowUpDown != null ? findValue(allowUpDown, Boolean.class) : Boolean.TRUE);
// allowRemoveAll
addParameter("allowRemoveAll", allowRemoveAll != null ? findValue(allowRemoveAll, Boolean.class) : Boolean.TRUE);
// leftTitle
if (leftTitle != null) {
addParameter("leftTitle", findValue(leftTitle, String.class));
}
// rightTitle
if (rightTitle != null) {
addParameter("rightTitle", findValue(rightTitle, String.class));
}
// buttonCssClass
if (buttonCssClass != null && buttonCssClass.trim().length() > 0) {
addParameter("buttonCssClass", buttonCssClass);
}
// buttonCssStyle
if (buttonCssStyle != null && buttonCssStyle.trim().length() > 0) {
addParameter("buttonCssStyle", buttonCssStyle);
}
// addLabel
addParameter("addLabel", addLabel != null ? findValue(addLabel, String.class) : "->" );
// removeLabel
addParameter("removeLabel", removeLabel != null ? findValue(removeLabel, String.class) : "<-");
// removeAllLabel
addParameter("removeAllLabel", removeAllLabel != null ? findValue(removeAllLabel, String.class) : "<<--");
// upLabel
addParameter("upLabel", upLabel != null ? findValue(upLabel, String.class) : "^");
// leftDownLabel
addParameter("downLabel", downLabel != null ? findValue(downLabel, String.class) : "v");
if ((headerKey != null) && (headerValue != null)) {
addParameter("headerKey", findString(headerKey));
addParameter("headerValue", findString(headerValue));
}
// inform the form component our select tag infos, so they know how to select
// its elements upon onsubmit
Form formAncestor = (Form) findAncestor(Form.class);
if (formAncestor != null) {
// inform ancestor form that we are having a customOnsubmit (see form-close.ftl [simple theme])
enableAncestorFormCustomOnsubmit();
// key -> select tag id, value -> headerKey (if exists)
Map formInputtransferselectIds = (Map) formAncestor.getParameters().get("inputtransferselectIds");
// init lists
if (formInputtransferselectIds == null) {
formInputtransferselectIds = new LinkedHashMap();
}
// id
String tmpId = (String) getParameters().get("id");
String tmpHeaderKey = (String) getParameters().get("headerKey");
if (tmpId != null && (! formInputtransferselectIds.containsKey(tmpId))) {
formInputtransferselectIds.put(tmpId, tmpHeaderKey);
}
formAncestor.getParameters().put("inputtransferselectIds", formInputtransferselectIds);
}
else {
_log.warn("form enclosing inputtransferselect "+this+" not found, auto select upon form submit of inputtransferselect will not work");
}
}
public String getSize() {
return size;
}
@StrutsTagAttribute(description="the size of the select box")
public void setSize(String size) {
this.size = size;
}
public String getMultiple() {
return multiple;
}
@StrutsTagAttribute(description="Determine whether or not multiple entries are shown")
public void setMultiple(String multiple) {
this.multiple = multiple;
}
public String getAllowRemoveAll() {
return allowRemoveAll;
}
@StrutsTagAttribute(description="Determine whether the remove all button will display")
public void setAllowRemoveAll(String allowRemoveAll) {
this.allowRemoveAll = allowRemoveAll;
}
public String getAllowUpDown() {
return allowUpDown;
}
@StrutsTagAttribute(description="Determine whether items in the list can be reordered")
public void setAllowUpDown(String allowUpDown) {
this.allowUpDown = allowUpDown;
}
public String getLeftTitle() {
return leftTitle;
}
@StrutsTagAttribute(description="the left hand title")
public void setLeftTitle(String leftTitle) {
this.leftTitle = leftTitle;
}
public String getRightTitle() {
return rightTitle;
}
@StrutsTagAttribute(description="the right hand title")
public void setRightTitle(String rightTitle) {
this.rightTitle = rightTitle;
}
public String getButtonCssClass() {
return buttonCssClass;
}
@StrutsTagAttribute(description="the css class used for rendering buttons")
public void setButtonCssClass(String buttonCssClass) {
this.buttonCssClass = buttonCssClass;
}
public String getButtonCssStyle() {
return buttonCssStyle;
}
@StrutsTagAttribute(description="the css style used for rendering buttons")
public void setButtonCssStyle(String buttonCssStyle) {
this.buttonCssStyle = buttonCssStyle;
}
public String getAddLabel() {
return addLabel;
}
@StrutsTagAttribute(description="the label used for the add button")
public void setAddLabel(String addLabel) {
this.addLabel = addLabel;
}
public String getRemoveLabel() {
return removeLabel;
}
@StrutsTagAttribute(description="the label used for the remove button")
public void setRemoveLabel(String removeLabel) {
this.removeLabel = removeLabel;
}
public String getRemoveAllLabel() {
return removeAllLabel;
}
@StrutsTagAttribute(description="the label used for the remove all button")
public void setRemoveAllLabel(String removeAllLabel) {
this.removeAllLabel = removeAllLabel;
}
public String getUpLabel() {
return upLabel;
}
@StrutsTagAttribute(description="the label used for the up button")
public void setUpLabel(String upLabel) {
this.upLabel = upLabel;
}
public String getDownLabel() {
return downLabel;
}
@StrutsTagAttribute(description="the label used for the down button")
public void setDownLabel(String downLabel) {
this.downLabel = downLabel;
}
public String getHeaderKey() {
return headerKey;
}
@StrutsTagAttribute(description="the header key of the select box")
public void setHeaderKey(String headerKey) {
this.headerKey = headerKey;
}
public String getHeaderValue() {
return headerValue;
}
@StrutsTagAttribute(description="the header value of the select box")
public void setHeaderValue(String headerValue) {
this.headerValue = headerValue;
}
}
@@ -0,0 +1,24 @@
package org.apache.struts2.views.freemarker.tags;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
import org.apache.struts2.components.InputTransferSelect;
/**
* @see org.apache.struts2.components.InputTransferSelect
*/
public class InputTransferSelectModel extends TagModel {
public InputTransferSelectModel(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
super(stack, req, res);
}
protected Component getBean() {
return new InputTransferSelect(stack, req, res);
}
}
@@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.components.InputTransferSelect;
/**
* Provides @s.tag access for various tags.
@@ -81,6 +82,7 @@ public class StrutsModels {
protected ElseModel elseModel;
protected ElseIfModel elseIfModel;
protected AutocompleterModel autocompleterModel;
protected InputTransferSelectModel inputtransferselect;
public StrutsModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
@@ -463,4 +465,13 @@ public class StrutsModels {
}
return elseIfModel;
}
public InputTransferSelectModel getInputtransferselect() {
if (inputtransferselect == null) {
inputtransferselect = new InputTransferSelectModel(stack, req, res);
}
return inputtransferselect;
}
}
@@ -0,0 +1,185 @@
package org.apache.struts2.views.jsp.ui;
import org.apache.struts2.components.Component;
import org.apache.struts2.components.InputTransferSelect;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* InputTransferSelect jsp tag.
*/
public class InputTransferSelectTag extends AbstractListTag {
private static final long serialVersionUID = 250474334495763536L;
protected String size;
protected String multiple;
protected String allowRemoveAll;
protected String allowUpDown;
protected String leftTitle;
protected String rightTitle;
protected String buttonCssClass;
protected String buttonCssStyle;
protected String addLabel;
protected String removeLabel;
protected String removeAllLabel;
protected String upLabel;
protected String downLabel;
protected String headerKey;
protected String headerValue;
public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new InputTransferSelect(stack, req, res);
}
protected void populateParams() {
super.populateParams();
InputTransferSelect inputTransferSelect = (InputTransferSelect) component;
inputTransferSelect.setSize(size);
inputTransferSelect.setMultiple(multiple);
inputTransferSelect.setAllowRemoveAll(allowRemoveAll);
inputTransferSelect.setAllowUpDown(allowUpDown);
inputTransferSelect.setLeftTitle(leftTitle);
inputTransferSelect.setRightTitle(rightTitle);
inputTransferSelect.setButtonCssClass(buttonCssClass);
inputTransferSelect.setButtonCssStyle(buttonCssStyle);
inputTransferSelect.setAddLabel(addLabel);
inputTransferSelect.setRemoveLabel(removeLabel);
inputTransferSelect.setRemoveAllLabel(removeAllLabel);
inputTransferSelect.setUpLabel(upLabel);
inputTransferSelect.setDownLabel(downLabel);
inputTransferSelect.setHeaderKey(headerKey);
inputTransferSelect.setHeaderValue(headerValue);
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getMultiple() {
return multiple;
}
public void setMultiple(String multiple) {
this.multiple = multiple;
}
public String getAllowRemoveAll() {
return allowRemoveAll;
}
public void setAllowRemoveAll(String allowRemoveAll) {
this.allowRemoveAll = allowRemoveAll;
}
public String getAllowUpDown() {
return allowUpDown;
}
public void setAllowUpDown(String allowUpDown) {
this.allowUpDown = allowUpDown;
}
public String getLeftTitle() {
return leftTitle;
}
public void setLeftTitle(String leftTitle) {
this.leftTitle = leftTitle;
}
public String getRightTitle() {
return rightTitle;
}
public void setRightTitle(String rightTitle) {
this.rightTitle = rightTitle;
}
public String getButtonCssClass() {
return buttonCssClass;
}
public void setButtonCssClass(String buttonCssClass) {
this.buttonCssClass = buttonCssClass;
}
public String getButtonCssStyle() {
return buttonCssStyle;
}
public void setButtonCssStyle(String buttonCssStyle) {
this.buttonCssStyle = buttonCssStyle;
}
public String getAddLabel() {
return addLabel;
}
public void setAddLabel(String addLabel) {
this.addLabel = addLabel;
}
public String getRemoveLabel() {
return removeLabel;
}
public void setRemoveLabel(String removeLabel) {
this.removeLabel = removeLabel;
}
public String getRemoveAllLabel() {
return removeAllLabel;
}
public void setRemoveAllLabel(String removeAllLabel) {
this.removeAllLabel = removeAllLabel;
}
public String getUpLabel() {
return upLabel;
}
public void setUpLabel(String upLabel) {
this.upLabel = upLabel;
}
public String getDownLabel() {
return downLabel;
}
public void setDownLabel(String downLabel) {
this.downLabel = downLabel;
}
public String getHeaderKey() {
return headerKey;
}
public void setHeaderKey(String headerKey) {
this.headerKey = headerKey;
}
public String getHeaderValue() {
return headerValue;
}
public void setHeaderValue(String headerValue) {
this.headerValue = headerValue;
}
}
@@ -0,0 +1,23 @@
package org.apache.struts2.views.velocity.components;
import org.apache.struts2.components.Component;
import org.apache.struts2.components.InputTransferSelect;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @see org.apache.struts2.components.InputTransferSelect
*/
public class InputTransferSelectDirective extends AbstractDirective {
public String getBeanName() {
return "inputtransferselect";
}
protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
return new InputTransferSelect(stack, req, res);
}
}
@@ -2762,7 +2762,7 @@
<name>doubleListKey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the list key of the second attribute]]></description>
<description><![CDATA[The key expression to use for second list]]></description>
</attribute>
<attribute>
<name>doubleListValue</name>
@@ -4505,6 +4505,318 @@
<description><![CDATA[The jsp/servlet output to include]]></description>
</attribute>
</tag>
<tag>
<name>inputtransferselect</name>
<tag-class>org.apache.struts2.views.jsp.ui.InputTransferSelectTag</tag-class>
<body-content>JSP</body-content>
<description><![CDATA[Renders an input form]]></description>
<attribute>
<name>accesskey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html accesskey attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>addLabel</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the label used for the add button]]></description>
</attribute>
<attribute>
<name>allowRemoveAll</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Determine whether the remove all button will display]]></description>
</attribute>
<attribute>
<name>allowUpDown</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Determine whether items in the list can be reordered]]></description>
</attribute>
<attribute>
<name>buttonCssClass</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the css class used for rendering buttons]]></description>
</attribute>
<attribute>
<name>buttonCssStyle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the css style used for rendering buttons]]></description>
</attribute>
<attribute>
<name>cssClass</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The css class to use for element]]></description>
</attribute>
<attribute>
<name>cssStyle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The css style definitions for element ro use]]></description>
</attribute>
<attribute>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html disabled attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>downLabel</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the label used for the down button]]></description>
</attribute>
<attribute>
<name>headerKey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the header key of the select box]]></description>
</attribute>
<attribute>
<name>headerValue</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the header value of the select box]]></description>
</attribute>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[id for referencing element. For UI and form tags it will be used as HTML id attribute]]></description>
</attribute>
<attribute>
<name>key</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the key (name, value, label) for this particular component]]></description>
</attribute>
<attribute>
<name>label</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Label expression used for rendering a element specific label]]></description>
</attribute>
<attribute>
<name>labelposition</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Define label position of form element (top/left)]]></description>
</attribute>
<attribute>
<name>leftTitle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the left hand title]]></description>
</attribute>
<attribute>
<name>list</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.]]></description>
</attribute>
<attribute>
<name>listKey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[ Property of list objects to get field value from]]></description>
</attribute>
<attribute>
<name>listValue</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Property of list objects to get field content from]]></description>
</attribute>
<attribute>
<name>multiple</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Determine whether or not multiple entries are shown]]></description>
</attribute>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The name to set for element]]></description>
</attribute>
<attribute>
<name>onblur</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[ Set the html onblur attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onchange</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onchange attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onclick</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onclick attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>ondblclick</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html ondblclick attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onfocus</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onfocus attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onkeydown</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onkeydown attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onkeypress</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onkeypress attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onkeyup</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onkeyup attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onmousedown</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onmousedown attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onmousemove</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onmousemove attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onmouseout</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onmouseout attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onmouseover</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onmouseover attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onmouseup</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onmouseup attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>onselect</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html onselect attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>removeAllLabel</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the label used for the remove all button]]></description>
</attribute>
<attribute>
<name>removeLabel</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the label used for the remove button]]></description>
</attribute>
<attribute>
<name>required</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[If set to true, the rendered element will indicate that input is required]]></description>
</attribute>
<attribute>
<name>requiredposition</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Define required position of required form element (left|right)]]></description>
</attribute>
<attribute>
<name>rightTitle</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the right hand title]]></description>
</attribute>
<attribute>
<name>size</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the size of the select box]]></description>
</attribute>
<attribute>
<name>tabindex</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html tabindex attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>template</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template (other than default) to use for rendering the element]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The theme (other than default) to use for rendering the element]]></description>
</attribute>
<attribute>
<name>title</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the html title attribute on rendered html element]]></description>
</attribute>
<attribute>
<name>tooltip</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the tooltip of this particular component]]></description>
</attribute>
<attribute>
<name>tooltipConfig</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the tooltip configuration]]></description>
</attribute>
<attribute>
<name>upLabel</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[the label used for the up button]]></description>
</attribute>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Preset the value of input element.]]></description>
</attribute>
</tag>
<tag>
<name>iterator</name>
<tag-class>org.apache.struts2.views.jsp.IteratorTag</tag-class>
@@ -4958,7 +5270,7 @@
<name>doubleListKey</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[Set the list key of the second attribute]]></description>
<description><![CDATA[The key expression to use for second list]]></description>
</attribute>
<attribute>
<name>doubleListValue</name>
@@ -0,0 +1,108 @@
function addOption(objTextBox, objTargetElement) {
var value = objTextBox.value;
if(value != null && value != '') {
objTargetElement.options[objTargetElement.options.length] = new Option(value, value);
objTextBox.value = '';
}
}
function removeOptions(objTargetElement) {
for(var i=0;i<objTargetElement.options.length;i++) {
if(objTargetElement.options[i].selected) {
objTargetElement.options[i] = null;
}
}
}
function removeAllOptions(objTargetElement) {
while(objTargetElement.options.length != 0) {
objTargetElement.options[0] = null;
}
}
function selectAllOptionsExceptSome(objTargetElement, type, ptn) {
var test = compile(ptn);
for (var i = 0; i < objTargetElement.length; i++) {
var opt = objTargetElement.options[i];
if ((type == 'key' && !test(opt.value)) ||
(type == 'text' && !test(opt.text))) {
opt.selected = true;
} else {
opt.selected = false;
}
}
return false;
}
function compile(ptn) {
if (ptn != undefined) {
if (ptn == '' || !window.RegExp) {
return function(val) { return val == ptn; }
} else {
var reg = new RegExp(ptn);
return function (val) {
if (val == '') { // ignore empty option added by template
return true;
}
return reg.test(val); }
}
}
return function(val) { return false; }
}
function selectAllOptions(objTargetElement) {
for (var i = 0; i < objTargetElement.length; i++) {
if (objTargetElement.options[i].value != '') {
objTargetElement.options[i].selected = true;
}
}
return false;
}
function moveOptionUp(objTargetElement, type, ptn) {
var test = compile(ptn);
for (i=0; i<objTargetElement.length; i++) {
if (objTargetElement[i].selected) {
var v;
if (i != 0 && !objTargetElement[i-1].selected) {
if (type == 'key') {
v = objTargetElement[i-1].value
}
else {
v = objTargetElement[i-1].text;
}
if (!test(v)) {
swapOptions(objTargetElement,i,i-1);
}
}
}
}
}
function moveOptionDown(objTargetElement, type, ptn) {
var test = compile(ptn);
for (i=(objTargetElement.length-1); i>= 0; i--) {
if (objTargetElement[i].selected) {
var v;
if ((i != (objTargetElement.length-1)) && !objTargetElement[i+1].selected) {
if (type == 'key') {
v = objTargetElement[i].value
}
else {
v = objTargetElement[i].text;
}
if (!test(v)) {
swapOptions(objTargetElement,i,i+1);
}
}
}
}
}
function swapOptions(objTargetElement, first, second) {
var opt = objTargetElement.options;
var temp = new Option(opt[first].text, opt[first].value, opt[first].defaultSelected, opt[first].selected);
var temp2= new Option(opt[second].text, opt[second].value, opt[second].defaultSelected, opt[second].selected);
opt[first] = temp2;
opt[second] = temp;
}
@@ -22,6 +22,22 @@ dojo.require("dojo.event.connect");
});
</#list>
</#if>
<#if (parameters.inputtransferselectIds?if_exists?size > 0)>
var containingForm = document.getElementById("${parameters.id}");
<#assign selectObjIds = parameters.inputtransferselectIds.keySet() />
<#list selectObjIds as selectObjectId>
dojo.event.connect(containingForm, "onsubmit",
function(evt) {
var selectObj = document.getElementById("${selectObjectId}");
<#if parameters.inputtransferselectIds.get(selectObjectId)?exists>
<#assign selectTagHeaderKey = parameters.inputtransferselectIds.get(selectObjectId)/>
selectAllOptionsExceptSome(selectObj, "key", "${selectTagHeaderKey}");
<#else>
selectAllOptionsExceptSome(selectObj, "key", "");
</#if>
});
</#list>
</#if>
<#if (parameters.optiontransferselectDoubleIds?if_exists?size > 0)>
var containingForm = document.getElementById("${parameters.id}");
<#assign selectDoubleObjIds = parameters.optiontransferselectDoubleIds.keySet() />
@@ -0,0 +1,4 @@
<#--include "/${parameters.templateDir}/css_xhtml/controlheader.ftl" /-->
<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/inputtransferselect.ftl" />
<#include "/${parameters.templateDir}/css_xhtml/controlfooter.ftl" />
@@ -23,6 +23,22 @@ dojo.require("dojo.event.*");
});
</#list>
</#if>
<#if (parameters.inputtransferselectIds?if_exists?size > 0)>
var containingForm = document.getElementById("${parameters.id}");
<#assign selectObjIds = parameters.inputtransferselectIds.keySet() />
<#list selectObjIds as selectObjectId>
dojo.event.connect(containingForm, "onsubmit",
function(evt) {
var selectObj = document.getElementById("${selectObjectId}");
<#if parameters.inputtransferselectIds.get(selectObjectId)?exists>
<#assign selectTagHeaderKey = parameters.inputtransferselectIds.get(selectObjectId)/>
selectAllOptionsExceptSome(selectObj, "key", "${selectTagHeaderKey}");
<#else>
selectAllOptionsExceptSome(selectObj, "key", "");
</#if>
});
</#list>
</#if>
<#if (parameters.optiontransferselectDoubleIds?if_exists?size > 0)>
var containingForm = document.getElementById("${parameters.id}");
<#assign selectDoubleObjIds = parameters.optiontransferselectDoubleIds.keySet() />
@@ -0,0 +1,103 @@
<#if !stack.findValue("#inputtransferselect_js_included")?exists><#t/>
<script language="javascript" src="<@s.url value="/struts/inputtransferselect.js" encode='false' includeParams='none'/>"></script>
<#assign temporaryVariable = stack.setValue("#inputtransferselect_js_included", "true") /><#t/>
</#if><#t/>
<table border="0">
<tr>
<td>
<#if parameters.leftTitle?exists><#t/>
<label for="leftTitle">${parameters.leftTitle}</label><br/>
</#if><#t/>
<input type="text"<#rt/>
name="${parameters.name?default("")?html}_input"<#rt/>
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
<#if parameters.readonly?default(false)>
readonly="readonly"<#rt/>
</#if>
<#if parameters.tabindex?exists>
tabindex="${parameters.tabindex?html}"<#rt/>
</#if>
<#if parameters.id?exists>
id="${parameters.id?html}_input"<#rt/>
</#if>
<#if parameters.cssClass?exists>
class="${parameters.cssClass?html}"<#rt/>
</#if>
<#if parameters.cssStyle?exists>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
<#if parameters.title?exists>
title="${parameters.title?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
/>
</td>
<td valign="middle" align="center">
<#assign addLabel=parameters.addLabel?default("->")?html /><#t/>
<input type="button"
<#if parameters.buttonCssClass?exists><#t/>
class="${parameters.buttonCssClass?html}"
</#if><#t/>
<#if parameters.buttonCssStyle?exists>
style="${parameters.buttonCssStyle?html}"
</#if><#t/>
value="${addLabel}" onclick="addOption(document.getElementById('${parameters.id?html}_input'), document.getElementById('${parameters.id?html}'))" /><br/><br/>
<#t/>
<#assign removeLabel=parameters.removeLabel?default("<-")?html /><#t/>
<input type="button"
<#if parameters.buttonCssClass?exists><#t/>
class="${parameters.buttonCssClass?html}"
</#if><#t/>
<#if parameters.buttonCssStyle?exists>
style="${parameters.buttonCssStyle?html}"
</#if><#t/>
value="${removeLabel}" onclick="removeOptions(document.getElementById('${parameters.id?html}'))" /><br/><br/>
<#t/>
<#assign removeAllLabel=parameters.removeAllLabel?default("<<--")?html /><#t/>
<input type="button"
<#if parameters.buttonCssClass?exists><#t/>
class="${parameters.buttonCssClass?html}"
</#if><#t/>
<#if parameters.buttonCssStyle?exists>
style="${parameters.buttonCssStyle?html}"
</#if><#t/>
value="${removeAllLabel}" onclick="removeAllOptions(document.getElementById('${parameters.id?html}'))" /><br/><br/>
</td>
<td>
<#if parameters.rightTitle?exists><#t/>
<label for="rightTitle">${parameters.rightTitle}</label><br/>
</#if><#t/>
<#include "/${parameters.templateDir}/simple/select.ftl" />
<#if parameters.allowUpDown?default(true)>
<input type="button"
<#if parameters.headerKey?exists>
onclick="moveOptionDown(document.getElementById('${parameters.id}'), 'key', '${parameters.headerKey}');"
<#else>
onclick="moveOptionDown(document.getElementById('${parameters.id}'), 'key', '');"
</#if>
<#if parameters.downLabel?exists>
value="${parameters.downLabel?html}"
</#if>
/>
<input type="button"
<#if parameters.headerKey?exists>
onclick="moveOptionUp(document.getElementById('${parameters.id}'), 'key', '${parameters.headerKey}');"
<#else>
onclick="moveOptionUp(document.getElementById('${parameters.id}'), 'key', '');"
</#if>
<#if parameters.upLabel?exists>
value="${parameters.upLabel?html}"
</#if>
/>
</#if>
</td>
</tr>
</table>
@@ -0,0 +1,3 @@
<#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
<#include "/${parameters.templateDir}/simple/inputtransferselect.ftl" />
<#include "/${parameters.templateDir}/xhtml/controlfooter.ftl" /><#nt/>
@@ -137,7 +137,7 @@ Please do not edit it directly.
<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">Set the list key of the second attribute</td>
<td align="left" valign="top">The key expression to use for second list</td>
</tr>
<tr>
<td align="left" valign="top">doubleListValue</td>
@@ -0,0 +1,442 @@
<!--
This file is generated during the build by processing Component class annotations.
Please do not edit it directly.
-->
<html>
<head>
<title>inputtransferselect</title>
</head>
<body>
<h1>Tag Name: inputtransferselect</h1>
<h2>Description</h2>
<p>
<!-- START SNIPPET: tagdescription -->
Renders an input form
<!-- END SNIPPET: tagdescription -->
</p>
<h2>Attributes</h2>
<!-- START SNIPPET: tagattributes -->
<table width="100%">
<tr>
<th align="left" valign="top"><h4>Name</h4></th>
<th align="left" valign="top"><h4>Required</h4></th>
<th align="left" valign="top"><h4>Default</h4></th>
<th align="left" valign="top"><h4>Evaluated</h4></th>
<th align="left" valign="top"><h4>Type</h4></th>
<th align="left" valign="top"><h4>Description</h4></th>
</tr>
<tr>
<td align="left" valign="top">accesskey</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">Set the html accesskey attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">addLabel</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">the label used for the add button</td>
</tr>
<tr>
<td align="left" valign="top">allowRemoveAll</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">Determine whether the remove all button will display</td>
</tr>
<tr>
<td align="left" valign="top">allowUpDown</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">Determine whether items in the list can be reordered</td>
</tr>
<tr>
<td align="left" valign="top">buttonCssClass</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">the css class used for rendering buttons</td>
</tr>
<tr>
<td align="left" valign="top">buttonCssStyle</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">the css style used for rendering buttons</td>
</tr>
<tr>
<td align="left" valign="top">cssClass</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">The css class to use for element</td>
</tr>
<tr>
<td align="left" valign="top">cssStyle</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">The css style definitions for element ro use</td>
</tr>
<tr>
<td align="left" valign="top">disabled</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">Set the html disabled attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">downLabel</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">the label used for the down button</td>
</tr>
<tr>
<td align="left" valign="top">headerKey</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">the header key of the select box</td>
</tr>
<tr>
<td align="left" valign="top">headerValue</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">the header value of the select box</td>
</tr>
<tr>
<td align="left" valign="top">id</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">id for referencing element. For UI and form tags it will be used as HTML id attribute</td>
</tr>
<tr>
<td align="left" valign="top">key</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">Set the key (name, value, label) for this particular component</td>
</tr>
<tr>
<td align="left" valign="top">label</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">Label expression used for rendering a element specific label</td>
</tr>
<tr>
<td align="left" valign="top">labelposition</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">Define label position of form element (top/left)</td>
</tr>
<tr>
<td align="left" valign="top">leftTitle</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">the left hand title</td>
</tr>
<tr>
<td align="left" valign="top">list</td>
<td align="left" valign="top"><strong>true</strong></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">Iterable source to populate from. If the list is a Map (key, value), the Map key will become the option 'value' parameter and the Map value will become the option body.</td>
</tr>
<tr>
<td align="left" valign="top">listKey</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"> Property of list objects to get field value from</td>
</tr>
<tr>
<td align="left" valign="top">listValue</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">Property of list objects to get field content from</td>
</tr>
<tr>
<td align="left" valign="top">multiple</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">Determine whether or not multiple entries are shown</td>
</tr>
<tr>
<td align="left" valign="top">name</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">The name to set for element</td>
</tr>
<tr>
<td align="left" valign="top">onblur</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"> Set the html onblur attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onchange</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">Set the html onchange attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onclick</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">Set the html onclick attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">ondblclick</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">Set the html ondblclick attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onfocus</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">Set the html onfocus attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onkeydown</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">Set the html onkeydown attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onkeypress</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">Set the html onkeypress attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onkeyup</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">Set the html onkeyup attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onmousedown</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">Set the html onmousedown attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onmousemove</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">Set the html onmousemove attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onmouseout</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">Set the html onmouseout attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onmouseover</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">Set the html onmouseover attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onmouseup</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">Set the html onmouseup attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">onselect</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">Set the html onselect attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">removeAllLabel</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">the label used for the remove all button</td>
</tr>
<tr>
<td align="left" valign="top">removeLabel</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">the label used for the remove button</td>
</tr>
<tr>
<td align="left" valign="top">required</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">false</td>
<td align="left" valign="top">true</td>
<td align="left" valign="top">Boolean</td>
<td align="left" valign="top">If set to true, the rendered element will indicate that input is required</td>
</tr>
<tr>
<td align="left" valign="top">requiredposition</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">Define required position of required form element (left|right)</td>
</tr>
<tr>
<td align="left" valign="top">rightTitle</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">the right hand title</td>
</tr>
<tr>
<td align="left" valign="top">size</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">the size of the select box</td>
</tr>
<tr>
<td align="left" valign="top">tabindex</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">Set the html tabindex attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">template</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">The template (other than default) to use for rendering the element</td>
</tr>
<tr>
<td align="left" valign="top">templateDir</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">The template directory.</td>
</tr>
<tr>
<td align="left" valign="top">theme</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">The theme (other than default) to use for rendering the element</td>
</tr>
<tr>
<td align="left" valign="top">title</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">Set the html title attribute on rendered html element</td>
</tr>
<tr>
<td align="left" valign="top">tooltip</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">Set the tooltip of this particular component</td>
</tr>
<tr>
<td align="left" valign="top">tooltipConfig</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">Set the tooltip configuration</td>
</tr>
<tr>
<td align="left" valign="top">upLabel</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">the label used for the up button</td>
</tr>
<tr>
<td align="left" valign="top">value</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">Preset the value of input element.</td>
</tr>
</table>
<!-- END SNIPPET: tagattributes -->
</body>
</html>
@@ -241,7 +241,7 @@ Please do not edit it directly.
<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">Set the list key of the second attribute</td>
<td align="left" valign="top">The key expression to use for second list</td>
</tr>
<tr>
<td align="left" valign="top">doubleListValue</td>
@@ -0,0 +1,34 @@
package org.apache.struts2.views.jsp.ui;
import org.apache.struts2.views.jsp.AbstractUITagTest;
import org.apache.struts2.TestAction;
import java.util.List;
import java.util.ArrayList;
/**
*
*/
public class InputTransferSelectTagTest extends AbstractUITagTest {
public void testWithRequired() throws Exception {
List list = new ArrayList();
list.add("Item One");
list.add("Item Two");
TestAction testaction = (TestAction) action;
testaction.setCollection(list);
InputTransferSelectTag tag = new InputTransferSelectTag();
tag.setPageContext(pageContext);
tag.setName("collection");
tag.setList("collection");
tag.doStartTag();
tag.doEndTag();
//System.out.println(writer.toString());
verify(InputTransferSelectTagTest.class.getResource("inputtransferselect-1.txt"));
}
}
@@ -0,0 +1,23 @@
<tr>
<tdclass="tdLabel"></td>
<td>
<scriptlanguage="javascript"src="/struts/inputtransferselect.js"></script>
<tableborder="0">
<tr><td><input type="text" name="collection_input" id="collection_input"/></td>
<td valign="middle"align="center"><inputtype="button"value="-&gt;"onclick="addOption(document.getElementById('collection_input'),document.getElementById('collection'))"/>
<br/><br/>
<input type="button"value="&lt;-"onclick="removeOptions(document.getElementById('collection'))"/>
<br/><br/>
<inputtype="button"value="&lt;&lt;--"onclick="removeAllOptions(document.getElementById('collection'))"/>
<br/>
<br/>
</td>
<td>
<selectname="collection"size="5"id="collection"multiple="multiple">
<optionvalue="ItemOne"selected="selected">ItemOne</option>
<optionvalue="ItemTwo"selected="selected">ItemTwo</option></select>
<inputtype="button"onclick="moveOptionDown(document.getElementById('collection'),'key','');"value="v"/>
<inputtype="button"onclick="moveOptionUp(document.getElementById('collection'),'key','');"value="^"/>
</td></tr>
</table>
</td></tr>