My understanding of this class must be faulty. When Wicket calls my
onSelectionChanged(), the argument is the display string, not the id
value. For example, I'm expecting a milepost value like "123.456", but
instead I get "End (123.456)" (the display value). Here's the code. can
anyone see what I'm doing wrong?
private RadioChoice<String> createMilepostChoice(final String id, final
TrackModel track) {
final Milepost startMP = track.getStartMP();
final Milepost endMP = track.getEndMP ();
final List<String> choices = Arrays.asList(new
String[]{format(START, startMP), format(END, endMP), OTHER});
final ChoiceRenderer<String> renderer = new
ChoiceRenderer<String>() {
private static final long serialVersionUID = 1L;
@Override public Object getDisplayValue(final String model) {
return model;
}
@Override public String getIdValue(final String model, final int
index) {
String value;
switch (index) {
case 0:
value = startMP.toString();
break;
case 1 :
value = endMP.toString();
break;
default :
value = "";
}
return value;
}
};
final RadioChoice<String> choice = new RadioChoice<String>(id,
choices, renderer) {
private static final long serialVersionUID = 1L;
@Override protected void onSelectionChanged(final Object
new selection) {
final String selection = (String)newSelection;
if (track == primaryTrack) {
primaryMpChoice = selection;
} else {
secondaryMpChoice = selection;
}
}
@Override protected boolean
wantOnSelectionChangedNotifications() {
return true;
}
};
return choice;
}
**
This email and any attachments may contain information that is confidential
and/or privileged for the sole use of the intended recipient. Any use, review,
disclosure, copying, distribution or reliance by others, and any forwarding of
this email or its contents, without the express permission of the sender is
strictly prohibited by law. If you are not the intended recipient, please
contact the sender immediately, delete the e-mail and destroy all copies.
**