This did break a testcase
expected:<text1label is...> but was:<Default message: text1label...>
junit.framework.ComparisonFailure: expected:&text1label is...& but
was:&Default message: text1label...&
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at
wicket.markup.html.form.ValidatorPropertiesTest.test1(ValidatorPropertiesTest.java:83)
And looking at that test case it was really meant for that the parent should
be used first
so that you can have form1.textfield1.RequiredValidator.
But i don't know to much in this area of the why's. So maybe somebody else
can explain to me
what we really want here
In the mean time I changed it a little so that first with the parent is used
then without.
johan
On 4/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: jonl
Date: Sat Apr 7 11:32:40 2007
New Revision: 526467
URL: http://svn.apache.org/viewvc?view=rev&rev=526467
Log:
Search for localizable resources for validation failure should begin at
the FormComponent and not on the parent. It is useful for specialized
subclasses of FormComponent to be able to specify their own errors. For
example, EmailField might extend TextField and do validation for
emails. Default validation errors can then be specified by that reusable
component.
Modified:
incubator/wicket/branches/wicket-1.x/jdk-1.4
/wicket/src/main/java/wicket/markup/html/form/FormComponent.java
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=526467&r1=526466&r2=526467
==============================================================================
---
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 11:32:40 2007
@@ -1163,23 +1163,23 @@
*/
public String getMessage(String key)
{
- final FormComponent fc = FormComponent.this;
+ final FormComponent formComponent =
FormComponent.this;
// retrieve prefix that will be used to construct
message keys
- String prefix = fc.getValidatorKeyPrefix();
+ String prefix =
formComponent.getValidatorKeyPrefix();
if (Strings.isEmpty(prefix))
{
prefix = "";
}
- final Localizer localizer = fc.getLocalizer();
+ final Localizer localizer =
formComponent.getLocalizer();
String 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
..."
- String message = localizer.getString(resource,
fc.getParent(), "");
+ String message = localizer.getString(resource,
formComponent, "");
// If not found, than ...
if (Strings.isEmpty(message))
@@ -1188,7 +1188,7 @@
resource = prefix + key;
- message = localizer.getString(resource,
fc.getParent(), "");
+ message = localizer.getString(resource,
formComponent, "");
}
// convert empty string to null in case our
default value of "" was