Updated Branches:
  refs/heads/wicket-1.5.x 38d6c932a -> 3a619a052

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/3a619a05
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3a619a05
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3a619a05

Branch: refs/heads/wicket-1.5.x
Commit: 3a619a05267d73398dea2d0a0e9b6e82ee387c03
Parents: 38d6c93
Author: Sven Meier <[email protected]>
Authored: Thu May 24 08:00:49 2012 +0200
Committer: Sven Meier <[email protected]>
Committed: Thu May 24 08:00:49 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/3a619a05/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/3a619a05/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 ae79dfc..d8f7023 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

Reply via email to