package be.selckin.swu.model; import org.apache.wicket.injection.Injector; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.model.IModel; import java.util.List; public abstract class InjectingChoiceRenderer<T> implements IChoiceRenderer<T> { protected InjectingChoiceRenderer() { Injector.get().inject(this); } @Override public T getObject(String id, IModel<? extends List<? extends T>> choices) { List<? extends T> _choices = choices.getObject(); for (int index = 0; index < _choices.size(); index++) { // Get next choice final T choice = _choices.get(index); if (getIdValue(choice, index).equals(id)) { return choice; } } return null; } }