You can create your own implementation of the interface, or subclass
Tapestry's and extend it.

The trick is to get Tapestry to *use* it.

If you look at the various form components, they have the following:

@Environmental
private ValidationDecorator _decorator;

That means "pick up the decorator from the environment".  What's the
environment?

It's a service, Environment, that is scoped to the request, that holds
these things.

Before the Form renders, your decorator must be added to the environment:

Perhaps you would do this from your application-specific Layout component:

@Inject
private Environment _environment;

public void beginRender()
{
 _environment.push(ValidationDelegate.class, new MyValidationDelegate());
}

public void afterRender()
{
 _environment.pop(ValidationDelegate.class);
}


This Layout component (T4 used the term "Border" for this pattern)
wraps around all the content of your page.  It generally provides some
navigation for the page, as well as CSS & etc . for look and feel;
here is is also providing the ValidatonDelegate used inside your page.

On 7/10/07, Foror <[EMAIL PROTECTED]> wrote:
Hi! How to create my ValidationDecorator in T5, with marked required
fields when Form is first loaded on page?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to