Author: ivaynberg
Date: Thu Jun  7 06:35:01 2007
New Revision: 545176

URL: http://svn.apache.org/viewvc?view=rev&rev=545176
Log:
WICKET-624 AbstractSingleChoice: components can't have specific null or 
nullValid messages

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=545176&r1=545175&r2=545176
==============================================================================
--- 
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
 Thu Jun  7 06:35:01 2007
@@ -20,6 +20,7 @@
 
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.util.string.AppendingStringBuffer;
+import org.apache.wicket.util.string.Strings;
 
 
 /**
@@ -215,7 +216,11 @@
                if (isNullValid())
                {
                        // Null is valid, so look up the value for it
-                       final String option = 
getLocalizer().getString("nullValid", this, "");
+                       String option = getLocalizer().getString(getId() + 
".nullValid", this, "");
+                       if (Strings.isEmpty(option))
+                       {
+                               option = getLocalizer().getString("nullValid", 
this, "");
+                       }
 
                        // The <option> tag buffer
                        final AppendingStringBuffer buffer = new 
AppendingStringBuffer(32 + option.length());
@@ -241,7 +246,11 @@
                                        || selected.equals(EMPTY_STRING))
                        {
                                // Force the user to pick a non-null value
-                               final String option = 
getLocalizer().getString("null", this, CHOOSE_ONE);
+                               String option = 
getLocalizer().getString(getId() + ".null", this, "");
+                               if (Strings.isEmpty(option))
+                               {
+                                       option = 
getLocalizer().getString("null", this, CHOOSE_ONE);
+                               }
                                return new AppendingStringBuffer("\n<option 
selected=\"selected\" value=\"\">")
                                                
.append(option).append("</option>");
                        }


Reply via email to