After Clicking on table columns table( contrib:TableView) doesn't display doesn't display rows
Hi, I am newly learning tapestry. The Rendered rows vanish if I click on the columns (for sorting of rows).here is the .page file -- - P R O P E R T I E S --> -- I understand that the rows are fetched from getUsers method for the first time & further clicking on the columns it will sort the rows based on earlier fetched rows. What's causing these rows to get lost once feteched into table? I use tapesty 4.1. In the above page common/Table is custom table component of type contrib:TableView. Thanks for your help, Seshu
Accessing T4 State Objects in Spring Bean
Hi, Is it possible to access/inject tapestry4 state objects in spring bean. Actually i have a class extending AbstractRoutingDataSource to return datasource to use dynamcially. The datasource name depends upon user information stored in session. So how can i access tapestry state object or httpsession in my custom class. I beleive reverse of it is possible i.e. injecting spring bean in custom state objects howeever not sure if we can inject state objects in spring bean. Thanks -- View this message in context: http://www.nabble.com/Accessing-T4-State-Objects-in-Spring-Bean-tp25675401p25675401.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: Bean editor model for User already contains a property model for property 'account'
I didn't read the entire thread, but if this particular field has no setter you can add a synthetic property with model.add("account", null) and then provide a proper block override as outlined in the guide under "Property Editor Overrides": http://tapestry.apache.org/tapestry5.1/guide/beaneditform.html On Wed, 30 Sep 2009 03:27:09 +0200, neo anderson wrote: The reason to remove the setter method (setAccount(String)) is because the filed `account' is originally purposed to be created once only when e.g. user registers. Therefore, the account field would not be changed/ edited after User object created. But it looks like BeanModel can not add e.g. account value using non default constructor, setter method (setAccount(String)) seemingly is unavoidable. Thanks for your help. I really appreciate it. Thiago H. de Paula Figueiredo wrote: Em Tue, 29 Sep 2009 18:35:39 -0300, neo anderson escreveu: If I tried to delete the account property first (e.g. exclude("account"). Is this correct?), then adding using model.add("account"). The error becomes You should use model.add("account", somePropertyConduitInstance) in this case. Now it looks like the problem is because account is a read only field (because I remove setAccount(String) method). Is there any chance to let it automatically call e.g. constructor such as new User(account, name, ...) No. It's the same as saying that everytime you need to set a property in an object, you need to create another object. Just add the setter for the account property. If you need to edit it after you created an object, you can't avoid having a setter. -- 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Bean editor model for User already contains a property model for property 'account'
The reason to remove the setter method (setAccount(String)) is because the filed `account' is originally purposed to be created once only when e.g. user registers. Therefore, the account field would not be changed/ edited after User object created. But it looks like BeanModel can not add e.g. account value using non default constructor, setter method (setAccount(String)) seemingly is unavoidable. Thanks for your help. I really appreciate it. Thiago H. de Paula Figueiredo wrote: > > Em Tue, 29 Sep 2009 18:35:39 -0300, neo anderson > escreveu: > >> If I tried to delete the account property first (e.g. >> exclude("account"). Is >> this correct?), then adding using model.add("account"). The error becomes > > You should use model.add("account", somePropertyConduitInstance) in this > case. > >> Now it looks like the problem is because account is a read only field >> (because I remove setAccount(String) method). Is there any chance to let >> it automatically call e.g. constructor such as new User(account, name, >> ...) > > No. It's the same as saying that everytime you need to set a property in > an object, you need to create another object. > > Just add the setter for the account property. If you need to edit it after > you created an object, you can't avoid having a setter. > > -- > 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 > > > -- View this message in context: http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25673590.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: T5 & Hibernate
amazing, i did not know that we can configure manually until reading that link: apestry.hibernate.default-configuration is there a short sample that how this can be be used? Thanks, angelo Thiago H. de Paula Figueiredo wrote: > > Em Tue, 29 Sep 2009 17:00:34 -0300, Benny Law > escreveu: > >> Hi Thiago, > > Hi! > >> Thanks for responding, but I was hoping for something a little more >> detailed. I had visited this link before, but needed more details on >> things such as configuration and code examples. > > Configuration: > http://tapestry.apache.org/tapestry5.1/tapestry-hibernate-core/conf.html > >> I have an existing database, and >> would like to map my models to the existing tables using annotations. > > Use Hibernate Tools (Eclipse plugin) to generate the entity classes > through database reverse engineering. > I >> would like to know what I need in terms of configuration and what to >> inject into my DAO's to get a Hibernate session. > > Declare your DAOs as Tapestry-IoC services and have the Session injected > in them. > > -- > 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 > > > -- View this message in context: http://www.nabble.com/T5---Hibernate-tp25669279p25672391.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: T5 & Hibernate
Thanks Thiago. Somehow, I missed those additional links in the left nav. Now I have a bit more info to go on. Benny On Tue, Sep 29, 2009 at 4:52 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > Em Tue, 29 Sep 2009 17:00:34 -0300, Benny Law > escreveu: > > Hi Thiago, >> > > Hi! > > Thanks for responding, but I was hoping for something a little more >> detailed. I had visited this link before, but needed more details on >> things such as configuration and code examples. >> > > Configuration: > http://tapestry.apache.org/tapestry5.1/tapestry-hibernate-core/conf.html > > I have an existing database, and >> would like to map my models to the existing tables using annotations. >> > > Use Hibernate Tools (Eclipse plugin) to generate the entity classes through > database reverse engineering. > I > >> would like to know what I need in terms of configuration and what to >> inject into my DAO's to get a Hibernate session. >> > > Declare your DAOs as Tapestry-IoC services and have the Session injected in > them. > > > -- > 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: Bean editor model for User already contains a property model for property 'account'
Em Tue, 29 Sep 2009 18:35:39 -0300, neo anderson escreveu: If I tried to delete the account property first (e.g. exclude("account"). Is this correct?), then adding using model.add("account"). The error becomes You should use model.add("account", somePropertyConduitInstance) in this case. Now it looks like the problem is because account is a read only field (because I remove setAccount(String) method). Is there any chance to let it automatically call e.g. constructor such as new User(account, name, ...) No. It's the same as saying that everytime you need to set a property in an object, you need to create another object. Just add the setter for the account property. If you need to edit it after you created an object, you can't avoid having a setter. -- 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: Bean editor model for User already contains a property model for property 'account'
The reason why setAccount is removed is because account field is purposed to be created only when user registers. It is not purposed to be altered once the account is created. So the to remove setAccount(String) is to prevent other class falsely calling setAccount(String) accidentally. In fact, if I enable setAccount(String), the beaneditform would work without previous problem; however, I would like to know if beaneditform can work as my original purpose. If it is impossible, I can enable setAccount(String), but it's a bit pity that it can not work as expected. Thanks for your help. Kalle Korhonen-2 wrote: > > Why do you want to include the field then? For display purposes? Why > don't you just simply: >public void setAccount(String account){ >// do nothing >} > > then override the property in the template just to output the value > rather than render a field? > > Kalle > > On Tue, Sep 29, 2009 at 11:17 AM, neo anderson > wrote: >> >> Yes, the User bean contains property named account. But inside the bean >> it >> does not provide setter method because it is purposed to setup when the >> bean >> is created e.g. new User(id, account). >> >> The User bean looks as below: >> >> @Entity >> @Table(name="USERS") >> public class User implements Serializable{ >> >> �...@id >> private String id; >> >> �...@column(name="ACCOUNT") >> private String account; >> >> ... >> >> public User(String id, String account, String name, String >> password){ >> this.id = id; >> this.account = account; >> this.name = name; >> this.password = password; >> } >> >> >> public String getAccount(){ >> return this.account; >> } >> >> /* >> public void setAccount(String account){ >> this.account = account; >> } >> */ >> ... >> } >> >> >> cordenier christophe wrote: >>> >>> But i see in your code >>> >>> >> t:validate="required,regexp"/> >>> >>> Does the User bean has an account property ? >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25668232.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 >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25671514.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: Bean editor model for User already contains a property model for property 'account'
If I tried to delete the account property first (e.g. exclude("account"). Is this correct?), then adding using model.add("account"). The error becomes Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Expression 'user.account' for class org.jecommerce.pages.Register is read-only. [at context:Register.tml, line 10] at org.apache.tapestry5.internal.bindings.PropBinding.set(PropBinding.java:75) at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.write(InternalComponentResourcesImpl.java:540) ... 73 more Caused by: java.lang.RuntimeException: Expression 'user.account' for class org.jecommerce.pages.Register is read-only. at $PropertyConduit_12407a6a317.set($PropertyConduit_12407a6a317.java) at org.apache.tapestry5.internal.bindings.PropBinding.set(PropBinding.java:71) ... 74 more Now it looks like the problem is because account is a read only field (because I remove setAccount(String) method). Is there any chance to let it automatically call e.g. constructor such as new User(account, name, ...) (Though I think it is unlikely) ? The bean model source used to create BeanModel is as below: public BeanModel createBeanModel(Class clazz, String lang, String country){ if(null == this.beanModelSource) throw new NullPointerException("No BeanModelSource configured!"); if(null == cache.get(BeanModel.class)){ ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource("messages_en_US.properties"); String path = url.getPath(); BeanModel model = null; try{ ResourceBundle bundle = new PropertyResourceBundle(new FileInputStream(path)); model = beanModelSource.create( clazz, true, new MessagesImpl(new Locale(lang, country), bundle) ); // }catch(IOException ioe){ ioe.printStackTrace(); } cache.put(BeanModel.class, model); } return (BeanModel)cache.get(BeanModel.class); } Thanks for the help. Thiago H. de Paula Figueiredo wrote: > > Em Tue, 29 Sep 2009 15:17:39 -0300, neo anderson > escreveu: > >> Yes, the User bean contains property named account. But inside the bean >> it does not provide setter method because it is purposed to setup when >> the bean is created e.g. new User(id, account). > > Have you tried to delete the property from the model before adding it? > By the way, what BeanModelSource method are you using? > > -- > 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 > > > -- View this message in context: http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25671379.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: Page alias & Guice integration
Switching is hopefully not the issue, but if my organization uses Guice by fiat, but wants to use a Tapestry application, a tapestry- guice integration would be nice, since it would be major surgery (with a low patient survival rate) to rip out t5-ioc and replace it with Guice. :) Christian. On 2009-09-29, at 17:20 , Thiago H. de Paula Figueiredo wrote: Em Tue, 29 Sep 2009 17:47:13 -0300, Timo Westkämper > escreveu: Hi. Hi! I am fairly new to Tapestry 5 and I have a few questions. * Is there a way to declare a pagename alias for the URL generation e.g. "article" for ArticlePage class or do I need to to do URL rewriting like described here : http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html You can also decorate or advise the ComponentSource and ComponentEventLinkEncoder services to do that. * What is the preferred way to do Tapestry / Guice integration. While the Tapestry IoC seems quite powerful, I got used to Guice and would like to continue using it in my Tapestry projects. Tapestry-IoC was partly inspired by Guice, so switching from the latter to the former shouldn't be hard. :) Regarding an integration between Tapestry and Guice, you could take a look at how the Tapestry-Spring one to get some inspiration. -- 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 Christian Edward Gruber e-mail: christianedwardgru...@gmail.com weblog: http://www.geekinasuit.com/ - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Event bubbling - how to implement a top level catch-all target
On 29 sep 2009, at 16.12, Thiago H. de Paula Figueiredo wrote: One simple question related to this: if I have a service that is used by many components and that holds a list of component related information, how do I make this request related? Your service must have the perthread scope. A new instance will be created for each request, as each one is served by one thread. More details at http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html , section Defining Service Scope. Great! I missed that part of the docs. Unfortunately, I get a problem with the component render cycle. Right now, in my test case, a component registers with the service within the afterRender() phase and this will trigger the creation of my per-thread service. So far, so good. Now, when I click on one of my test ajax action links, my custom component event handler filter routes the event to my service but since this is a new request, it already has been freed and will be created again. How can I make sure that information from component construction time will survive so it can be used when the ajax event is processed? /Andreas - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Page alias & Guice integration
Em Tue, 29 Sep 2009 17:47:13 -0300, Timo Westkämper escreveu: Hi. Hi! I am fairly new to Tapestry 5 and I have a few questions. * Is there a way to declare a pagename alias for the URL generation e.g. "article" for ArticlePage class or do I need to to do URL rewriting like described here : http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html You can also decorate or advise the ComponentSource and ComponentEventLinkEncoder services to do that. * What is the preferred way to do Tapestry / Guice integration. While the Tapestry IoC seems quite powerful, I got used to Guice and would like to continue using it in my Tapestry projects. Tapestry-IoC was partly inspired by Guice, so switching from the latter to the former shouldn't be hard. :) Regarding an integration between Tapestry and Guice, you could take a look at how the Tapestry-Spring one to get some inspiration. -- 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: Page alias & Guice integration
On Tue, Sep 29, 2009 at 10:47 PM, Timo Westkämper wrote: > > * What is the preferred way to do Tapestry / Guice integration. While the > Tapestry IoC seems quite powerful, I got used to Guice and would like to > continue using it in my Tapestry projects. > > I managed to wire up something like this which pulls ImplementedBy-annotated > services from a Guice module. Have you been successful with something more > general? Having an ObjectProvider is useful but not a complete integration, for that purpose i think you should get your finger more dirty. I've done the same for HiveMind and it works smoothly for the basics of inter operations between services. -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 & Hibernate
Em Tue, 29 Sep 2009 17:00:34 -0300, Benny Law escreveu: Hi Thiago, Hi! Thanks for responding, but I was hoping for something a little more detailed. I had visited this link before, but needed more details on things such as configuration and code examples. Configuration: http://tapestry.apache.org/tapestry5.1/tapestry-hibernate-core/conf.html I have an existing database, and would like to map my models to the existing tables using annotations. Use Hibernate Tools (Eclipse plugin) to generate the entity classes through database reverse engineering. I would like to know what I need in terms of configuration and what to inject into my DAO's to get a Hibernate session. Declare your DAOs as Tapestry-IoC services and have the Session injected in them. -- 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
Page alias & Guice integration
Hi. I am fairly new to Tapestry 5 and I have a few questions. * Is there a way to declare a pagename alias for the URL generation e.g. "article" for ArticlePage class or do I need to to do URL rewriting like described here : http://tapestry.apache.org/tapestry5.1/guide/url-rewriting.html I'd like to keep Page-suffixes for my Page class names, but I don't want to see them in the URLs. Without the Page-suffix there would be simplename clashes with domain types. * What is the preferred way to do Tapestry / Guice integration. While the Tapestry IoC seems quite powerful, I got used to Guice and would like to continue using it in my Tapestry projects. I managed to wire up something like this which pulls ImplementedBy-annotated services from a Guice module. Have you been successful with something more general? private static Injector injector = Guice.createInjector(new BlogModule()); public static void contributeMasterObjectProvider(OrderedConfiguration configuration) { configuration.add("Guice", new ObjectProvider() { @SuppressWarnings("unchecked") @Override public T provide(Class objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { ImplementedBy implementedBy = objectType.getAnnotation(ImplementedBy.class); if (implementedBy != null){ return (T) injector.getInstance(implementedBy.value()); } else { return null; } } }); } Best regards, Timo. -- Timo Westkämper Mysema Ltd, Vilhonkatu 5 A, 00100 Helsinki, Finland Mob. +358 (0)40 591 2172 Internet: http://www.mysema.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 & Hibernate
Em Tue, 29 Sep 2009 16:23:02 -0300, Benny Law escreveu: Hello, Hi! Can someone point me to the most up-to-date and detailed documentation on using Hibernate with T5 (but not Spring)? http://tapestry.apache.org/tapestry5.1/tapestry-hibernate/ -- 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
Hi Thiago, Thanks for responding, but I was hoping for something a little more detailed. I had visited this link before, but needed more details on things such as configuration and code examples. I have an existing database, and would like to map my models to the existing tables using annotations. I would like to know what I need in terms of configuration and what to inject into my DAO's to get a Hibernate session. If you could give me a few more pointers, I would really appreciate it. Benny On Tue, Sep 29, 2009 at 3:32 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > Em Tue, 29 Sep 2009 16:23:02 -0300, Benny Law > escreveu: > > Hello, >> > > Hi! > > Can someone point me to the most up-to-date and detailed documentation on >> using Hibernate with T5 (but not Spring)? >> > > http://tapestry.apache.org/tapestry5.1/tapestry-hibernate/ > > -- > 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 > >
T5 & Hibernate
Hello, Can someone point me to the most up-to-date and detailed documentation on using Hibernate with T5 (but not Spring)? Thank you, Benny
Re: Bean editor model for User already contains a property model for property 'account'
Why do you want to include the field then? For display purposes? Why don't you just simply: public void setAccount(String account){ // do nothing } then override the property in the template just to output the value rather than render a field? Kalle On Tue, Sep 29, 2009 at 11:17 AM, neo anderson wrote: > > Yes, the User bean contains property named account. But inside the bean it > does not provide setter method because it is purposed to setup when the bean > is created e.g. new User(id, account). > > The User bean looks as below: > > @Entity > @Table(name="USERS") > public class User implements Serializable{ > > �...@id > private String id; > > �...@column(name="ACCOUNT") > private String account; > > ... > > public User(String id, String account, String name, String password){ > this.id = id; > this.account = account; > this.name = name; > this.password = password; > } > > > public String getAccount(){ > return this.account; > } > > /* > public void setAccount(String account){ > this.account = account; > } > */ > ... > } > > > cordenier christophe wrote: >> >> But i see in your code >> >> > t:validate="required,regexp"/> >> >> Does the User bean has an account property ? >> >> > > -- > View this message in context: > http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25668232.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 > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Bean editor model for User already contains a property model for property 'account'
Em Tue, 29 Sep 2009 15:17:39 -0300, neo anderson escreveu: Yes, the User bean contains property named account. But inside the bean it does not provide setter method because it is purposed to setup when the bean is created e.g. new User(id, account). Have you tried to delete the property from the model before adding it? By the way, what BeanModelSource method are you using? -- 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: Bean editor model for User already contains a property model for property 'account'
Yes, the User bean contains property named account. But inside the bean it does not provide setter method because it is purposed to setup when the bean is created e.g. new User(id, account). The User bean looks as below: @Entity @Table(name="USERS") public class User implements Serializable{ @Id private String id; @Column(name="ACCOUNT") private String account; ... public User(String id, String account, String name, String password){ this.id = id; this.account = account; this.name = name; this.password = password; } public String getAccount(){ return this.account; } /* public void setAccount(String account){ this.account = account; } */ ... } cordenier christophe wrote: > > But i see in your code > > t:validate="required,regexp"/> > > Does the User bean has an account property ? > > -- View this message in context: http://www.nabble.com/Bean-editor-model-for-User-already-contains-a-property-model-for-property-%27account%27-tp25531292p25668232.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: T5: Newbie
Thanks Thiago - thanks for the pointers and the clues. I now seem to be on the right track... Regards Alan Chaney Thiago H. de Paula Figueiredo wrote: Em Tue, 29 Sep 2009 13:46:29 -0300, Alan Chaney escreveu: I'm a complete newbie to T5. I need to develop my own component to go into a page. Could someone please direct me to an example on the web. The component is very simple - it will just inject HTML from an external source. Writing components in T5 is very simple. A good source of examples is http://jumpstart.doublenegative.com.au:8080/jumpstart/. In your case, you need to pull HTML from an external source. For this, I recommend Apache HttpClient. Once you have the needed HTML in a String, you'll need to write it to the output. This is done using a MarkupWriter. This is a component I use in my projects. Look at it to see how you can use a MarkupWriter. You'll need to use MarkupWriter.writeRaw() instead of write(), as the latter encodes the strings (< into <, etc). public class Message { /** * Message to be shown. */ @Parameter(required = true) private String message; @BeforeRenderTemplate public boolean render(MarkupWriter writer) { if (message != null && message.trim().length() > 0) { writer.element("div", "class", "t-crud-message"); writer.element("p"); writer.write(message); writer.end(); // p writer.end(); // div } return false; } } - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Newbie
Em Tue, 29 Sep 2009 13:46:29 -0300, Alan Chaney escreveu: I'm a complete newbie to T5. I need to develop my own component to go into a page. Could someone please direct me to an example on the web. The component is very simple - it will just inject HTML from an external source. Writing components in T5 is very simple. A good source of examples is http://jumpstart.doublenegative.com.au:8080/jumpstart/. In your case, you need to pull HTML from an external source. For this, I recommend Apache HttpClient. Once you have the needed HTML in a String, you'll need to write it to the output. This is done using a MarkupWriter. This is a component I use in my projects. Look at it to see how you can use a MarkupWriter. You'll need to use MarkupWriter.writeRaw() instead of write(), as the latter encodes the strings (< into <, etc). public class Message { /** * Message to be shown. */ @Parameter(required = true) private String message; @BeforeRenderTemplate public boolean render(MarkupWriter writer) { if (message != null && message.trim().length() > 0) { writer.element("div", "class", "t-crud-message"); writer.element("p"); writer.write(message); writer.end(); // p writer.end(); // div } return false; } } -- 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
T5: Newbie
I'm a complete newbie to T5. I need to develop my own component to go into a page. Could someone please direct me to an example on the web. The component is very simple - it will just inject HTML from an external source. Thanks Alan Chaney - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Event bubbling - how to implement a top level catch-all target
Thanks for the reply Thiago. One simple question related to this: if I have a service that is used by many components and that holds a list of component related information, how do I make this request related? That is, if I want i.e. have a list of all those components nested ids for a given request (they send that when they register themselves at beginRender) then how do I clear that list at the beginning or end of the request inside the service? How do I make sure that I keep that information request relative since the service is a singleton. Thanks, Andreas Pardeike On 29 sep 2009, at 16.00, Thiago H. de Paula Figueiredo wrote: Em Tue, 29 Sep 2009 03:21:40 -0300, Andreas Pardeike > escreveu: Thiago, Hi! I have a test version up in a project and I wonder why Tapestry does not support this kind of loose event handling where components register themselves for zone refreshes or method calls that are related to events. I guess that's because loose event handling is against Tapestry's philosophy to not be loose and provide a very robust error checking. I think you can implement what you want overriding some service. I find that essential to implement i.e. a global refresh zone strategy where a login component triggers a 'logged in' event and where other components subscribe to such an event because they have a zone that needs to refresh to display a different price. It would also provide a much looser connection between two less related components. AFAIK, Tapestry, as it is now, doesn't support more than one handler for the same event isntance. Have you taken a look at MultiZoneUpdate? I guess it solves what you want at least partly. -- 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Event bubbling - how to implement a top level catch-all target
Em Tue, 29 Sep 2009 11:08:01 -0300, Andreas Pardeike escreveu: Thanks for the reply Thiago. You're welcome! :) One simple question related to this: if I have a service that is used by many components and that holds a list of component related information, how do I make this request related? Your service must have the perthread scope. A new instance will be created for each request, as each one is served by one thread. More details at http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html, section Defining Service Scope. -- 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: Event bubbling - how to implement a top level catch-all target
Em Tue, 29 Sep 2009 03:21:40 -0300, Andreas Pardeike escreveu: Thiago, Hi! I have a test version up in a project and I wonder why Tapestry does not support this kind of loose event handling where components register themselves for zone refreshes or method calls that are related to events. I guess that's because loose event handling is against Tapestry's philosophy to not be loose and provide a very robust error checking. I think you can implement what you want overriding some service. I find that essential to implement i.e. a global refresh zone strategy where a login component triggers a 'logged in' event and where other components subscribe to such an event because they have a zone that needs to refresh to display a different price. It would also provide a much looser connection between two less related components. AFAIK, Tapestry, as it is now, doesn't support more than one handler for the same event isntance. Have you taken a look at MultiZoneUpdate? I guess it solves what you want at least partly. -- 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: Dynamic form
On 9/29/2009 5:20 AM, Alfie Kirkpatrick wrote: I made a hashmap backed beaneditform for something similar, so the property conduit just read/writes from the hashmap and the model comes from somewhere else (this was a dynamic search form in my case where the model was a JCR repo). Happy to share the code if it would be useful. Actually, yes, it would be! Save me from starting completely from scratch, at least. Thanks Alfie, and thanks for everyone else who's responded. I feel much better knowing that there is a way to move forward on this. Kevin - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: eclipse / mvn / run-jetty-run
Em Tue, 29 Sep 2009 07:22:16 -0300, Gunnar Eketrapp escreveu: Hi! Hi! I.e. how do I execute this mvn task from within eclipse and is it possible to do it automatically? Take a look at http://www.nabble.com/forum/ViewPost.jtp?post=25596456&framed=y&skin=302. I describe how I use Jetty without Maven (even though I love it) and have live class reloading working. -- 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: Bean editor model for User already contains a property model for property 'account'
But i see in your code Does the User bean has an account property ?
Re: Bean editor model for User already contains a property model for property 'account'
model.add() method is added after BeanModel (variable model) is created (inside the getRegisteredModel method). The display of the bean edit form at the beginning is ok because I can see the Register html shown navigating to the Register html page. However, the error occurs after clicking the submit button (t:submitlabel="Register" ). The result throws Caused by: java.lang.RuntimeException: Bean editor model for example.domain.User already contains a property model for property 'account'. at org.apache.tapestry5.internal.beaneditor.BeanModelImpl.validateNewPropertyName(BeanModelImpl.java:87) at org.apache.tapestry5.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:128) at org.apache.tapestry5.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:79) at org.jecommerce.pages.Register.getRegisterModel(Register.java:92) at $PropertyConduit_12405b70484.get($PropertyConduit_12405b70484.java) at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) ... 74 more Following is the code used Register.java (Page class) public class Register { @Inject private BeanModelSource beanModelSource; @Property private User user; @InjectPage private Index index; @InjectPage private Login login; public BeanModel getRegisterModel(){ BeanModel model = beanModelSource.create(User.class, ...); model.exclude("page"); model.add("account").label("Account").sortable(false); model.reorder("account", "password", "name", "sex", "address"); return model; } Object onSuccess(){ ... return login; } } Register.tml (View class) cordenier christophe wrote: > > When are you doing this add ? > > You error can be due for exemple to a multiple call to add() on a > persistent > variable. > > 2009/9/28 neo anderson > >> >> >> Thanks for your reply. But when adding the method >> >>model.add("account").label("Account").sortable(false); >> >> The error occurrs after clicking the beaneditform button, the log shows >> the >> following exception: >> >> [ERROR] TapestryModule.RequestExceptionHandler Processing of request >> failed >> with uncaught exception: Failure reading parameter 'model' of component >> Register:beaneditform: Bean editor model for example.domain.User already >> contains a property model for property 'account'. >> ... >> ... >> Caused by: java.lang.RuntimeException: Bean editor model for >> example.domain.User already contains a property model for property >> 'account'. >>at >> >> org.apache.tapestry5.internal.beaneditor.BeanModelImpl.validateNewPropertyName(BeanModelImpl.java:87) >>at >> >> org.apache.tapestry5.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:128) >>at >> >> org.apache.tapestry5.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:79) >>at >> org.jecommerce.pages.Register.getRegisterModel(Register.java:92) >>at >> $PropertyConduit_1240259d749.get($PropertyConduit_1240259d749.java) >>at >> org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) >>... 74 more >> >> >> It looks like the BeanModel already contains the proerty account. I am >> really confused because no matter I add or do not add a new property, the >> exception will always be thrown. What place may I go wrong? Or is there >> any >> example I can check if anything I miss? >> >> Thank you very much. >> >> >> >> cordenier christophe wrote: >> > >> > To add a synthetic property, you only have to call add(propertyName) on >> > the >> > BeanModel. >> > >> > By setting the datatype on the resulting PropertyModel or by using >> > t:parameter, you will be able to create the display for the >> corresponding >> > property in your beaneditform. >> > >> > 2009/9/28 neo anderson >> > >> >> >> >> It is the line where PropertyConduitSource (variable source.create() >> ... >> >> ) >> >> create synthetic property account as the following code. >> >> >> >>PropertyConduit accountProperty = >> >> source.create(User.class, >> >> "account"); >> >> >> >> Is this the right way to create PropertyConduit? I tried to change it >> >> using >> >> String.class, but the error is the same (NullPointerException). I >> think >> >> there should have something I miss, but that's the method I found on >> the >> >> mailinglist. I am confused indeed. >> >> >> >> >> >> >> http://www.nabble.com/T5%3A-Working-w
Re: eclipse / mvn / run-jetty-run
I just use the maven archetype and directly run mvn jetty:run & mvnDebug jetty:run. If mvn jetty:run, all changes in page/component classes are reloaded, but not for other classes. If mvnDebug and in eclipse to debug it, all changes in page/component classes and other classes are immediately reloaded, but for adding new method, I still need restart mvnDebug. DH http://www.gaonline.com.cn - Original Message - From: "Gunnar Eketrapp" To: "Tapestry users" Sent: Tuesday, September 29, 2009 6:22 PM Subject: eclipse / mvn / run-jetty-run > Hi! > > A newbie question! > > I managed to install all of the above and can now start/debug my webapp > code. > > But I still have to execute ... > > mvn war:war > > ... to update my webapp files each time before launching a jetty run/debug > session. > > How do you folks do this? > > I.e. how do I execute this mvn task from within eclipse and is it possible > to do it automatically? > > Thanks in advance, > Gunnar Eketrapp, > Cold North (Stockholm) >
eclipse / mvn / run-jetty-run
Hi! A newbie question! I managed to install all of the above and can now start/debug my webapp code. But I still have to execute ... mvn war:war ... to update my webapp files each time before launching a jetty run/debug session. How do you folks do this? I.e. how do I execute this mvn task from within eclipse and is it possible to do it automatically? Thanks in advance, Gunnar Eketrapp, Cold North (Stockholm)
RE: Dynamic form
I made a hashmap backed beaneditform for something similar, so the property conduit just read/writes from the hashmap and the model comes from somewhere else (this was a dynamic search form in my case where the model was a JCR repo). Happy to share the code if it would be useful. Regards, Alfie. -Original Message- From: Kevin White [mailto:kwh...@kevbo.org] Sent: 28 September 2009 20:41 To: users@tapestry.apache.org Subject: Re: Dynamic form On 9/28/2009 3:24 PM, Kalle Korhonen wrote: > I would look into using a BeanEditForm and making a BeanModel with all > synthetic properties based on your XML configuration. If you have a > definite set of parameter types and you can map each into some field > type, then you should be able to do it. See > http://tapestry.apache.org/tapestry5/guide/beaneditform.html Slick! To make sure I understand...use the BeanModel methods like add to add the parameters I need? It looks like I'd go down the chain and end up using PropertyConduits to read and set the values... Yes, I would make a set of parameter types...things like numeric IP address, stuff like that. That's cool... - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to create dynamic contributeXxx method ?
Thanks to my colleague, I have implemented a simple and clean solution in the module class of my component library which hold the whole configuration. Doing something like this : public static void contributeComponentClassResolver( Configuration configuration, MyConfigurationService conf) { // Add modules from configuration for (LibraryMapping mapping : conf.getLibraryMappings()) { configuration.add(mapping); } } MyConfigurationService is marked as @EagerLoad. Now the user of my library has only one entry point for the configuration of module related informations. -- View this message in context: http://www.nabble.com/How-to-create-dynamic-contributeXxx-method---tp25647814p25659365.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: Bean editor model for User already contains a property model for property 'account'
When are you doing this add ? You error can be due for exemple to a multiple call to add() on a persistent variable. 2009/9/28 neo anderson > > > Thanks for your reply. But when adding the method > >model.add("account").label("Account").sortable(false); > > The error occurrs after clicking the beaneditform button, the log shows the > following exception: > > [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed > with uncaught exception: Failure reading parameter 'model' of component > Register:beaneditform: Bean editor model for example.domain.User already > contains a property model for property 'account'. > ... > ... > Caused by: java.lang.RuntimeException: Bean editor model for > example.domain.User already contains a property model for property > 'account'. >at > > org.apache.tapestry5.internal.beaneditor.BeanModelImpl.validateNewPropertyName(BeanModelImpl.java:87) >at > > org.apache.tapestry5.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:128) >at > > org.apache.tapestry5.internal.beaneditor.BeanModelImpl.add(BeanModelImpl.java:79) >at org.jecommerce.pages.Register.getRegisterModel(Register.java:92) >at > $PropertyConduit_1240259d749.get($PropertyConduit_1240259d749.java) >at > org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) >... 74 more > > > It looks like the BeanModel already contains the proerty account. I am > really confused because no matter I add or do not add a new property, the > exception will always be thrown. What place may I go wrong? Or is there any > example I can check if anything I miss? > > Thank you very much. > > > > cordenier christophe wrote: > > > > To add a synthetic property, you only have to call add(propertyName) on > > the > > BeanModel. > > > > By setting the datatype on the resulting PropertyModel or by using > > t:parameter, you will be able to create the display for the corresponding > > property in your beaneditform. > > > > 2009/9/28 neo anderson > > > >> > >> It is the line where PropertyConduitSource (variable source.create() ... > >> ) > >> create synthetic property account as the following code. > >> > >>PropertyConduit accountProperty = > >> source.create(User.class, > >> "account"); > >> > >> Is this the right way to create PropertyConduit? I tried to change it > >> using > >> String.class, but the error is the same (NullPointerException). I think > >> there should have something I miss, but that's the method I found on the > >> mailinglist. I am confused indeed. > >> > >> > >> > http://www.nabble.com/T5%3A-Working-with-BeanModel-td18231888.html#a18352011 > >> > >> > >> > >> > >> ccordenier wrote: > >> > > >> > What corresponds to line 92 in your code ? > >> > > >> > -Message d'origine- > >> > De : neo anderson [mailto:javadeveloper...@yahoo.co.uk] > >> > Envoyé : lundi 28 septembre 2009 14:23 > >> > À : users@tapestry.apache.org > >> > Objet : Re: Bean editor model for User already contains a property > >> model > >> > for property 'account' > >> > > >> > > >> > > >> > Now I use the folloing method to create synthetic property > >> > > >> > PropertyConduit accountProperty = > >> > source.create(User.class, "account"); > >> > ClassPropertyAdapter cpa = > >> access.getAdapter(User.class); > >> > PropertyAdapter pa = > cpa.getPropertyAdapter("account"); > >> > String dt = analyzer.identifyDataType(pa); > >> > > >> > > >> > model.add("account",accountProperty).dataType(dt).label("Account").sortable(false); > >> > > >> > However, it throws NullPointerException without further detail. > >> > > >> > Caused by: java.lang.NullPointerException > >> > at > >> > org.jecommerce.pages.Register.getRegisterModel(Register.java:92) > >> > at > >> > $PropertyConduit_12400839bf9.get($PropertyConduit_12400839bf9.java) > >> > at > >> > > >> > org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58) > >> > ... 91 more > >> > > >> > What additional information I need to provide (or anything is missing) > >> so > >> > that it won't throw this error? > >> > > >> > Thanks for help. > >> > > >> > > >> > > >> > Thiago H. de Paula Figueiredo wrote: > >> >> > >> >> Em Wed, 23 Sep 2009 17:58:08 -0300, neo anderson > >> >> escreveu: > >> >> > >> >> > >> >>> I have an domain object named User, in which it has a field called > >> >>> `account'. However, the User object only provide method > getAccount(), > >> >>> but does not > >> >>> provide method setAccount(String account). > >> >> > >> >> BeanModelSource (used when a BeanModel is needed and you don't > provide > >> >> one) ignores read-only properties. It doesn't care about fields, just > >> >> about getters and setters. > >> >> > >> >>> In the page object e.g. Register, in which I build a BeanModel using > >> >>> BeanModelSource.create(User.class, ...) > >> >> > >> >> This metho