Re: T5 + Hibernate + Hibernate Tools
Yes, that is want I want. For now, what I've done works. Just getting the page requires the use of internal classes. I can't even think about how to get the component. Once this is included, then I can eliminate my hack. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jun 20, 2009, at 3:31 PM, Robert Zeigler wrote: Hm. What if you have a structure like: page component x bean edit form And you want the messages in component x (to make component x be reusable)? The way you've got it now, you'll always have to put the messages in the top level page. That said, I'm in the middle of: https://issues.apache.org/jira/browse/TAP5-692 Which, I think, is exactly what you're trying to accomplish... right? :) I have a bit more liberty than you in that I can tweak the framework to make this easier. :) What Im considering at the moment is having FieldValidatorDefaultSourceImpl push the overriding component resources onto the environment just before calling into the ValidationConstraintGenerator service (and popping it off immediately after), so the MessagesConstraintGenerator can access it. My only concern is whether any users have already pushed some instance of ComponentResources onto the environment and are counting on a particular instance to be available. I may wrap ComponentResources into a holder class to avoid this, but for now, I'm pushing ComponentResources directly. Anyway, hth. Robert On Jun 19, 2009, at 6/193:44 PM , Norman Franke wrote: On Jun 19, 2009, at 3:31 PM, Thiago H. de Paula Figueiredo wrote: Em Fri, 19 Jun 2009 15:26:44 -0300, Norman Franke nor...@myasd.com escreveu: No, the pages's properties. I figure I may want different settings on each page. Nice point. :) Seems like I'd need to know the page name and/or class for that. I don't. You can inject the Request and use the ComponentEventLinkEncoder service to get the logical name (xxx/yyy) that was requested and then use ComponentClassResolver.resolvePageNameToClassName() to get the class name. That seems more icky. Plus, you just get the page path. I think getting the actual Page would be better, since another implementation could use variables in the page instance. I did try it now, bug got a NPE when trying to resolvePageNameToClassName. So, I'll stick with what I have, I guess. If there isn't any better way to do it nor a JIRA about it, let's file one. Sure, feel free. Something along the lines if an injectable Page for the current page, or the current Component? You can do this yourself (all you need is to create an account at Apache's JIRA), but I already created it: https://issues.apache.org/jira/browse/TAP5-753 Thanks! I think it would be best if that was implemented. Norman Franke Answering Service for Directors, Inc. www.myasd.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 + Hibernate + Hibernate Tools
On Jun 18, 2009, at 8:11 PM, Thiago H. de Paula Figueiredo wrote: Em Thu, 18 Jun 2009 19:45:54 -0300, Norman Franke nor...@myasd.com escreveu: Thanks! You're welcome! The ValidationConstraintGenerator may work. Being new to T5 and all, I assume it's possible to @Inject the current page into my ValidationConstraintGenerator? Actually, I'd want the classpath to the .tml so I can get the .properties. By any chance are you trying to get the validation from the app.properties? I don't know how you would inject the page in a service. I'm trying to remeber some way to get access to the app.properties file, but I can't now. No, the pages's properties. I figure I may want different settings on each page. Not tested workaround suggestion: inject the ComponentSource service. Use its getPage(Class pageClass), using any page class as parameter, to retrievee a Component instance. Then invoke component.getComponentResources().getMessages() to get a Messages instance. Seems like I'd need to know the page name and/or class for that. I don't. If there isn't any better way to do it nor a JIRA about it, let's file one. Sure, feel free. Something along the lines if an injectable Page for the current page, or the current Component? Norman Franke Answering Service for Directors, Inc. www.myasd.com
Re: T5 + Hibernate + Hibernate Tools
Em Fri, 19 Jun 2009 15:26:44 -0300, Norman Franke nor...@myasd.com escreveu: No, the pages's properties. I figure I may want different settings on each page. Nice point. :) Seems like I'd need to know the page name and/or class for that. I don't. You can inject the Request and use the ComponentEventLinkEncoder service to get the logical name (xxx/yyy) that was requested and then use ComponentClassResolver.resolvePageNameToClassName() to get the class name. If there isn't any better way to do it nor a JIRA about it, let's file one. Sure, feel free. Something along the lines if an injectable Page for the current page, or the current Component? You can do this yourself (all you need is to create an account at Apache's JIRA), but I already created it: https://issues.apache.org/jira/browse/TAP5-753 -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 + Hibernate + Hibernate Tools
On Jun 19, 2009, at 3:31 PM, Thiago H. de Paula Figueiredo wrote: Em Fri, 19 Jun 2009 15:26:44 -0300, Norman Franke nor...@myasd.com escreveu: No, the pages's properties. I figure I may want different settings on each page. Nice point. :) Seems like I'd need to know the page name and/or class for that. I don't. You can inject the Request and use the ComponentEventLinkEncoder service to get the logical name (xxx/yyy) that was requested and then use ComponentClassResolver.resolvePageNameToClassName() to get the class name. That seems more icky. Plus, you just get the page path. I think getting the actual Page would be better, since another implementation could use variables in the page instance. I did try it now, bug got a NPE when trying to resolvePageNameToClassName. So, I'll stick with what I have, I guess. If there isn't any better way to do it nor a JIRA about it, let's file one. Sure, feel free. Something along the lines if an injectable Page for the current page, or the current Component? You can do this yourself (all you need is to create an account at Apache's JIRA), but I already created it: https://issues.apache.org/jira/browse/TAP5-753 Thanks! I think it would be best if that was implemented. Norman Franke Answering Service for Directors, Inc. www.myasd.com
Re: T5 + Hibernate + Hibernate Tools
Em Thu, 18 Jun 2009 18:29:37 -0300, Norman Franke nor...@myasd.com escreveu: Next, I want to use BeanEditForm to edit the tables. I can't really add @Id, @NonVisual, or @Validate to the classes, since they'll be overwritten every time I re-generate the classes when I add or modify a table. Take a look at http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html, section Customizing the BeanModel. To add validation without touching entity class sources, take a look at the ValidationConstraintsGenerator interface. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 + Hibernate + Hibernate Tools
Thanks! The ValidationConstraintGenerator may work. Being new to T5 and all, I assume it's possible to @Inject the current page into my ValidationConstraintGenerator? Actually, I'd want the classpath to the .tml so I can get the .properties. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jun 18, 2009, at 5:40 PM, Thiago H. de Paula Figueiredo wrote: Em Thu, 18 Jun 2009 18:29:37 -0300, Norman Franke nor...@myasd.com escreveu: Next, I want to use BeanEditForm to edit the tables. I can't really add @Id, @NonVisual, or @Validate to the classes, since they'll be overwritten every time I re-generate the classes when I add or modify a table. Take a look at http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html , section Customizing the BeanModel. To add validation without touching entity class sources, take a look at the ValidationConstraintsGenerator interface. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 + Hibernate + Hibernate Tools
I think I figured it out: @InjectService(PageRenderQueue) private PageRenderQueue pageRenderQueue; Then in buildConstraints: Page page = pageRenderQueue.getRenderingPage(); Messages msgs = page.getRootComponent().getComponentResources().getMessages(); String myValue = msgs.get(myValue); From there, you get the Environment and peek(PropertyEditContext.class) to get the PropertyEditContext from which you can: getPropertyId(). This appears to work. Very cool! Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jun 18, 2009, at 6:45 PM, Norman Franke wrote: Thanks! The ValidationConstraintGenerator may work. Being new to T5 and all, I assume it's possible to @Inject the current page into my ValidationConstraintGenerator? Actually, I'd want the classpath to the .tml so I can get the .properties. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jun 18, 2009, at 5:40 PM, Thiago H. de Paula Figueiredo wrote: Em Thu, 18 Jun 2009 18:29:37 -0300, Norman Franke nor...@myasd.com escreveu: Next, I want to use BeanEditForm to edit the tables. I can't really add @Id, @NonVisual, or @Validate to the classes, since they'll be overwritten every time I re-generate the classes when I add or modify a table. Take a look at http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html , section Customizing the BeanModel. To add validation without touching entity class sources, take a look at the ValidationConstraintsGenerator interface. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 + Hibernate + Hibernate Tools
Em Thu, 18 Jun 2009 19:45:54 -0300, Norman Franke nor...@myasd.com escreveu: Thanks! You're welcome! The ValidationConstraintGenerator may work. Being new to T5 and all, I assume it's possible to @Inject the current page into my ValidationConstraintGenerator? Actually, I'd want the classpath to the .tml so I can get the .properties. By any chance are you trying to get the validation from the app.properties? I don't know how you would inject the page in a service. I'm trying to remeber some way to get access to the app.properties file, but I can't now. Not tested workaround suggestion: inject the ComponentSource service. Use its getPage(Class pageClass), using any page class as parameter, to retrievee a Component instance. Then invoke component.getComponentResources().getMessages() to get a Messages instance. If there isn't any better way to do it nor a JIRA about it, let's file one. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 + Hibernate + Hibernate Tools
Em Thu, 18 Jun 2009 20:45:39 -0300, Norman Franke nor...@myasd.com escreveu: I think I figured it out: @InjectService(PageRenderQueue) private PageRenderQueue pageRenderQueue; By the way, very clever way to do it. :) Two comments: You could just @Inject private PageRenderQueue pageRenderQueue; @InjectService is meant to be used when there is more than one service instance for a given type. In addition, it is not advisable to use anything inside org.apache.tapestry5.internal, because it was created by Howard specifically to hold anything that Tapestry won't guarantee backward compatibility. Some internal classes were even removed between releases, but not a single not internal one. ;) -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org