You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Yohan Yudanara <yo...@gmail.com> on 2012/01/10 05:21:10 UTC

Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

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..

Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by Yohan Yudanara <yo...@gmail.com>.
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 <yo...@gmail.com>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 <yohan.yudanara@gmail.com
> > 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..
>>
>>
>>
>

Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by Yohan Yudanara <yo...@gmail.com>.
Sorry, my previous email contains wrong copy-paste :). I want to correct
this, in case someone looking solution for the same problem :)

To make overriding DefaultValidationDecorator works on Tapestry 5.3.1, I'm
replacing:
     configuration.override("DefaultValidationDecorator",
validationDecorator); //Tapestry 5.2.6
with:
     configuration.override("ValidationDecorator", validationDecorator);
//Tapestry 5.3.1
on AppModule.java

That's because DefaultValidationDecorator now added with id
"ValidationDecorator" as mentions by Mr. Thiago. (look at
TapestryModule.java line 2137)



On Wed, Jan 11, 2012 at 9:18 PM, Yohan Yudanara <yo...@gmail.com>wrote:
>
>
> I've checked on TapestryModule and I've found out that
> DefaultValidationDecorator becomes "ValidationDecorator".
> So, now I'm replacing:
>        configuration.override("DefaultValidationDecorator",
> validationDecorator);
> with
>        configuration.add("ValidationDecorator",
> defaultValidationDecorator);
>
>
>

Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 11 Jan 2012 21:03:30 -0200, Yohan Yudanara  
<yo...@gmail.com> wrote:

> Yup, I'm still waiting for Igor's book.
> I'm sure when your blog becomes available, that will be great complement  
> to Igor's book :)

Yep, that's the plan. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by Yohan Yudanara <yo...@gmail.com>.
Yup, I'm still waiting for Igor's book.
I'm sure when your blog becomes available, that will be great complement to
Igor's book :)

On Thu, Jan 12, 2012 at 12:00 AM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

>
> I wish I had the opportunity. Meanwhile, I'm sure Igor's book will be
> awesome. ;) I'll have a blog about Tapestry when I have the time to
> implement the blog engine in Tapestry. :)
>
>
>
>

Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 11 Jan 2012 12:18:22 -0200, Yohan Yudanara  
<yo...@gmail.com> wrote:

> Thanks a lot, Mr. Thiago

Hi!

> I've checked on TapestryModule and I've found out that
> DefaultValidationDecorator becomes "ValidationDecorator".
> So, now I'm replacing:
>        configuration.override("DefaultValidationDecorator",
> validationDecorator);
> with
>        configuration.add("ValidationDecorator",  
> defaultValidationDecorator);

Nice! :)

> There have been so many questions on this mailing list answered by you. I
> think you can write a great book about Tapestry :)

I wish I had the opportunity. Meanwhile, I'm sure Igor's book will be  
awesome. ;) I'll have a blog about Tapestry when I have the time to  
implement the blog engine in Tapestry. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by Yohan Yudanara <yo...@gmail.com>.
Thanks a lot, Mr. Thiago

I've checked on TapestryModule and I've found out that
DefaultValidationDecorator becomes "ValidationDecorator".
So, now I'm replacing:
       configuration.override("DefaultValidationDecorator",
validationDecorator);
with
       configuration.add("ValidationDecorator", defaultValidationDecorator);


There have been so many questions on this mailing list answered by you. I
think you can write a great book about Tapestry :)
Thanks a lot..



On Wed, Jan 11, 2012 at 6:48 PM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Wed, 11 Jan 2012 08:09:59 -0200, Yohan Yudanara <
> yohan.yudanara@gmail.com> wrote:
>
>  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."
>>
>
> It seems the default validation decorator is now added with other id.
> Check the source of TapestryModule and use the correct id to override it.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>

Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 11 Jan 2012 08:09:59 -0200, Yohan Yudanara  
<yo...@gmail.com> wrote:

> 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."

It seems the default validation decorator is now added with other id.  
Check the source of TapestryModule and use the correct id to override it.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Error override DefaultValidationDecorator on Upgrading 5.2.6 to 5.3.1

Posted by Yohan Yudanara <yo...@gmail.com>.
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
<yo...@gmail.com>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..
>
>
>