Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
selection-2.08.01
-
None
Description
Two improvements:
1. Respect empty string value
I've found that we cannot add an empty value in the static dropdown.
For example, I want to be able to set "selectable.options" value to
",Apple,Pear,Orange" which is supposed to show an empty string at the
top, followed by "Apple", "Pear" and "Orange".
However, currently, it just ignores the first empty string value,
showing only the following three options.
It turned out that the wicket StringList.tokenize() ignores an empty
string token if it is placed at the top (e.g, ",a,b,c") or at the bottom
(e.g, "a,b,c,"). The wicket StringList.tokenize() respect an empty
string in the middle (e.g, "a,b,,d") though.
So, I'd like to replace StringList.tokenize() with
org.apache.commons.lang.StringUtils#splitPreserveAllTokens(String,
String) method.
StringUtils#splitPreserveAllTokens respects an empty string token either
at the top or at the bottom.
All the other behaviors seems the same:
- Both keep whitespace characters in the token with "," delimiter. For
example, if you set "A, B, C", then it produces a list of [ "A", " B", "
C" ].
2. Captions for values in StaticDropDown
Also, I'd like to improve the configuration for StaticDropDown to be
able to set pairs of value-caption.
For example, I'd like to configure it like this in my use case:
"linux=Linux,windows=Windows,osx=Mac OS-X,redhat=RedHat"
In my use case, the captions do not have be localized, so it might be
convenient to set captions (by using '=' delimiter inside a token) as
well like the example above.
Attachments
Issue Links
- testing discovered
-
HIPPLUG-941 Selection Plugin - Allow multiple Empty String values in StaticDropDown
- Closed