You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2007/06/18 05:15:23 UTC

svn commit: r548183 - /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java

Author: ivaynberg
Date: Sun Jun 17 20:15:22 2007
New Revision: 548183

URL: http://svn.apache.org/viewvc?view=rev&rev=548183
Log:
WICKET-348

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java?view=diff&rev=548183&r1=548182&r2=548183
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.java Sun Jun 17 20:15:22 2007
@@ -181,12 +181,24 @@
 	protected final Object convertValue(final String[] value)
 	{
 		String tmp = value != null && value.length > 0 ? value[0] : null;
-		List choices = getChoices();
+		return convertChoiceIdToChoice(tmp);
+	}
+
+	/**
+	 * Converts submitted choice id string back to choice object.
+	 * 
+	 * @param id
+	 * @return choice object
+	 */
+	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 (getChoiceRenderer().getIdValue(choice, index).equals(tmp))
+			if (renderer.getIdValue(choice, index).equals(id))
 			{
 				return choice;
 			}