Re: Use Translator
hi, i want to say THANKS for help. Unfortunately it was not possible to get this thing to run, so i made an work around. It now works, the problem was - no communication between developers bye Live long and prosper! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Use-Translator-tp5165694p5429751.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Use Translator
hello, i try to use Translator to translate some values: Following was made: 1. class EmailOfContactTranslator was created and added to configuration in AppModule When i debug my app i see that toClient method is called and works fine. But parseClient(Field field, String value, String message) seems not to be called. By the way, is it possible to get informal parameters from Field in the method parseClient? greeting resign -- View this message in context: http://tapestry.1045711.n5.nabble.com/Use-Translator-tp5165694p5165694.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Use Translator
On Mon, 23 Jan 2012 08:32:05 -0200, resign sergejb...@yahoo.de wrote: hello, Hi! i try to use Translator to translate some values: Following was made: 1. class EmailOfContactTranslator was created and added to configuration in AppModule When i debug my app i see that toClient method is called and works fine. But parseClient(Field field, String value, String message) seems not to be called. Please post your template and Java code. By the way, is it possible to get informal parameters from Field in the method parseClient? No. -- 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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Use Translator
Wow very quick answer :-) Snip of my AppModule public static void contributeTranslatorSource(MappedConfigurationClass, Object configuration){ configuration.add(Email.class, new EmailOfContactTranslator()); } Snip of Translator -- public class EmailOfContactTranslator implements Translator{ @Override public Email parseClient(Field field, String value, String message) throws ValidationException{ return new Email(value); } ... --- And TML-File --- t:ajaxFormLoop id=emails source=contactCommunication5 value=currentMail t:submitNotifier t:textField value=currentMail validate=email style=width: 294px; clientId=${contact.smdId} translator=emailOfContactTranslator / t:removeRowLinkremove/t:removeRowLink /t:submitNotifier t:parameter name=addRow t:addRowLinkadd/t:addRowLink /t:parameter /t:ajaxFormLoop -- View this message in context: http://tapestry.1045711.n5.nabble.com/Use-Translator-tp5165694p5165791.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Use Translator
On Mon, 23 Jan 2012 09:08:59 -0200, resign sergejb...@yahoo.de wrote: Wow very quick answer :-) This mailing list is known for quick answers. :) Snip of my AppModule public static void contributeTranslatorSource(MappedConfigurationClass, Object configuration){ configuration.add(Email.class, new EmailOfContactTranslator()); } Looks ok. Snip of Translator -- public class EmailOfContactTranslator implements Translator{ @Override public Email parseClient(Field field, String value, String message) throws ValidationException{ return new Email(value); } Looks ok. And TML-File --- t:ajaxFormLoop id=emails source=contactCommunication5 value=currentMail t:submitNotifier t:textField value=currentMail validate=email style=width: 294px; clientId=${contact.smdId} translator=emailOfContactTranslator The parameter is translate, not translator. Make sure the currentMail property is of type Email. In addition, TextField figures out the correct translator for the field based on the edited property class, so you shouldn't even need to set the translate parameter. -- 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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Use Translator
thanks, i get an Exception org.apache.tapestry5.ioc.util.UnknownValueException: Could not find a coercion from type java.lang.String to type ...Email Do i need an own TypeCoercer ? greetings, resign -- View this message in context: http://tapestry.1045711.n5.nabble.com/Use-Translator-tp5165694p5166021.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Use Translator
On Mon, 23 Jan 2012 11:06:48 -0200, resign sergejb...@yahoo.de wrote: thanks, i get an Exception org.apache.tapestry5.ioc.util.UnknownValueException: Could not find a coercion from type java.lang.String to type ...Email Do i need an own TypeCoercer ? You'll need the translate parameter. -- 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-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org