Author: tmjee Date: Sat Jun 17 05:26:03 2006 New Revision: 415023 URL: http://svn.apache.org/viewvc?rev=415023&view=rev Log: WW-1319 - added up/down buttons on both side of the select tag, allow item to be crossed transfered as well as being moved up and down in its containing select tag.
Modified: struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/OptionTransferSelect.java struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/OptionTransferSelectTag.java struts/action2/trunk/core/src/main/resources/template/simple/optiontransferselect.ftl struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-1.txt struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-2.txt struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-3.txt struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-4.txt struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-5.txt struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-6.txt struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-7.txt Modified: struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/OptionTransferSelect.java URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/OptionTransferSelect.java?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/OptionTransferSelect.java (original) +++ struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/OptionTransferSelect.java Sat Jun 17 05:26:03 2006 @@ -100,6 +100,8 @@ protected String allowAddAllToLeft; protected String allowAddAllToRight; protected String allowSelectAll; + protected String allowUpDownOnLeft; + protected String allowUpDownOnRight; protected String leftTitle; protected String rightTitle; @@ -112,6 +114,10 @@ protected String addAllToLeftLabel; protected String addAllToRightLabel; protected String selectAllLabel; + protected String leftUpLabel; + protected String leftDownlabel; + protected String rightUpLabel; + protected String rightDownLabel; public OptionTransferSelect(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) { @@ -182,6 +188,13 @@ addParameter("allowAddAllToRight", allowAddAllToRight != null ? findValue(allowAddAllToRight, Boolean.class) : Boolean.TRUE); + // allowUpDownOnLeft + addParameter("allowUpDownOnLeft", + allowUpDownOnLeft != null ? findValue(allowUpDownOnLeft, Boolean.class) : Boolean.TRUE); + + // allowUpDownOnRight + addParameter("allowUpDownOnRight", + allowUpDownOnRight != null ? findValue(allowUpDownOnRight, Boolean.class) : Boolean.TRUE); // leftTitle @@ -215,6 +228,24 @@ addParameter("selectAllLabel", selectAllLabel != null ? findValue(selectAllLabel, String.class) : "<*>"); + // leftUpLabel + addParameter("leftUpLabel", + leftUpLabel != null ? findValue(leftUpLabel, String.class) : "^"); + + + // leftDownLabel + addParameter("leftDownLabel", + leftDownlabel != null ? findValue(leftDownlabel, String.class) : "v"); + + + // rightUpLabel + addParameter("rightUpLabel", + rightUpLabel != null ? findValue(rightUpLabel, String.class) : "^"); + + + // rightDownlabel + addParameter("rightDownLabel", + rightDownLabel != null ? findValue(rightDownLabel, String.class) : "v"); @@ -364,6 +395,33 @@ public String getLeftTitle() { return leftTitle; } + + + /** + * enable up / down on the left side + * @a2 tagattribute required="false" + */ + public void setAllowUpDownOnLeft(String allowUpDownOnLeft) { + this.allowUpDownOnLeft = allowUpDownOnLeft; + } + + public String getAllowUpDownOnLeft() { + return this.allowUpDownOnLeft; + } + + + /** + * enable up / down on the right side + * @a2 tagattribute required="false" + */ + public void setAllowUpDownOnRight(String allowUpDownOnRight) { + this.allowUpDownOnRight = allowUpDownOnRight; + } + + public String getAllowUpDownOnRight() { + return this.allowUpDownOnRight; + } + /** * set Left title @@ -436,4 +494,52 @@ public String getButtonCssStyle() { return this.buttonCssStyle; } + + + /** + * Up label for the left side + * @a2 tagattribute required="false" + */ + public void setLeftUpLabel(String leftUpLabel) { + this.leftUpLabel = leftUpLabel; + } + public String getLeftUpLabel() { + return this.leftUpLabel; + } + + /** + * Down label for the left side. + * @a2 tagattribute required="false" + */ + public void setLeftDownLabel(String leftDownLabel) { + this.leftDownlabel = leftDownLabel; + } + public String getLeftDownLabel() { + return this.leftDownlabel; + } + + /** + * Up label for the right side. + * @a2 tagattribute required="false" + */ + public void setRightUpLabel(String rightUpLabel) { + this.rightUpLabel = rightUpLabel; + } + public String getRightUpLabel() { + return this.rightUpLabel; + } + + + /** + * Down label for the left side. + * @a2 tagattribute required="false" + */ + public void setRightDownLabel(String rightDownlabel) { + this.rightDownLabel = rightDownlabel; + } + public String getRightDownLabel() { + return rightDownLabel; + } + + } Modified: struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/OptionTransferSelectTag.java URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/OptionTransferSelectTag.java?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/OptionTransferSelectTag.java (original) +++ struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/OptionTransferSelectTag.java Sat Jun 17 05:26:03 2006 @@ -25,6 +25,7 @@ import com.opensymphony.xwork.util.OgnlValueStack; /** + * OptionTransferSelect jsp tag. */ public class OptionTransferSelectTag extends AbstractDoubleListTag { @@ -35,6 +36,8 @@ protected String allowAddAllToLeft; protected String allowAddAllToRight; protected String allowSelectAll; + protected String allowUpDownOnLeft; + protected String allowUpDownOnRight; protected String leftTitle; protected String rightTitle; @@ -47,6 +50,10 @@ protected String addAllToLeftLabel; protected String addAllToRightLabel; protected String selectAllLabel; + protected String leftUpLabel; + protected String leftDownLabel; + protected String rightUpLabel; + protected String rightDownLabel; public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) { @@ -62,12 +69,18 @@ optionTransferSelect.setAllowAddAllToLeft(allowAddAllToLeft); optionTransferSelect.setAllowAddAllToRight(allowAddAllToRight); optionTransferSelect.setAllowSelectAll(allowSelectAll); + optionTransferSelect.setAllowUpDownOnLeft(allowUpDownOnLeft); + optionTransferSelect.setAllowUpDownOnRight(allowUpDownOnRight); optionTransferSelect.setAddToLeftLabel(addToLeftLabel); optionTransferSelect.setAddToRightLabel(addToRightLabel); optionTransferSelect.setAddAllToLeftLabel(addAllToLeftLabel); optionTransferSelect.setAddAllToRightLabel(addAllToRightLabel); optionTransferSelect.setSelectAllLabel(selectAllLabel); + optionTransferSelect.setLeftUpLabel(leftUpLabel); + optionTransferSelect.setLeftDownLabel(leftDownLabel); + optionTransferSelect.setRightUpLabel(rightUpLabel); + optionTransferSelect.setRightDownLabel(rightDownLabel); optionTransferSelect.setButtonCssClass(buttonCssClass); optionTransferSelect.setButtonCssStyle(buttonCssStyle); Modified: struts/action2/trunk/core/src/main/resources/template/simple/optiontransferselect.ftl URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/resources/template/simple/optiontransferselect.ftl?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/main/resources/template/simple/optiontransferselect.ftl (original) +++ struts/action2/trunk/core/src/main/resources/template/simple/optiontransferselect.ftl Sat Jun 17 05:26:03 2006 @@ -8,7 +8,31 @@ <#if parameters.leftTitle?exists><#t/> <label for="leftTitle">${parameters.leftTitle}</label><br/> </#if><#t/> -<#include "/${parameters.templateDir}/simple/select.ftl" /> </td> +<#include "/${parameters.templateDir}/simple/select.ftl" /> +<#if parameters.allowUpDownOnLeft?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.leftDownLabel?exists> + value="${parameters.leftDownLabel?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.leftUpLabel?exists> + value="${parameters.leftUpLabel?html}" +</#if> +/> +</#if> + +</td> <td valign="middle" align="center"> <#if parameters.allowAddToLeft?default(true)><#t/> <#assign addToLeftLabel = parameters.addToLeftLabel?default("<-")?html/><#t/> @@ -231,6 +255,28 @@ >${doubleItemValue?html}</option><#lt/> </@saf.iterator><#t/> </select> +<#if parameters.allowUpDownOnRight?default(true)> +<input type="button" +<#if parameters.doubleHeaderKey?exists> + onclick="moveOptionDown(document.getElementById('${parameters.doubleId}'), 'key', '${parameters.doubleHeaderKey}');" +<#else> + onclick="moveOptionDown(document.getElementById('${parameters.doubleId}'), 'key', '');" +</#if> +<#if parameters.rightDownLabel?exists> + value="${parameters.rightDownLabel?html}" +</#if> +/> +<input type="button" +<#if parameters.doubleHeaderKey?exists> + onclick="moveOptionUp(document.getElementById('${parameters.doubleId}'), 'key', '${parameters.doubleHeaderKey}');" +<#else> + onclick="moveOptionUp(document.getElementById('${parameters.doubleId}'), 'key', '');" +</#if> +<#if parameters.rightUpLabel?exists> + value="${parameters.rightUpLabel?html}" +</#if> +/> +</#if> </td> </tr> </table> Modified: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-1.txt URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-1.txt?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-1.txt (original) +++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-1.txt Sat Jun 17 05:26:03 2006 @@ -12,6 +12,8 @@ <option value="Left1" selected="selected">Left1</option> <option value="Left2" selected="selected">Left2</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('id'), 'key', 'Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('id'), 'key', 'Header Key');" value="^" /> </td> <td valign="middle" align="center"> <input type="button" class="buttonCssClass" style="buttonCssStyle" @@ -38,6 +40,8 @@ <option value="Right1" selected="selected">Right1</option> <option value="Right2" selected="selected">Right2</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="^" /> </td> </tr> </table> Modified: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-2.txt URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-2.txt?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-2.txt (original) +++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-2.txt Sat Jun 17 05:26:03 2006 @@ -13,6 +13,8 @@ <option value="Left2" selected="selected">Left2</option> <option value="Left3">Left3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('id'), 'key', 'Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('id'), 'key', 'Header Key');" value="^" /> </td> <td valign="middle" align="center"> <input type="button" class="buttonCssClass" style="buttonCssStyle" @@ -39,6 +41,8 @@ <option value="Right2" selected="selected">Right2</option> <option value="Right3">Right3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="^" /> </td> </tr> </table> Modified: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-3.txt URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-3.txt?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-3.txt (original) +++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-3.txt Sat Jun 17 05:26:03 2006 @@ -12,6 +12,8 @@ <option value="Left2" selected="selected">Left2</option> <option value="Left3">Left3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('id'), 'key', '');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('id'), 'key', '');" value="^" /> </td> <td valign="middle" align="center"> <input type="button" class="buttonCssClass" style="buttonCssStyle" @@ -38,6 +40,8 @@ <option value="Right2" selected="selected">Right2</option> <option value="Right3">Right3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('doubleId'), 'key', '');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('doubleId'), 'key', '');" value="^" /> </td> </tr> </table> Modified: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-4.txt URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-4.txt?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-4.txt (original) +++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-4.txt Sat Jun 17 05:26:03 2006 @@ -13,6 +13,8 @@ <option value="Left2" selected="selected">Left2</option> <option value="Left3">Left3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('id'), 'key', 'Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('id'), 'key', 'Header Key');" value="^" /> </td> <td valign="middle" align="center"> <input type="button" class="buttonCssClass" style="buttonCssStyle" @@ -39,6 +41,9 @@ <option value="Right2" selected="selected">Right2</option> <option value="Right3">Right3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('doubleId'), 'key', '');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('doubleId'), 'key', '');" value="^" /> + </td> </tr> </table> Modified: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-5.txt URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-5.txt?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-5.txt (original) +++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-5.txt Sat Jun 17 05:26:03 2006 @@ -12,6 +12,8 @@ <option value="Left2" selected="selected">Left2</option> <option value="Left3">Left3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('id'), 'key', 'Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('id'), 'key', 'Header Key');" value="^" /> </td> <td valign="middle" align="center"> <input type="button" class="buttonCssClass" style="buttonCssStyle" @@ -38,6 +40,8 @@ <option value="Right2" selected="selected">Right2</option> <option value="Right3">Right3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="^" /> </td> </tr> </table> Modified: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-6.txt URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-6.txt?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-6.txt (original) +++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-6.txt Sat Jun 17 05:26:03 2006 @@ -13,6 +13,8 @@ <option value="Left2" selected="selected">Left2</option> <option value="Left3">Left3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('id'), 'key', 'Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('id'), 'key', 'Header Key');" value="^" /> </td> <td valign="middle" align="center"> <input type="button" class="buttonCssClass" style="buttonCssStyle" @@ -39,6 +41,8 @@ <option value="Right2" selected="selected">Right2</option> <option value="Right3">Right3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="^" /> </td> </tr> </table> Modified: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-7.txt URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-7.txt?rev=415023&r1=415022&r2=415023&view=diff ============================================================================== --- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-7.txt (original) +++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/optiontransferselect-7.txt Sat Jun 17 05:26:03 2006 @@ -13,6 +13,8 @@ <option value="Left2" selected="selected">Left2</option> <option value="Left3">Left3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('id'), 'key', 'Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('id'), 'key', 'Header Key');" value="^" /> </td> <td valign="middle" align="center"> <input type="button" class="buttonCssClass" style="buttonCssStyle" @@ -34,6 +36,8 @@ <option value="Right2" selected="selected">Right2</option> <option value="Right3">Right3</option> </select> + <input type="button" onclick="moveOptionDown(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="v" /> + <input type="button" onclick="moveOptionUp(document.getElementById('doubleId'), 'key', 'Double Header Key');" value="^" /> </td> </tr> </table>