Thiago,

I was also looking for something to give me a mandatory symbol to decorate
my form fields and stumbled across your post.  When I try your example, and
other variations on it I've found from other sources, I get an issue that
has previously been raised:

org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading
parameter 'validate' of component core/PropertyEditBlocks:textfield: No
object of type org.apache.tapestry5.services.PropertyEditContext is
available from the Environment.  Available types are
org.apache.tapestry5.RenderSupport,
org.apache.tapestry5.ValidationDecorator,
org.apache.tapestry5.ValidationTracker,
org.apache.tapestry5.internal.services.DocumentLinker,
org.apache.tapestry5.services.BeanEditContext,
org.apache.tapestry5.services.ClientBehaviorSupport,
org.apache.tapestry5.services.FormSupport,
org.apache.tapestry5.services.Heartbeat. [at
classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, line 1]
        at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(Comp
onentPageElementImpl.java:948)
        at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3(Co
mponentPageElementImpl.java:925)
        at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPha
se.callback(ComponentPageElementImpl.java:159)
        at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRender
Phase.render(ComponentPageElementImpl.java:374)
        at
org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.j
ava:74)
        at
org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRender
QueueImpl.java:121)
        at 
$PageRenderQueue_126230d6e2d.render($PageRenderQueue_126230d6e2d.java)
        at 
$PageRenderQueue_126230d6e24.render($PageRenderQueue_126230d6e24.java)
        at
org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup
(MarkupRendererTerminator.java:37)
        at
org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.
java:1748)
        at
$MarkupRenderer_126230d6e2f.renderMarkup($MarkupRenderer_126230d6e2f.java)
        at
org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.
java:1732)
        at
$MarkupRenderer_126230d6e2f.renderMarkup($MarkupRenderer_126230d6e2f.java)
        at
org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.
java:1714)
        at
$MarkupRenderer_126230d6e2f.renderMarkup($MarkupRenderer_126230d6e2f.java)
        at
org.apache.tapestry5.services.TapestryModule$24.renderMarkup(TapestryModule.
java:1700)
        at
$MarkupRenderer_126230d6e2f.renderMarkup($MarkupRenderer_126230d6e2f.java)
        at
org.apache.tapestry5.services.TapestryModule$23.renderMarkup(TapestryModule.
java:1681)
        at
$MarkupRenderer_126230d6e2f.renderMarkup($MarkupRenderer_126230d6e2f.java)
        at
org.apache.tapestry5.services.TapestryModule$22.renderMarkup(TapestryModule.
java:1662)
.
.
.
... because cleanupEnvironment() has been called in PropertyEditor and pops
the PropertyEditContext.class from the environment stack before "if
(field.isRequired()) ..."  is called in the "insideLabel(Field field,
Element element)" of whatever custom ValidationDecorator you use.  I notice
in http://issues.apache.org/jira/browse/TAP5-328 Howard mentions this has
been fixed in 5.0.16 - are you still using this version and if not have you
found a tidy workaround, or perhaps you are not using such a decorator
recently?  I see a suggested patch/fix listed in TAP5-328 though would tend
to agree with the rejection reasons for the patch.  I'm using 5.1.0.5.
Thanks.

Regards,
Jim.

-----Original Message-----
From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com]
Sent: 12 January 2010 00:02
To: Tapestry users
Subject: Re: Customize Label presentation at BeanEditForm based on it's
validations


Em Mon, 11 Jan 2010 21:48:05 -0200, Howard Lewis Ship <hls...@gmail.com>
escreveu:

> This is the function of the ValidationDecorator, look up its JavaDoc.
>
> You can override the ValidationDecorator (its' awkward but possible in
> 5.1, will be made easier in 5.2).  Look in TapestryModule, in methods
> contributeMarkupRenderer and contributePartialMarkupRenderer.

I've posted one example some time ago. The archive is here:
http://old.nabble.com/Example-of-overriding-the-default-ValidationDecorator-
td26906669s302.html#a26906669

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

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


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

Reply via email to