Wicket DropDownIdChoice

This one is all about id <-> object mapping when using DropDowns:

 Java |  copy |? 
/**
 * @author igor vaynberg
 */
public class DropDownIdChoice extends DropDownChoice
{
 
    public DropDownIdChoice(String id, IModel model, IModel choices, IChoiceRenderer renderer, Class<?> type)
    {
        super(id, model, choices, renderer);
        setType(type);
    }
 
    @Override
    public String getModelValue()
    {
        final Object id = getModelObject();
        if (id != null)
        {
            return getConverter(getType()).convertToString(id, getLocale());
        }
        else
        {
            return NO_SELECTION_VALUE;
        }
    }
}                

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>