You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2010/01/12 00:48:05 UTC

Re: Customize Label presentation at BeanEditForm based on it's validations

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.

On Mon, Jan 11, 2010 at 3:29 PM, Everton Agner
<ev...@yahoo.com.br> wrote:
> Hi,
>
> Here is my problem: My project specification says that every Required Field must have a "*" character before it's label text - Like:
>
>        *Name:   [field]
>
> So, I need to do that in all my BeanEditForms, but I don't want to customize each Label at every page's TML. So, how I can do that at the most generic way so I don't need to worry about it at every Entity Edit page?
>
> I mean... a way I can find the "required" validation in the label and could customize it's rendering for the BeanEditForm...
>
> I hope I could explain it well...
>
> Thanks,
>
> Everton
>
>
>
>      ____________________________________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Res: Customize Label presentation at BeanEditForm based on it's validations

Posted by Everton Agner <ev...@yahoo.com.br>.
Thank you guys, it's perfect! I knew there was a right way to do it :)

I'll implement it here...

Everton




________________________________
De: Thiago H. de Paula Figueiredo <th...@gmail.com>
Para: Tapestry users <us...@tapestry.apache.org>
Enviadas: Segunda-feira, 11 de Janeiro de 2010 22:01:48
Assunto: Re: Customize Label presentation at BeanEditForm based on it's validations

Em Mon, 11 Jan 2010 21:48:05 -0200, Howard Lewis Ship <hl...@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

Re: Emailing Application Errors

Posted by Jeshurun Daniel <sj...@yahoo.ca>.
Great I'll look into it. Thanks for the prompt reply!

--- On Mon, 4/26/10, Michael Prescott <mi...@gmail.com> wrote:

From: Michael Prescott <mi...@gmail.com>
Subject: Re: Emailing Application Errors
To: "Tapestry users" <us...@tapestry.apache.org>
Received: Monday, April 26, 2010, 12:41 PM

log4j has a email appender, I believe, so you could configure log4j to email
you everything above a certain threshhold, etc.

Michael

On Mon, Apr 26, 2010 at 1:38 PM, Jeshurun Daniel <sj...@yahoo.ca> wrote:

> Is there a way to configure Tapestry to automatically email error reports
> when an application error occurs? I used python's django framework
> previously and it can be configured to automatically email errors to
> predefined email addresses, and it comes in handy to fixing bugs quickly. Is
> such a configuration possible in tapestry? Or can it be achieved by
> configuring Log4j? I'm sorry if I am being noobish here, I'm new to tapestry
> and any help would be appreciated.
> Thanks,
> Jeshurun
>
>



Re: Emailing Application Errors

Posted by Michael Prescott <mi...@gmail.com>.
log4j has a email appender, I believe, so you could configure log4j to email
you everything above a certain threshhold, etc.

Michael

On Mon, Apr 26, 2010 at 1:38 PM, Jeshurun Daniel <sj...@yahoo.ca> wrote:

> Is there a way to configure Tapestry to automatically email error reports
> when an application error occurs? I used python's django framework
> previously and it can be configured to automatically email errors to
> predefined email addresses, and it comes in handy to fixing bugs quickly. Is
> such a configuration possible in tapestry? Or can it be achieved by
> configuring Log4j? I'm sorry if I am being noobish here, I'm new to tapestry
> and any help would be appreciated.
> Thanks,
> Jeshurun
>
>

Re: Emailing Application Errors

Posted by Jeshurun Daniel <sj...@yahoo.ca>.
Thanks that worked!

--- On Mon, 4/26/10, Thiago H. de Paula Figueiredo <th...@gmail.com> wrote:

From: Thiago H. de Paula Figueiredo <th...@gmail.com>
Subject: Re: Emailing Application Errors
To: "Tapestry users" <us...@tapestry.apache.org>
Received: Monday, April 26, 2010, 12:44 PM

On Mon, 26 Apr 2010 14:38:33 -0300, Jeshurun Daniel <sj...@yahoo.ca> wrote:

> Is there a way to configure Tapestry to automatically email error reports when an application error occurs? I used python's django framework previously and it can be configured to automatically email errors to predefined email addresses, and it comes in handy to fixing bugs quickly. Is such a configuration possible in tapestry? Or can it be achieved by configuring Log4j? I'm sorry if I am being noobish here, I'm new to tapestry and any help would be appreciated.

Not out of the box, but it's relatively easy. Create an error page as explained in http://tapestry.apache.org/tapestry5.1/cookbook/exceptions.html and send an email in reportException(Throwable exception) using JavaMail.

Thiago

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




Re: Emailing Application Errors

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 26 Apr 2010 14:38:33 -0300, Jeshurun Daniel <sj...@yahoo.ca>  
wrote:

> Is there a way to configure Tapestry to automatically email error  
> reports when an application error occurs? I used python's django  
> framework previously and it can be configured to automatically email  
> errors to predefined email addresses, and it comes in handy to fixing  
> bugs quickly. Is such a configuration possible in tapestry? Or can it be  
> achieved by configuring Log4j? I'm sorry if I am being noobish here, I'm  
> new to tapestry and any help would be appreciated.

Not out of the box, but it's relatively easy. Create an error page as  
explained in  
http://tapestry.apache.org/tapestry5.1/cookbook/exceptions.html and send  
an email in reportException(Throwable exception) using JavaMail.

Thiago

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


Emailing Application Errors

Posted by Jeshurun Daniel <sj...@yahoo.ca>.
Is there a way to configure Tapestry to automatically email error reports when an application error occurs? I used python's django framework previously and it can be configured to automatically email errors to predefined email addresses, and it comes in handy to fixing bugs quickly. Is such a configuration possible in tapestry? Or can it be achieved by configuring Log4j? I'm sorry if I am being noobish here, I'm new to tapestry and any help would be appreciated. 
Thanks,
Jeshurun


Re: Customize Label presentation at BeanEditForm based on it's validations

Posted by Patrick Moriarty <pm...@annadaletech.com>.
Hi,

Looks like this was not fixed in 5.0.16 as Howard asserts in
TAP5-328<https://issues.apache.org/jira/browse/TAP5-328>.
 I confirmed the problem is present in 5.0.16, 5.1.0.5 and 5.2.0-SNAPSHOT.

I somewhat agree with Howard's preference with respect to the patch but
would appreciate an alternative solution.  For now, I may have to apply the
patch.

Regards,

Paudi

On 12 January 2010 16:44, Jim O'Callaghan <jc...@yahoo.co.uk> wrote:

> Thanks for the quick response Thiago.  By mandatory symbol I mean just any
> arbitrary indicator for the user to tell that a field is mandatory, like an
> asterisk beside the prompt etc.  I'll work around the issue - though I'd
> check in case you had already come up with an elegant fix.
>
> Regards,
> Jim.
>
> -----Original Message-----
> From: Thiago H. de Paula Figueiredo [mailto:thiagohp@gmail.com]
> Sent: 12 January 2010 15:33
> To: Tapestry users
> Subject: Re: Customize Label presentation at BeanEditForm based on it's
> validations
>
>
> On Tue, 12 Jan 2010 13:25:32 -0200, Jim O'Callaghan
> <jc...@yahoo.co.uk> wrote:
>
> > Thiago,
>
> Hi!
>
> > I was also looking for something to give me a mandatory symbol to
> > decorate my form fields and stumbled across your post.
>
> I'm not following you. Mandatory symbol?
>
> > 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:
>
> That was a quick example I tried to do as a proof of concept. I use
> 5.1.0.5. I'm not using it on production. I'm aware of this problem.
>
> --
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

RE: Customize Label presentation at BeanEditForm based on it's validations

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
Thanks for the quick response Thiago.  By mandatory symbol I mean just any arbitrary indicator for the user to tell that a field is mandatory, like an asterisk beside the prompt etc.  I'll work around the issue - though I'd check in case you had already come up with an elegant fix.

Regards,
Jim.

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


On Tue, 12 Jan 2010 13:25:32 -0200, Jim O'Callaghan  
<jc...@yahoo.co.uk> wrote:

> Thiago,

Hi!

> I was also looking for something to give me a mandatory symbol to  
> decorate my form fields and stumbled across your post.

I'm not following you. Mandatory symbol?

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

That was a quick example I tried to do as a proof of concept. I use  
5.1.0.5. I'm not using it on production. I'm aware of this problem.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: Customize Label presentation at BeanEditForm based on it's validations

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 12 Jan 2010 13:25:32 -0200, Jim O'Callaghan  
<jc...@yahoo.co.uk> wrote:

> Thiago,

Hi!

> I was also looking for something to give me a mandatory symbol to  
> decorate my form fields and stumbled across your post.

I'm not following you. Mandatory symbol?

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

That was a quick example I tried to do as a proof of concept. I use  
5.1.0.5. I'm not using it on production. I'm aware of this problem.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: Customize Label presentation at BeanEditForm based on it's validations

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
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:thiagohp@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 <hl...@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: Customize Label presentation at BeanEditForm based on it's validations

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 11 Jan 2010 21:48:05 -0200, Howard Lewis Ship <hl...@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org