Re: Validators / Translators question
Em Thu, 10 Dec 2009 11:50:31 -0200, Jim O'Callaghan escreveu: Thanks Thiago. I'm using the example at the link you specified, but found I needed to provide validators and translators to complete the approach, esp. the translator being missing / not bound was causing a NPE somewhere along the line. The viewing block is just for viewing (Grid and BeanDisplay, no affecting how you edit the values. If your address field is only used in one Grid, you could just override the viewing block for it using inside the Grid. I can update the block to display the fields (sub fields in ex. Address) but was wondering more about how the value is translated from what is posted back into an Address object - is that not what the Translator would do? I'm probably missing something obvious here ... I can see two approaches: 1) Create an edition block for Address that has one TextField for each of its parts. 2) Create an edition block for Address that isn't really used. It would be there just to make Tapestry not complain about the lack of an edition block. -- 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
RE: Validators / Translators question
Thanks Thiago. I'm using the example at the link you specified, but found I needed to provide validators and translators to complete the approach, esp. the translator being missing / not bound was causing a NPE somewhere along the line. I can update the block to display the fields (sub fields in ex. Address) but was wondering more about how the value is translated from what is posted back into an Address object - is that not what the Translator would do? I'm probably missing something obvious here ... Regards, Jim. -Original Message- From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] Sent: 10 December 2009 11:31 To: Tapestry users Subject: Re: Validators / Translators question Em Thu, 10 Dec 2009 09:01:05 -0200, Jim O'Callaghan escreveu: > Hi, Hi! > Client - is it an incorrect approach to used Validators / Translators in > this scenario and if so can anyone advise on how to abstract and reuse an > embedded Address rendering approach? Validators and translators are meant to be used with form fields, not rendering. They're not used by Grid nor BeanDisplay. To do what you want, you need to provide a viewing block to your Address class. The corresponding documentation is http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html, section "Adding New Property Editors". -- 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
Re: Validators / Translators question
Em Thu, 10 Dec 2009 09:01:05 -0200, Jim O'Callaghan escreveu: Hi, Hi! Client - is it an incorrect approach to used Validators / Translators in this scenario and if so can anyone advise on how to abstract and reuse an embedded Address rendering approach? Validators and translators are meant to be used with form fields, not rendering. They're not used by Grid nor BeanDisplay. To do what you want, you need to provide a viewing block to your Address class. The corresponding documentation is http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html, section "Adding New Property Editors". -- 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