You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/04/08 00:10:57 UTC

svn commit: r526493 - in /incubator/wicket/branches/wicket-1.x: jdk-1.4/wicket/src/main/java/wicket/markup/html/form/FormComponent.java pom.xml

Author: jcompagner
Date: Sat Apr  7 15:10:56 2007
New Revision: 526493

URL: http://svn.apache.org/viewvc?view=rev&rev=526493
Log:
first use parent component (to fix the testcase and i guess wanted behavior)
then use the component itself

Modified:
    incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/FormComponent.java
    incubator/wicket/branches/wicket-1.x/pom.xml

Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/FormComponent.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/FormComponent.java?view=diff&rev=526493&r1=526492&r2=526493
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/FormComponent.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/FormComponent.java Sat Apr  7 15:10:56 2007
@@ -1175,11 +1175,13 @@
 			final Localizer localizer = formComponent.getLocalizer();
 
 			String resource = prefix + getId() + "." + key;
-
+			
+			// First use the parent for resolving so that form1.textfield1.RequiredValidator can be used.
+			
 			// Note: It is important that the default value of "" is provided
 			// to getString() not to throw a MissingResourceException or to
 			// return a default string like "[Warning: String ..."
-			String message = localizer.getString(resource, formComponent, "");
+			String message = localizer.getString(resource, formComponent.getParent(), "");
 
 			// If not found, than ...
 			if (Strings.isEmpty(message))
@@ -1188,7 +1190,29 @@
 
 				resource = prefix + key;
 
+				message = localizer.getString(resource, formComponent.getParent(), "");
+			}
+
+			if (Strings.isEmpty(message))
+			{
+				// If still empty then use default
+				
+				resource = prefix + getId() + "." + key;
+	
+				// Note: It is important that the default value of "" is provided
+				// to getString() not to throw a MissingResourceException or to
+				// return a default string like "[Warning: String ..."
 				message = localizer.getString(resource, formComponent, "");
+	
+				// If not found, than ...
+				if (Strings.isEmpty(message))
+				{
+					// Try a variation of the resource key
+	
+					resource = prefix + key;
+	
+					message = localizer.getString(resource, formComponent, "");
+				}
 			}
 
 			// convert empty string to null in case our default value of "" was

Modified: incubator/wicket/branches/wicket-1.x/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/pom.xml?view=diff&rev=526493&r1=526492&r2=526493
==============================================================================
--- incubator/wicket/branches/wicket-1.x/pom.xml (original)
+++ incubator/wicket/branches/wicket-1.x/pom.xml Sat Apr  7 15:10:56 2007
@@ -444,6 +444,7 @@
 				<plugin>
 					<groupId>org.apache.maven.plugins</groupId>
 					<artifactId>maven-surefire-plugin</artifactId>
+					<version>2.1.3</version>
 					<configuration>
 						<includes>
 							<include>**/*Test.java</include>