Hi, thanks for the quick reply.
MartinM wrote:
>
>> There's a small bug - endOptGroup(tmp) for "OptGroup changed" actually
>> closes
>> the optgroup after the current option, not before.
>
> Note: It is supposed to close the previous optgroup. Not the current
> optgroup.
>
Yep, that's why it's a bug. It actually starts a new optgroup and closes it
after one option.
> If there is a bug, can you give me your testcase?
>
Sure, here's the code:
package test;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.apache.wicket.markup.html.WebPage;
public class TestPage extends WebPage {
private static class Val implements Serializable {
private static final long serialVersionUID = 1L;
private final String text;
private final String group;
public Val(final String text, final String group) {
this.text = text;
this.group = group;
}
public String getText() {
return text;
}
public String getGroup() {
return group;
}
}
private static final IStyledChoiceRenderer<Val> R = new
IStyledChoiceRenderer<Val>() {
private static final long serialVersionUID = 1L;
@Override
public String getIdValue(final Val object, final int index) {
return String.valueOf(index);
}
@Override
public Object getDisplayValue(final Val object) {
return object.getText();
}
@Override
public String getOptionCssClassName(final Val t) {
return null;
}
@Override
public String getOptGroupLabel(final Val t) {
return t.getGroup();
}
};
public TestPage() {
final List<Val> list = new ArrayList<Val>();
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
list.add(new Val("text" + j, "group" + i));
}
}
add(new DropDownChoiceWithStylingOptions<Val>("test", list, R));
}
}
and the markup:
<html xmlns:wicket>
<body>
<select wicket:id="test"></select>
</body>
</html>
This is what it generates (I haven't stripped the wicket tags):
<html xmlns:wicket>
<body>
<select wicket:id="test" name="test">
<option selected="selected" value="">Choose One</option>
<optgroup label="group0"><option value="0">text0</option>
<option value="1">text1</option>
<option value="2">text2</option>
<optgroup label="group1"><option value="3">text0</option></optgroup>
<option value="4">text1</option>
<option value="5">text2</option>
<optgroup label="group2"><option value="6">text0</option></optgroup>
<option value="7">text1</option>
<option value="8">text2</option></optgroup>
</select>
</body>
</html>
Adrian
--
View this message in context:
http://old.nabble.com/DropDownChoiceWithStylingOptions%3CT%3E-tp26642690p27112292.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]