/** * Converts submitted choice id string back to choice object. * * @param id * string id of one of the choice objects in the choices list. can be null. * @return choice object. null if none match the specified id. */ protected Object convertChoiceIdToChoice(String id) { final List choices = getChoices(); final IChoiceRenderer renderer = getChoiceRenderer(); for (int index = 0; index < choices.size(); index++) { // Get next choice final Object choice = choices.get(index); if (renderer.getIdValue(choice, index).equals(id)) { return choice; } } return null; }
/** * Converts submitted choice id string back to choice object. * * @param id * string id of one of the choice objects in the choices list. can be null. * @return choice object. null if none match the specified id. */ protected T convertChoiceIdToChoice(String id) { final List<? extends T> choices = getChoices(); final IChoiceRenderer<? super T> renderer = getChoiceRenderer(); for (int index = 0; index < choices.size(); index++) { // Get next choice final T choice = choices.get(index); if (renderer.getIdValue(choice, index).equals(id)) { return choice; } } return null; }
/** * @see FormComponent#getModelValue() */ public String getModelValue() { final Object object = getModelObject(); if (object != null) { int index = getChoices().indexOf(object); return getChoiceRenderer().getIdValue(object, index); } return NO_SELECTION_VALUE; }
/** * @see FormComponent#getModelValue() */ @Override public String getModelValue() { final T object = getModelObject(); if (object != null) { int index = getChoices().indexOf(object); return getChoiceRenderer().getIdValue(object, index); } return getNoSelectionValue().toString(); }
/** * @see FormComponent#getModelValue() */ @Override public String getModelValue() { final T object = getModelObject(); if (object != null) { int index = getChoices().indexOf(object); return getChoiceRenderer().getIdValue(object, index); } else { return ""; } }
/** * @see FormComponent#getModelValue() */ @Override public String getModelValue() { final T object = getModelObject(); if (object != null) { int index = getChoices().indexOf(object); return getChoiceRenderer().getIdValue(object, index); } else { return ""; } }