Updated Branches: refs/heads/master 7a1daf102 -> 7d82e5cb2
WICKET-4353 Reverted the new index check. Otherwise it's not possible to utilize the renderer's id for semantic equality, which is a valid usecase. Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/7d82e5cb Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/7d82e5cb Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/7d82e5cb Branch: refs/heads/master Commit: 7d82e5cb20cf1b052651097560e46acbe14b1a16 Parents: 7a1daf1 Author: Sven Meier <[email protected]> Authored: Thu May 24 08:20:58 2012 +0200 Committer: Sven Meier <[email protected]> Committed: Thu May 24 08:20:58 2012 +0200 ---------------------------------------------------------------------- .../html/form/AbstractSingleSelectChoice.java | 14 -------------- .../wicket/markup/html/form/IChoiceRenderer.java | 3 +++ 2 files changed, 3 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/7d82e5cb/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java index 1529819..1a2b83a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java @@ -194,20 +194,6 @@ public abstract class AbstractSingleSelectChoice<T> extends AbstractChoice<T, T> if (object != null) { int index = getChoices().indexOf(object); - - if (index < 0) - { - // the model is returning a choice that is not in the available choices collection - - logger.warn( - "Detected inconsistency in choice component: {}/{}. Model returned object: {}, but this object is not available in the list of selected objects.", - new Object[] { getPage().getClass(), getPageRelativePath(), object }); - - // pretend like nothing is selected - - return ""; - } - return getChoiceRenderer().getIdValue(object, index); } else http://git-wip-us.apache.org/repos/asf/wicket/blob/7d82e5cb/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java index 05c7e76..31b44e7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/IChoiceRenderer.java @@ -42,6 +42,9 @@ public interface IChoiceRenderer<T> extends IClusterable * This method is called to get the id value of an object (used as the value attribute of a * choice element) The id can be extracted from the object like a primary key, or if the list is * stable you could just return a toString of the index. + * <p> + * Note that the given index can be {@code -1} if the object in question is not contained in the + * available choices. * * @param object * The object for which the id should be generated
