I've solved the problem by replacing this line on AppModule.java:
        configuration.override("DefaultValidationDecorator",
validationDecorator);

with this:
        configuration.add("myValidationDelegate", validationDecorator,
"after:DefaultValidationDecorator");

Does anyone have explanation for this?

The first code works fine with Tapestry 5.2.6, but Tapestry 5.3.1 gives
exception "Override for object 'DefaultValidationDecorator' is invalid as
it does not match an existing object." for that line.
The second code works fine on Tapestry 5.3.1

Thanks in advance.

Best regards,
Yohan Yudanara

On Wed, Jan 11, 2012 at 5:09 PM, Yohan Yudanara <[email protected]>wrote:

> Sorry.. I want to bump up this question :)
> I'm afraid Tapestry Gurus in this mailing list is missed to read my
> question, because I haven't got any clue for this 2 days about this problem.
>
> I'm overriding DefaultValidationDecorator using technique mentions by Mr.
> Thiago on
> http://tapestry.1045711.n5.nabble.com/Example-of-overriding-the-default-ValidationDecorator-td2419072.html
>  and
> Mr. Howard Lewis on  https://issues.apache.org/jira/browse/TAPESTRY-1754
>
> It works great on Tapestry 5.2.6.
> But when I'm upgrading to Tapestry 5.3.1.
> I've got this exception when trying to open page:
> "Override for object 'DefaultValidationDecorator' is invalid as it does
> not match an existing object."
>
> Has someone successfully upgrading to Tapestry 5.3.1 with overriding
> DefaultValidationDecorator on AppModule?
>
> Please give me some clue..
> Thanks in advance..
>
> Best regards,
> Yohan Yudanara
>
>
> On Tue, Jan 10, 2012 at 11:21 AM, Yohan Yudanara <[email protected]
> > wrote:
>
>> Hi,
>>
>> I'm upgrading my app from Tapestry 5.2.6 to 5.3.1.
>>
>> I've got the following exception:
>>
>> Exception constructing service 'MarkupRenderer': Failure processing
>> override from AppModule.contributeMarkupRenderer(OrderedConfiguration,
>> Environment) (at AppModule.java:123): Override for object
>> 'DefaultValidationDecorator' is invalid as it does not match an existing
>> object.
>>
>> I'm overriding DefaultValidationDecorator on AppModule using this code:
>>
>> public static void
>> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
>> configuration,
>>                                                 final Environment
>> environment) {
>>
>>         MarkupRendererFilter validationDecorator = new
>> MarkupRendererFilter() {
>>             public void renderMarkup(MarkupWriter writer, MarkupRenderer
>> renderer) {
>>                 ValidationDecorator decorator = new
>>                         CustomValidationDecorator(environment, writer);
>>
>>                 environment.push(ValidationDecorator.class, decorator);
>>                 renderer.renderMarkup(writer);
>>                 environment.pop(ValidationDecorator.class);
>>             }
>>         };
>>         configuration.override("DefaultValidationDecorator",
>> validationDecorator);
>>     }
>>
>>
>> And... , my CustomValidationDecorator class just contains this:
>>  public CustomValidationDecorator(Environment environment, MarkupWriter
>> markupWriter) {
>>         this.environment = environment;
>>         this.markupWriter = markupWriter;
>>     }
>>
>>     @Override
>>     public void insideField(Field field) {
>>         ValidationTracker tracker =
>> environment.peekRequired(ValidationTracker.class);
>>
>>         if (tracker.inError(field)) {
>>             markupWriter.getElement().addClassName("error_field");
>>         }
>>     }
>>
>> What should I fix in order to make overriding DefaultValidationDecorator
>> can work on Tapestry 5.3.1?
>> Please give me a clue..
>>
>> Thanks in advance..
>>
>>
>>
>

Reply via email to