/** * Gets whether the given value represents the current selection. * * * @param object * The object to check * @param index * The index of the object in the collection * @param selected * The current selected id value * @return Whether the given value represents the current selection */ @Override protected boolean isSelected(final T object, int index, String selected) { return (selected != null) && selected.equals(getChoiceRenderer().getIdValue(object, index)); } }
/** * Gets whether the given value represents the current selection. * * * aram object The object to check * * @param index * The index of the object in the collection * @param selected * The current selected id value * @return Whether the given value represents the current selection */ protected boolean isSelected(final Object object, int index, String selected) { return selected != null && selected.equals(getChoiceRenderer().getIdValue(object, index)); } }
/** * Gets whether the given value represents the current selection. * * * @param object * The object to check * @param index * The index of the object in the collection * @param selected * The current selected id value * @return Whether the given value represents the current selection */ @Override protected boolean isSelected(final T object, int index, String selected) { return (selected != null) && selected.equals(getChoiceRenderer().getIdValue(object, index)); } }
/** * Gets whether the given value represents the current selection. * * * aram object The object to check * * @param index * The index of the object in the collection * @param selected * The current selected id value * @return Whether the given value represents the current selection */ @Override protected boolean isSelected(final T object, int index, String selected) { return (selected != null) && selected.equals(getChoiceRenderer().getIdValue(object, index)); } }
/** * 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 IModel<? extends List<? extends T>> choices = getChoicesModel(); final IChoiceRenderer<? super T> renderer = getChoiceRenderer(); T object = (T) renderer.getObject(id, choices); return object; }
/** * 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; }
/** * 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 IModel<? extends List<? extends T>> choices = getChoicesModel(); final IChoiceRenderer<? super T> renderer = getChoiceRenderer(); T object = (T) renderer.getObject(id, choices); return object; }
/** * @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 ""; } }