UpDownSelectpublic class UpDownSelect extends Select
Create a Select component with buttons to move the elements in the select component
up and down. When the containing form is submited, its elements will be submitted in
the order they are arranged (top to bottom).
<!-- Example 1: simple example -->
<s:updownselect
list="#{'england':'England', 'america':'America', 'germany':'Germany'}"
name="prioritisedFavouriteCountries"
headerKey="-1"
headerValue="--- Please Order Them Accordingly ---"
emptyOption="true" />
<!-- Example 2: more complex example -->
<s:updownselect
list="defaultFavouriteCartoonCharacters"
name="prioritisedFavouriteCartoonCharacters"
headerKey="-1"
headerValue="--- Please Order ---"
emptyOption="true"
allowMoveUp="true"
allowMoveDown="true"
allowSelectAll="true"
moveUpLabel="Move Up"
moveDownLabel="Move Down"
selectAllLabel="Select All" />
|
Fields Summary |
---|
private static final Log | _log | public static final String | TEMPLATE | protected String | allowMoveUp | protected String | allowMoveDown | protected String | allowSelectAll | protected String | moveUpLabel | protected String | moveDownLabel | protected String | selectAllLabel |
Methods Summary |
---|
public void | evaluateParams()
super.evaluateParams();
// override Select's default
if (size == null || size.trim().length() <= 0) {
addParameter("size", "5");
}
if (multiple == null || multiple.trim().length() <= 0) {
addParameter("multiple", Boolean.TRUE);
}
if (allowMoveUp != null) {
addParameter("allowMoveUp", findValue(allowMoveUp, Boolean.class));
}
if (allowMoveDown != null) {
addParameter("allowMoveDown", findValue(allowMoveDown, Boolean.class));
}
if (allowSelectAll != null) {
addParameter("allowSelectAll", findValue(allowSelectAll, Boolean.class));
}
if (moveUpLabel != null) {
addParameter("moveUpLabel", findString(moveUpLabel));
}
if (moveDownLabel != null) {
addParameter("moveDownLabel", findString(moveDownLabel));
}
if (selectAllLabel != null) {
addParameter("selectAllLabel", findString(selectAllLabel));
}
// inform our form ancestor about this UpDownSelect so the form knows how to
// auto select all options upon it submission
Form ancestorForm = (Form) findAncestor(Form.class);
if (ancestorForm != null) {
// inform form ancestor that we are using a custom onsubmit
enableAncestorFormCustomOnsubmit();
Map m = (Map) ancestorForm.getParameters().get("updownselectIds");
if (m == null) {
// map with key -> id , value -> headerKey
m = new LinkedHashMap();
}
m.put(getParameters().get("id"), getParameters().get("headerKey"));
ancestorForm.getParameters().put("updownselectIds", m);
}
else {
_log.warn("no ancestor form found for updownselect "+this+", therefore autoselect of all elements upon form submission will not work ");
}
| public java.lang.String | getAllowMoveDown()
return allowMoveDown;
| public java.lang.String | getAllowMoveUp()
return allowMoveUp;
| public java.lang.String | getAllowSelectAll()
return allowSelectAll;
| public java.lang.String | getDefaultTemplate()
return TEMPLATE;
| public java.lang.String | getMoveDownLabel()
return moveDownLabel;
| public java.lang.String | getMoveUpLabel()
return moveUpLabel;
| public java.lang.String | getSelectAllLabel()
return selectAllLabel;
| public void | setAllowMoveDown(java.lang.String allowMoveDown)
this.allowMoveDown = allowMoveDown;
| public void | setAllowMoveUp(java.lang.String allowMoveUp)
this.allowMoveUp = allowMoveUp;
| public void | setAllowSelectAll(java.lang.String allowSelectAll)
this.allowSelectAll = allowSelectAll;
| public void | setMoveDownLabel(java.lang.String moveDownLabel)
this.moveDownLabel = moveDownLabel;
| public void | setMoveUpLabel(java.lang.String moveUpLabel)
this.moveUpLabel = moveUpLabel;
| public void | setSelectAllLabel(java.lang.String selectAllLabel)
this.selectAllLabel = selectAllLabel;
|
|