Pages, embedded components, dialogs, persisting entities across requests and submitting forms
Hello everyone, I want to finally adress the problem that crops up when persisting page properties (which I do not want to). For example, I have a Page P1, containing a component C1. I also define a jquery dialog J1 in my page, which is opened inside C1 via a dialogajaxlink. The dialog contains component C2. So, basically: P1-C1 P1-J1-C2 For this example, I have to entity classes: E1 and E2. E1 contains a list of E2's. P1 receives an activation context, the id of an E1. In setupRender I fetch the E1 entity and use it to render the page. C1 currently receives the E1 entity as a parameter and accesses one of the contained E2's. Now, C1 is shown, I click something and raise an event that should update the shown C1. If I @Persist the E1 entity, all is okay, because the ID and class is saved between requests and so the E1 entity can be retrieved again. 1. But I don't want to store with @Persist. What are my options? Let's do another: In another example, P1 displays E1 entities and loops the component C1 over all E2 entities contained in E1. In every C1 loop iteration (containing an E2 entity) there is a button opening the dialog J1 respectively the component C2 with the E2 id as a parameter, to edit E2's in a Form. 2. When I submit the form to update the E2, what should I do then? The id parameter is lost if @Persist is not used with E1, because then the E1 entity is lost and thus no list of E2's can be reproduced. I hope that wasn't too formal and someone can help me understand. Regards, Daniel P.
Re: Pages, embedded components, dialogs, persisting entities across requests and submitting forms
@BeginRender is only triggered during rendering. Page activation is always called and there are a couple of prepare events fired when you have a form in the mix. -- Chris On Mon, Jul 20, 2015 at 3:31 PM, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello everyone, I want to finally adress the problem that crops up when persisting page properties (which I do not want to). For example, I have a Page P1, containing a component C1. I also define a jquery dialog J1 in my page, which is opened inside C1 via a dialogajaxlink. The dialog contains component C2. So, basically: P1-C1 P1-J1-C2 For this example, I have to entity classes: E1 and E2. E1 contains a list of E2's. P1 receives an activation context, the id of an E1. In setupRender I fetch the E1 entity and use it to render the page. C1 currently receives the E1 entity as a parameter and accesses one of the contained E2's. Now, C1 is shown, I click something and raise an event that should update the shown C1. If I @Persist the E1 entity, all is okay, because the ID and class is saved between requests and so the E1 entity can be retrieved again. 1. But I don't want to store with @Persist. What are my options? Let's do another: In another example, P1 displays E1 entities and loops the component C1 over all E2 entities contained in E1. In every C1 loop iteration (containing an E2 entity) there is a button opening the dialog J1 respectively the component C2 with the E2 id as a parameter, to edit E2's in a Form. 2. When I submit the form to update the E2, what should I do then? The id parameter is lost if @Persist is not used with E1, because then the E1 entity is lost and thus no list of E2's can be reproduced. I hope that wasn't too formal and someone can help me understand. Regards, Daniel P.
Re: Pages, embedded components, dialogs, persisting entities across requests and submitting forms
Case one is a candidate for activation and case 2 could be a matter of using form context / prepare events. Beware that the activate event is triggered in many situations. -- Chris On Mon, Jul 20, 2015 at 3:39 PM, Chris Poulsen mailingl...@nesluop.dk wrote: @BeginRender is only triggered during rendering. Page activation is always called and there are a couple of prepare events fired when you have a form in the mix. -- Chris On Mon, Jul 20, 2015 at 3:31 PM, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello everyone, I want to finally adress the problem that crops up when persisting page properties (which I do not want to). For example, I have a Page P1, containing a component C1. I also define a jquery dialog J1 in my page, which is opened inside C1 via a dialogajaxlink. The dialog contains component C2. So, basically: P1-C1 P1-J1-C2 For this example, I have to entity classes: E1 and E2. E1 contains a list of E2's. P1 receives an activation context, the id of an E1. In setupRender I fetch the E1 entity and use it to render the page. C1 currently receives the E1 entity as a parameter and accesses one of the contained E2's. Now, C1 is shown, I click something and raise an event that should update the shown C1. If I @Persist the E1 entity, all is okay, because the ID and class is saved between requests and so the E1 entity can be retrieved again. 1. But I don't want to store with @Persist. What are my options? Let's do another: In another example, P1 displays E1 entities and loops the component C1 over all E2 entities contained in E1. In every C1 loop iteration (containing an E2 entity) there is a button opening the dialog J1 respectively the component C2 with the E2 id as a parameter, to edit E2's in a Form. 2. When I submit the form to update the E2, what should I do then? The id parameter is lost if @Persist is not used with E1, because then the E1 entity is lost and thus no list of E2's can be reproduced. I hope that wasn't too formal and someone can help me understand. Regards, Daniel P.
AW: Pages, embedded components, dialogs, persisting entities across requests and submitting forms
Hi, but I don't use @BeginRender, just @SetupRender. Did you mean that? You mean onActivate, don't you? Do you mean adding more (optional) parameters to the activation context? Regards, Daniel P. -Ursprüngliche Nachricht- Von: Chris Poulsen [mailto:mailingl...@nesluop.dk] Gesendet: Montag, 20. Juli 2015 15:42 An: Tapestry users Betreff: Re: Pages, embedded components, dialogs, persisting entities across requests and submitting forms Case one is a candidate for activation and case 2 could be a matter of using form context / prepare events. Beware that the activate event is triggered in many situations. -- Chris On Mon, Jul 20, 2015 at 3:39 PM, Chris Poulsen mailingl...@nesluop.dk wrote: @BeginRender is only triggered during rendering. Page activation is always called and there are a couple of prepare events fired when you have a form in the mix. -- Chris On Mon, Jul 20, 2015 at 3:31 PM, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello everyone, I want to finally adress the problem that crops up when persisting page properties (which I do not want to). For example, I have a Page P1, containing a component C1. I also define a jquery dialog J1 in my page, which is opened inside C1 via a dialogajaxlink. The dialog contains component C2. So, basically: P1-C1 P1-J1-C2 For this example, I have to entity classes: E1 and E2. E1 contains a list of E2's. P1 receives an activation context, the id of an E1. In setupRender I fetch the E1 entity and use it to render the page. C1 currently receives the E1 entity as a parameter and accesses one of the contained E2's. Now, C1 is shown, I click something and raise an event that should update the shown C1. If I @Persist the E1 entity, all is okay, because the ID and class is saved between requests and so the E1 entity can be retrieved again. 1. But I don't want to store with @Persist. What are my options? Let's do another: In another example, P1 displays E1 entities and loops the component C1 over all E2 entities contained in E1. In every C1 loop iteration (containing an E2 entity) there is a button opening the dialog J1 respectively the component C2 with the E2 id as a parameter, to edit E2's in a Form. 2. When I submit the form to update the E2, what should I do then? The id parameter is lost if @Persist is not used with E1, because then the E1 entity is lost and thus no list of E2's can be reproduced. I hope that wasn't too formal and someone can help me understand. Regards, Daniel P. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Pages, embedded components, dialogs, persisting entities across requests and submitting forms
Every page request and every component event request will include the page’s activation context, ie. an E1 id. If you include that id in the parameters of C1, J1, and C2, then they will all have access to the E1 id. I’m assuming that each E2 does not know its E1 (ie. not a many-to-one relationship). Otherwise C1 and C2 could derive E1 when needed. Also keep in mind that Form has a context parameter which can be helpful. On 20 Jul 2015, at 11:49 pm, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hi, but I don't use @BeginRender, just @SetupRender. Did you mean that? You mean onActivate, don't you? Do you mean adding more (optional) parameters to the activation context? Regards, Daniel P. -Ursprüngliche Nachricht- Von: Chris Poulsen [mailto:mailingl...@nesluop.dk] Gesendet: Montag, 20. Juli 2015 15:42 An: Tapestry users Betreff: Re: Pages, embedded components, dialogs, persisting entities across requests and submitting forms Case one is a candidate for activation and case 2 could be a matter of using form context / prepare events. Beware that the activate event is triggered in many situations. -- Chris On Mon, Jul 20, 2015 at 3:39 PM, Chris Poulsen mailingl...@nesluop.dk wrote: @BeginRender is only triggered during rendering. Page activation is always called and there are a couple of prepare events fired when you have a form in the mix. -- Chris On Mon, Jul 20, 2015 at 3:31 PM, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello everyone, I want to finally adress the problem that crops up when persisting page properties (which I do not want to). For example, I have a Page P1, containing a component C1. I also define a jquery dialog J1 in my page, which is opened inside C1 via a dialogajaxlink. The dialog contains component C2. So, basically: P1-C1 P1-J1-C2 For this example, I have to entity classes: E1 and E2. E1 contains a list of E2's. P1 receives an activation context, the id of an E1. In setupRender I fetch the E1 entity and use it to render the page. C1 currently receives the E1 entity as a parameter and accesses one of the contained E2's. Now, C1 is shown, I click something and raise an event that should update the shown C1. If I @Persist the E1 entity, all is okay, because the ID and class is saved between requests and so the E1 entity can be retrieved again. 1. But I don't want to store with @Persist. What are my options? Let's do another: In another example, P1 displays E1 entities and loops the component C1 over all E2 entities contained in E1. In every C1 loop iteration (containing an E2 entity) there is a button opening the dialog J1 respectively the component C2 with the E2 id as a parameter, to edit E2's in a Form. 2. When I submit the form to update the E2, what should I do then? The id parameter is lost if @Persist is not used with E1, because then the E1 entity is lost and thus no list of E2's can be reproduced. I hope that wasn't too formal and someone can help me understand. Regards, Daniel P. - 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
Publisher API -- simple publish/subscribe implementation for Tapestry5 pages and components
FYI: https://github.com/anjlab/anjlab-tapestry-commons/wiki/Publisher-API -- Dmitry Gusev AnjLab Team http://anjlab.com
pages and components
Folks, I am trying to nail down the concept (or at least inspired concept) of page and components and how they should be modeled with parameters and properties. Here is my semantic concept issue... if you can add to it that would be helpful. PAGES HAVE PROPERTIES, COMPONENTS HAVE PARAMETERS (yeah I know I can deviate but this is the general concept) 1. would you agree this is the general concept? 2. under what conditions would I deviate... 2.1 ok say when would i want my page to have parameters 2.2 ok say when would i want my component to have properties 3. I am seeing cases where I need both... for a component... is this bad practice? What could be bad practice. I am just searching for the religion on this and its twists. Thanks in advance Ken
Re: pages and components
Pages and components are generally the same for me. Pages are just top-level components. They both have parameters: for pages they came from GET/POST/... HTTP requests, source of component parameters are pages and other components. Properties are just their state, the state that pages/components want to open to other objects, as in general Object Oriented Programming. There are special case of properties -- which are private fields with @Property annotation, that a page or component wants to open to its TML-design. On Thu, Oct 11, 2012 at 6:35 PM, Ken in Nashua kcola...@live.com wrote: Folks, I am trying to nail down the concept (or at least inspired concept) of page and components and how they should be modeled with parameters and properties. Here is my semantic concept issue... if you can add to it that would be helpful. PAGES HAVE PROPERTIES, COMPONENTS HAVE PARAMETERS (yeah I know I can deviate but this is the general concept) 1. would you agree this is the general concept? 2. under what conditions would I deviate... 2.1 ok say when would i want my page to have parameters 2.2 ok say when would i want my component to have properties 3. I am seeing cases where I need both... for a component... is this bad practice? What could be bad practice. I am just searching for the religion on this and its twists. Thanks in advance Ken -- Dmitry Gusev AnjLab Team http://anjlab.com
RE: pages and components
Hi Ken, Maybe I can help you out: 1. I would not :) Pages and Components both have Properties. It's nothing special really. Think Bean Properties with automatic getter/setters. Components have Parameters, Pages have PageActivationContext. Both can be Properties as well (because a property is just a field with getter and setters ...). About Component Parameters: http://tapestry.apache.org/component-parameters.html About page activation: http://tapestry.apache.org/page-navigation.html http://blog.tapestry5.de/index.php/2010/08/23/context-values-vs-request-parameters/ http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/PageActivationContext.html So ... 2.1 use @PageActivationContext field annotation or implement onActivate(param1, param2 ... etc) event handler 2.2 use @Property in your components 3. Well, of course it's always best to minimize state but I wouldn't call it a bad practice. I'd suggest you browse the tapestry sources and get a feel how the internal components are written. I'd think that they represent t5 best practices. Kind Regards, Wulf -Original Message- From: Ken in Nashua [mailto:kcola...@live.com] Sent: Donnerstag, 11. Oktober 2012 16:35 To: users@tapestry.apache.org Subject: pages and components Folks, I am trying to nail down the concept (or at least inspired concept) of page and components and how they should be modeled with parameters and properties. Here is my semantic concept issue... if you can add to it that would be helpful. PAGES HAVE PROPERTIES, COMPONENTS HAVE PARAMETERS (yeah I know I can deviate but this is the general concept) 1. would you agree this is the general concept? 2. under what conditions would I deviate... 2.1 ok say when would i want my page to have parameters 2.2 ok say when would i want my component to have properties 3. I am seeing cases where I need both... for a component... is this bad practice? What could be bad practice. I am just searching for the religion on this and its twists. Thanks in advance Ken - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: pages and components
On Thu, 11 Oct 2012 11:35:12 -0300, Ken in Nashua kcola...@live.com wrote: Folks, Hi! I am trying to nail down the concept (or at least inspired concept) of page and components and how they should be modeled with parameters and properties. Here is my semantic concept issue... if you can add to it that would be helpful. PAGES HAVE PROPERTIES, COMPONENTS HAVE PARAMETERS (yeah I know I can deviate but this is the general concept) I wouldn't say that. Components can have properties just fine, but you should use parameters to pass information to them (or the Environment on some specific cases). Pages don't have parameters (unless you count the page activation context as parameters), so you can't use @Parameter on them.. 1. would you agree this is the general concept? No. 2. under what conditions would I deviate... Any class can have properties. 2.1 ok say when would i want my page to have parameters Yes if you consider parameters as the page activation context, no if you're thinking about @Parameter. 2.2 ok say when would i want my component to have properties 3. I am seeing cases where I need both... for a component... is this bad practice? No. Just use the same common sense you'd use for any other Java class. Why would it be a bad practice? :) -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: pages vs components... use model still the same or has it evolved any ?
This is less to do with Tapestry and more to do with general OO practises and your personal preference towards it. e.g. When writing a Java class, you could write everything in a single method, but to gain efficient reuse you usually refactor it out into multiple methods. Similarly, you split your pages into components to gain reuse. And for practical reuse, both methods and components need parameters. If in the past you were writing components that had so many parameters that they confused you, then I would suggest next time you try a different design approach. Steve. On 9 September 2011 09:30, Ken in Nashua kcola...@live.com wrote: I guess I am wondered in other peoples ideas over pages and components. Though my take on them... pages NEED to persist properties across request boundaries... and components persist those page properties thru their well defined parameter interface. Does this mean that components should never have properties ? Looking forward to light on this subject that might adhere to a natural model... thanks From: kcola...@live.com To: users@tapestry.apache.org Subject: pages vs components... use model still the same or has it evolved any ? Date: Thu, 8 Sep 2011 21:25:23 -0400 An exerpt from a 2004 tapestry guide... A component's parameters are bound to properties of the enclosing page. The component is allowed to read its parameter, to access the page property the parameter is bound to. A component may also update its parameter, to force a change to the bound page property. --- Does this imply that components do not have properties ? or should not ?... I know tapestry gives us enough rope to hang ourselves with Is there a politically correct semantic for pages vs components now... with tapestry5 or is the concept the same since older versions ? If anyone could elaborate on a general use model for components vs pages that would be helpful. I have found some page/component code cluttered up with so many properties and parameters not knowing which to use and when... whereby either of these have both pages and properties If anyone could elaborate on a general use model for components vs pages that would be helpful. Thanks Ken - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: pages vs components... use model still the same or has it evolved any ?
As Steve mentions its an evolution of personal best practice for your coding style. My personal taste through the years evolved through trial and error, more components is not always better but components to me work best when devoid of state, i.e.: breaking out the mechanics into the component and leaving the state in the page, this makes for wonderful reuse and very generic components reusable across applications without change. Cheers, Peter - Original Message - From: Steve Eynon steve.ey...@alienfactory.co.uk To: Tapestry users users@tapestry.apache.org Sent: Friday, 9 September, 2011 10:22:59 GMT +02:00 Athens, Bucharest, Istanbul Subject: Re: pages vs components... use model still the same or has it evolved any ? This is less to do with Tapestry and more to do with general OO practises and your personal preference towards it. e.g. When writing a Java class, you could write everything in a single method, but to gain efficient reuse you usually refactor it out into multiple methods. Similarly, you split your pages into components to gain reuse. And for practical reuse, both methods and components need parameters. If in the past you were writing components that had so many parameters that they confused you, then I would suggest next time you try a different design approach. Steve. On 9 September 2011 09:30, Ken in Nashua kcola...@live.com wrote: I guess I am wondered in other peoples ideas over pages and components. Though my take on them... pages NEED to persist properties across request boundaries... and components persist those page properties thru their well defined parameter interface. Does this mean that components should never have properties ? Looking forward to light on this subject that might adhere to a natural model... thanks From: kcola...@live.com To: users@tapestry.apache.org Subject: pages vs components... use model still the same or has it evolved any ? Date: Thu, 8 Sep 2011 21:25:23 -0400 An exerpt from a 2004 tapestry guide... A component's parameters are bound to properties of the enclosing page. The component is allowed to read its parameter, to access the page property the parameter is bound to. A component may also update its parameter, to force a change to the bound page property. --- Does this imply that components do not have properties ? or should not ?... I know tapestry gives us enough rope to hang ourselves with Is there a politically correct semantic for pages vs components now... with tapestry5 or is the concept the same since older versions ? If anyone could elaborate on a general use model for components vs pages that would be helpful. I have found some page/component code cluttered up with so many properties and parameters not knowing which to use and when... whereby either of these have both pages and properties If anyone could elaborate on a general use model for components vs pages that would be helpful. Thanks Ken - 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
pages vs components... use model still the same or has it evolved any ?
An exerpt from a 2004 tapestry guide... A component's parameters are bound to properties of the enclosing page. The component is allowed to read its parameter, to access the page property the parameter is bound to. A component may also update its parameter, to force a change to the bound page property. --- Does this imply that components do not have properties ? or should not ?... I know tapestry gives us enough rope to hang ourselves with Is there a politically correct semantic for pages vs components now... with tapestry5 or is the concept the same since older versions ? If anyone could elaborate on a general use model for components vs pages that would be helpful. I have found some page/component code cluttered up with so many properties and parameters not knowing which to use and when... whereby either of these have both pages and properties If anyone could elaborate on a general use model for components vs pages that would be helpful. Thanks Ken
RE: pages vs components... use model still the same or has it evolved any ?
I guess I am wondered in other peoples ideas over pages and components. Though my take on them... pages NEED to persist properties across request boundaries... and components persist those page properties thru their well defined parameter interface. Does this mean that components should never have properties ? Looking forward to light on this subject that might adhere to a natural model... thanks From: kcola...@live.com To: users@tapestry.apache.org Subject: pages vs components... use model still the same or has it evolved any ? Date: Thu, 8 Sep 2011 21:25:23 -0400 An exerpt from a 2004 tapestry guide... A component's parameters are bound to properties of the enclosing page. The component is allowed to read its parameter, to access the page property the parameter is bound to. A component may also update its parameter, to force a change to the bound page property. --- Does this imply that components do not have properties ? or should not ?... I know tapestry gives us enough rope to hang ourselves with Is there a politically correct semantic for pages vs components now... with tapestry5 or is the concept the same since older versions ? If anyone could elaborate on a general use model for components vs pages that would be helpful. I have found some page/component code cluttered up with so many properties and parameters not knowing which to use and when... whereby either of these have both pages and properties If anyone could elaborate on a general use model for components vs pages that would be helpful. Thanks Ken
Group pages or components into packages
Hi guys, does anyone if it's possible to put components/pages into some other package instead of the default app/components app/pages? I'd like to group closely related components into (sub) packages for a better organization. Thanks! -- View this message in context: http://old.nabble.com/Group-pages-or-components-into-packages-tp28085894p28085894.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: Group pages or components into packages
On Tue, 30 Mar 2010 14:34:08 -0300, Juan Isern juanis...@gmail.com wrote: Hi guys, Hi! does anyone if it's possible to put components/pages into some other package instead of the default app/components app/pages? The pages, componentes, mixins and base package names are fixed and can't be changed. On the other hand, you can have multiple Tapestry root packages. Just contribute to the ComponentClassResolver configuration: public static void contributeComponentClassResolver(ConfigurationLibraryMapping configuration) { configuration.add(new LibraryMapping(somePrefix, your.root.tapestry.package)); } That's exactly what you need to do when you package components, pages and mixins in a JAR. -- 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: Best practice unit testing pages and components
Hi Kai, How would I test a page or a component when a @Parameter is not accessible because of its need to be a private variable? As well as tests directly on the page/component object that you can do with Tapestry's TestBase class, you can also write tests that run a page through one or more requests and where you test the rendered output. You can test components by embedding them into a demo page and writing tests against that. See: http://tapestry.apache.org/tapestry5.1/guide/unit-testing-pages.html If you start on this route then you'll want to use the Testify library to help you: http://tapestry.formos.com/nightly/tapestry-testify/ And you'll find the XPath library useful for asserting things about parts of the output: http://tapestry.formos.com/nightly/tapestry-xpath/ Best wishes, Paul -- Paul Field Research IT Deutsche Bank --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
Best practice unit testing pages and components
How would I test a page or a component when a @Parameter is not accessible because of its need to be a private variable? I want to test my pages and components with unit tests as I do with my service classes. Regards, Kai - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Best practice unit testing pages and components
Em Mon, 22 Jun 2009 19:19:27 -0300, Kai Weber kai.we...@glorybox.de escreveu: How would I test a page or a component when a @Parameter is not accessible because of its need to be a private variable? If the component is written by you, add a getter and a setter, probably with package visibility. -- 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: Best practice unit testing pages and components
Take a look into this class: http://tapestry.apache.org/tapestry5.1/apidocs/org/apache/tapestry5/ioc/test/TestBase.html The methods create, get and set are useful in tests. On Tue, Jun 23, 2009 at 12:19 AM, Kai Weber kai.we...@glorybox.de wrote: How would I test a page or a component when a @Parameter is not accessible because of its need to be a private variable? I want to test my pages and components with unit tests as I do with my service classes. Regards, Kai - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Best regards, Igor Drobiazko
Tapestry 5 - Pages and Components package names
Is there any kind of context-param (like tapestry.app-package) where I can change Pages and Components package names? Thanks! -- View this message in context: http://www.nabble.com/Tapestry-5---%22Pages%22-and-%22Components%22-package-names-tp22663890p22663890.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: Tapestry 5 - Pages and Components package names
Em Mon, 23 Mar 2009 14:09:51 -0300, fccarmo fernanda.ca...@gmail.com escreveu: Is there any kind of context-param (like tapestry.app-package) where I can change Pages and Components package names? Hi, Fernanda! No, you can't do that without diving deep in the Tapestry internal services. By the way, why do you want to do that? -- 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: Tapestry 5 - Pages and Components package names
Hi Thiago! Thank you for helping me. So I'll keep them this way. I just would like to put all my package names in Portuguese :D Thiago H. de Paula Figueiredo wrote: Em Mon, 23 Mar 2009 14:09:51 -0300, fccarmo fernanda.ca...@gmail.com escreveu: Is there any kind of context-param (like tapestry.app-package) where I can change Pages and Components package names? Hi, Fernanda! No, you can't do that without diving deep in the Tapestry internal services. By the way, why do you want to do that? -- 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 - Fernanda Cristina do Carmo System Analyst and Java Developer MSN/GoogleTalk: fernanda.ca...@gmail.com -- View this message in context: http://www.nabble.com/Tapestry-5---%22Pages%22-and-%22Components%22-package-names-tp22663890p22666432.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: Tapestry 5 - Pages and Components package names
Em Mon, 23 Mar 2009 15:39:16 -0300, fccarmo fernanda.ca...@gmail.com escreveu: Hi Thiago! Thank you for helping me. You're always welcome. :) So I'll keep them this way. I just would like to put all my package names in Portuguese :D You can still have all the other package names in Portuguese. :) -- 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
Pages vs Components
In the last couple of days I have been working with Tapestry. I have read Tutorial #1 and all the User Guides articles found here: http://tapestry.apache.org/tapestry5/ I think I understand enough to get going at this point; however, one main point I still don't quite understand (and seems like it is probably something I should understand) is the difference between a Page and a Component. I understand what pages are and have done some simple things over the last couple of days but I don't understand when I would use a Component and what they are for. Are they somewhat like a tag in a tag library? BTW, I really like what I am seeing with Tapestry, vastly better than the XML hell that is Struts. However, since it is a vast departure from most web frameworks there is a pretty big learning curve. Seems worth it so far though. -- View this message in context: http://www.nabble.com/Pages-vs-Components-tp21508386p21508386.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: Pages vs Components
In some ways, a Page is just a Component that has no parent. I'm not 100% sure why they're separated, except that it's a historical artifact. Components (and pages being a special-case component) are a piece of java software that renders itself (usually as tags and possibly with a body, which may contain the renderings of other components.) It's quite different than tag-libs. Taglibs get turned into generated code that executes with other JSP code. Components don't generate code, they are live objects with life-cycles that respond to events, just like a swing or Mac-OS Cocoa component. JSP's code gets turned into a very very long execute() method on a servlet, so there's lots of entanglement. There was a good article on this in the t5 docs, but I can't remember which one. Christian. On 16-Jan-09, at 16:01 , mjparme wrote: In the last couple of days I have been working with Tapestry. I have read Tutorial #1 and all the User Guides articles found here: http://tapestry.apache.org/tapestry5/ I think I understand enough to get going at this point; however, one main point I still don't quite understand (and seems like it is probably something I should understand) is the difference between a Page and a Component. I understand what pages are and have done some simple things over the last couple of days but I don't understand when I would use a Component and what they are for. Are they somewhat like a tag in a tag library? BTW, I really like what I am seeing with Tapestry, vastly better than the XML hell that is Struts. However, since it is a vast departure from most web frameworks there is a pretty big learning curve. Seems worth it so far though. -- View this message in context: http://www.nabble.com/Pages-vs-Components-tp21508386p21508386.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 Christian Edward Gruber christianedwardgru...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Pages vs Components
On Fri, Jan 16, 2009 at 1:42 PM, Christian Edward Gruber christianedwardgru...@gmail.com wrote: In some ways, a Page is just a Component that has no parent. A page is a top level component. Technically, the page component is actually the root component of the actual page (true pages are a concept internal to Tapestry) but it all works out the same in the end. Pages have a lifecycle (loaded, attached and detached). I'm not 100% sure why they're separated, except that it's a historical artifact. A bit more than that. Naming: page names can appear in URLs whereas component types do not, instead component ids. Pages do have some special responsibilities (activation, passivation, error handling). Components (and pages being a special-case component) are a piece of java software that renders itself (usually as tags and possibly with a body, which may contain the renderings of other components.) It's quite different than tag-libs. Taglibs get turned into generated code that executes with other JSP code. Components don't generate code, they are live objects with life-cycles that respond to events, just like a swing or Mac-OS Cocoa component. JSP's code gets turned into a very very long execute() method on a servlet, so there's lots of entanglement. There was a good article on this in the t5 docs, but I can't remember which one. Christian. On 16-Jan-09, at 16:01 , mjparme wrote: -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Pages vs Components
I don't understand when I would use a Component and what they are for. Typically a web-application is built from a number of pages. And each page is different. Many elements on the pages will be the same or similar though. For those elements it is usually wise to create a separate component and then use it on all pages that should show that element. This way you have a single block of code to test and when you need to make changes you can do it in a single place and all pages that use that component will be updated at once. in that regard it is a little bit like a taglib, but better and much, much easier to create yourself. regards, Onno
[T5] class reloading for pages, templates, components possible only?
hi, class reloading works fine for pages, template and components. But it does not work for related class dependencies. For instance when I change the implementation of a Dao I don't see any changes on webapp. Is live class reloading supposed to work with pages/templates/components only or do I need to configure something to enable this for all classes? - manuel aldana aldana((at))gmx.de software-engineering blog: http://www.aldana-online.de -- View this message in context: http://www.nabble.com/-T5--class-reloading-for-pages%2C-templates%2C-components-possible-only--tp20527176p20527176.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] class reloading for pages, templates, components possible only?
Hi, This is documented here: http://tapestry.apache.org/tapestry5/guide/reload.html /Serge aldana wrote: hi, class reloading works fine for pages, template and components. But it does not work for related class dependencies. For instance when I change the implementation of a Dao I don't see any changes on webapp. Is live class reloading supposed to work with pages/templates/components only or do I need to configure something to enable this for all classes? -- View this message in context: http://www.nabble.com/-T5--class-reloading-for-pages%2C-templates%2C-components-possible-only--tp20527176p20527312.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] class reloading for pages, templates, components possible only?
Em Sun, 16 Nov 2008 13:45:54 -0300, aldana [EMAIL PROTECTED] escreveu: Is live class reloading supposed to work with pages/templates/components only or do I need to configure something to enable this for all classes? Short answer: just for pages, templates, components and mixins, i.e. classes which instantiation is controlled by Tapestry. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5] Inner Enums of Pages and Components
If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
I'm kind of surprised about that; are you storing the enum values outside of the page instance (i.e. in the session?) Inner classes are loaded by the disposable component class loader (the class loader that handles retry logic and class transformation). When a class changes, the class loader, plus and objects instantiated from that class loader, are discarded. If you place such an object in the session, it will hang around (keeping the class loader from being garbage collected) ... AND when the stored value is assigned to a field of the newly loaded page instance, it will fail with a ClassCastException because there's a new class (with the same name) loaded by a new class loader. I'd love to patch up these leaky abstractions a bit better, but that's partt of the price of running in your choice of servlet container; short of Tapestry being an application server, and not an application framework, it doesn't have sufficient control of things to make it any more seamless. On Tue, Mar 25, 2008 at 2:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
This is most likely due to serialization of the enum in the session, I use a workarround that does not affect the code too much, and I can track references to the enum. I persist a string variable, but always use enum.name() to change the variable. I use this to keep track of major blocks that are visible in a page or comp private enum Blocks{EDIT,DETAILS, EDIT_DANGER} I persist the string @Persistprivate String _currentBlock = Blocks.EDIT.name (); I return block: public Block getCurrentBlock(){ return _resources.getBlock(_currentBlock); } whne I change current block, I use the enum public void resetView() { _currentBlock = Blocks.DETAILS.name(); _splitGoodId = null; _containerId = null; } public boolean onGoTo() { resetView(); return true; } public boolean onGoToEditor() { _currentBlock = Blocks.EDIT.name(); return true; } this might be helpfull... and it is not too far from classic usage Davor Hrg On Tue, Mar 25, 2008 at 10:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
That makes totally perfect sense, and yes, I am storing an enum value in session. So I had enum defined internally in the page, and then @Persist on its value... I understand the limitation, and I can only image what cool things could be accomplished if Tapestry was budnled with embedded Jetty public class AddBaseItemArticle { @Persist private DisplayMode _displayMode = DisplayMode.Fresh; /** * Represents modes in which page can be rendered. If page is entered * directly, or if it is reset, display mode is [EMAIL PROTECTED] DisplayMode#Fresh}. * If after fresh input block has been validated and article information * is being collected, the mode is [EMAIL PROTECTED] DisplayMode#BlockValidated}. If * another page referred block input (create new block for a known base * item), then display mode is [EMAIL PROTECTED] DisplayMode#DefineBlock}. Finally, * if another page referred article input (which requires fully defined * block input), display mode is [EMAIL PROTECTED] DisplayMode#DefineArticle}. * * @author Adam Zimowski */ public enum DisplayMode { Fresh, BlockValidated, DefineBlock, DefineArticle } void setDisplayMode(DisplayMode aDisplayMode) { _displayMode = aDisplayMode; } } On Tue, Mar 25, 2008 at 4:57 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote: I'm kind of surprised about that; are you storing the enum values outside of the page instance (i.e. in the session?) Inner classes are loaded by the disposable component class loader (the class loader that handles retry logic and class transformation). When a class changes, the class loader, plus and objects instantiated from that class loader, are discarded. If you place such an object in the session, it will hang around (keeping the class loader from being garbage collected) ... AND when the stored value is assigned to a field of the newly loaded page instance, it will fail with a ClassCastException because there's a new class (with the same name) loaded by a new class loader. I'd love to patch up these leaky abstractions a bit better, but that's partt of the price of running in your choice of servlet container; short of Tapestry being an application server, and not an application framework, it doesn't have sufficient control of things to make it any more seamless. On Tue, Mar 25, 2008 at 2:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
Yeah, I haven't thought of that. I'll give it a shot, it just may work for us :) On Tue, Mar 25, 2008 at 5:03 PM, Davor Hrg [EMAIL PROTECTED] wrote: This is most likely due to serialization of the enum in the session, I use a workarround that does not affect the code too much, and I can track references to the enum. I persist a string variable, but always use enum.name() to change the variable. I use this to keep track of major blocks that are visible in a page or comp private enum Blocks{EDIT,DETAILS, EDIT_DANGER} I persist the string @Persistprivate String _currentBlock = Blocks.EDIT.name (); I return block: public Block getCurrentBlock(){ return _resources.getBlock(_currentBlock); } whne I change current block, I use the enum public void resetView() { _currentBlock = Blocks.DETAILS.name(); _splitGoodId = null; _containerId = null; } public boolean onGoTo() { resetView(); return true; } public boolean onGoToEditor() { _currentBlock = Blocks.EDIT.name(); return true; } this might be helpfull... and it is not too far from classic usage Davor Hrg On Tue, Mar 25, 2008 at 10:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Inner Enums of Pages and Components
An idea: I belive it has many pitfalls :(, but might be useful an idea, tapestry could for example extend such enum (persist worker might trigger it) and add serialization code to it. Then when reloading it could force serializing enum values, plus if the value gets serialized outside tapestry it could be better handled (if servlet container serializes it). this might only help enums.. On Tue, Mar 25, 2008 at 10:57 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote: I'm kind of surprised about that; are you storing the enum values outside of the page instance (i.e. in the session?) Inner classes are loaded by the disposable component class loader (the class loader that handles retry logic and class transformation). When a class changes, the class loader, plus and objects instantiated from that class loader, are discarded. If you place such an object in the session, it will hang around (keeping the class loader from being garbage collected) ... AND when the stored value is assigned to a field of the newly loaded page instance, it will fail with a ClassCastException because there's a new class (with the same name) loaded by a new class loader. I'd love to patch up these leaky abstractions a bit better, but that's partt of the price of running in your choice of servlet container; short of Tapestry being an application server, and not an application framework, it doesn't have sufficient control of things to make it any more seamless. On Tue, Mar 25, 2008 at 2:49 PM, Adam Zimowski [EMAIL PROTECTED] wrote: If Page or Component defines Enum internally, Tapestry throws a ClassCastException the moment said page or component class (or even the template) is hot reloaded due to any kind of change. Can this be fixed/change to allow inner Enums? -adam as of 5.0.11 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 : declaration of pages and components packages from a library
While we're tossing out ideas, I accomplish the same thing without subclasses using layout components, which themselves (seamlessly) handle common CSS via @IncludeStyleSheet (or whatever its called). Any page (or component for that matter) that has specific styles (or scripts) can additionally add them in the same manner. It's these kinds of facilities I mean when I say that T5 provides ways of shared state/behavior, which are (imo) superior to subclassing. chris Daniel Jue wrote: I have a few components and pages that I extend, and I put them in a directory called base, at the same level as the pages and components packages. For instance I have an AbstractReportPage that references Tapestry ASOs, Injects things and Persists things. Then I have a few report page classes that implement different flavors of very similar things. It could be done differently for sure--This is just one way that works for me. I also use the base directory for concrete Tapestry related classes that don't belong in pages, components, services or mixins. One example is a class than has the injected paths to all my css files and some images that are used across several border classes. Then I can do public class Border extends AssetContainer{ } On Jan 8, 2008 5:03 PM, Shing Hing Man [EMAIL PROTECTED] wrote: Have you tried the following ? Suppose org.man.tapestry5.components will hold the new components. 1) add the following to AppModule public static void contributeComponentClassResolver(ConfigurationLibraryMapping configuration) { // Creates a virtual root pacakge for pages,components. configuration.add(new LibraryMapping(man, org.man.tapestry5)); } 2) Suppose in org.man.tapestry5.components, we have component PageLinkPopup.java. Usage : a href=# t:type=man/pagelinkPopup t:page=home windowName=literal:my windown features=literal: 'resizable,scrollbars,top=100,left=200,height=300,width=500' Home/a or t:man.pagelinkPopup page=test/sum windowName=literal:sum features=literal: 'resizable,scrollbars,top=100,left=200,height=300,width=500' Sum/t:man.pagelinkPopup Shing --- Steph [EMAIL PROTECTED] wrote: Hi all, I need to import in my tap5 project a library which includes tap5 pages and components. But when i try to extend a page from the library in my project, i get the following exception : java.lang.RuntimeException: Base class com.mylibrary.pages.FramePage (super class of com.myproject.pages.Start) is not in a controlled package and is therefore not valid. You should try moving the class to package com.myproject.base. Should i declare the 'pages' and 'components' directories of my library in the tapestry.app-package context of my web.xml ? If yes, what is the syntax to do such a declaration ? Thanks in advance. Stephane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Home page : http://www.lombok.demon.co.uk/ ___ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 : declaration of pages and components packages from a library
Have you tried the following ? Suppose org.man.tapestry5.components will hold the new components. 1) add the following to AppModule public static void contributeComponentClassResolver(ConfigurationLibraryMapping configuration) { // Creates a virtual root pacakge for pages,components. configuration.add(new LibraryMapping(man, org.man.tapestry5)); } 2) Suppose in org.man.tapestry5.components, we have component PageLinkPopup.java. Usage : a href=# t:type=man/pagelinkPopup t:page=home windowName=literal:my windown features=literal: 'resizable,scrollbars,top=100,left=200,height=300,width=500' Home/a or t:man.pagelinkPopup page=test/sum windowName=literal:sum features=literal: 'resizable,scrollbars,top=100,left=200,height=300,width=500' Sum/t:man.pagelinkPopup Shing --- Steph [EMAIL PROTECTED] wrote: Hi all, I need to import in my tap5 project a library which includes tap5 pages and components. But when i try to extend a page from the library in my project, i get the following exception : java.lang.RuntimeException: Base class com.mylibrary.pages.FramePage (super class of com.myproject.pages.Start) is not in a controlled package and is therefore not valid. You should try moving the class to package com.myproject.base. Should i declare the 'pages' and 'components' directories of my library in the tapestry.app-package context of my web.xml ? If yes, what is the syntax to do such a declaration ? Thanks in advance. Stephane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Home page : http://www.lombok.demon.co.uk/ ___ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5 : declaration of pages and components packages from a library
Hi all, I need to import in my tap5 project a library which includes tap5 pages and components. But when i try to extend a page from the library in my project, i get the following exception : java.lang.RuntimeException: Base class com.mylibrary.pages.FramePage (super class of com.myproject.pages.Start) is not in a controlled package and is therefore not valid. You should try moving the class to package com.myproject.base. Should i declare the 'pages' and 'components' directories of my library in the tapestry.app-package context of my web.xml ? If yes, what is the syntax to do such a declaration ? Thanks in advance. Stephane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 : declaration of pages and components packages from a library
Hi Steph, The problem is probably that you are trying to extend a class that exists in your pages package. As documented here (http://tapestry.apache.org/tapestry5/tapestry-core/guide/component-classes.html), you must put such base classes in a 'base' package. I'm not sure if the package must be named 'base', but I know that you cannot have base classes in 'pages', 'components', and probably not in 'mixins.' This is because T5 does some magic on these classes at runtime, and extending them would apparently cause failures. On a personal note, I if you find yourself extending pages you may want to reexamine your design. This is just my opinion, but I'm a firm believer in shallow class hierarchies, and being that T5 provides such a rich environment for composite behavior without subclassing (via services and mixins especially), I avoid page extention. sincerely, chris Steph wrote: Hi all, I need to import in my tap5 project a library which includes tap5 pages and components. But when i try to extend a page from the library in my project, i get the following exception : java.lang.RuntimeException: Base class com.mylibrary.pages.FramePage (super class of com.myproject.pages.Start) is not in a controlled package and is therefore not valid. You should try moving the class to package com.myproject.base. Should i declare the 'pages' and 'components' directories of my library in the tapestry.app-package context of my web.xml ? If yes, what is the syntax to do such a declaration ? Thanks in advance. Stephane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 : declaration of pages and components packages from a library
I have a few components and pages that I extend, and I put them in a directory called base, at the same level as the pages and components packages. For instance I have an AbstractReportPage that references Tapestry ASOs, Injects things and Persists things. Then I have a few report page classes that implement different flavors of very similar things. It could be done differently for sure--This is just one way that works for me. I also use the base directory for concrete Tapestry related classes that don't belong in pages, components, services or mixins. One example is a class than has the injected paths to all my css files and some images that are used across several border classes. Then I can do public class Border extends AssetContainer{ } On Jan 8, 2008 5:03 PM, Shing Hing Man [EMAIL PROTECTED] wrote: Have you tried the following ? Suppose org.man.tapestry5.components will hold the new components. 1) add the following to AppModule public static void contributeComponentClassResolver(ConfigurationLibraryMapping configuration) { // Creates a virtual root pacakge for pages,components. configuration.add(new LibraryMapping(man, org.man.tapestry5)); } 2) Suppose in org.man.tapestry5.components, we have component PageLinkPopup.java. Usage : a href=# t:type=man/pagelinkPopup t:page=home windowName=literal:my windown features=literal: 'resizable,scrollbars,top=100,left=200,height=300,width=500' Home/a or t:man.pagelinkPopup page=test/sum windowName=literal:sum features=literal: 'resizable,scrollbars,top=100,left=200,height=300,width=500' Sum/t:man.pagelinkPopup Shing --- Steph [EMAIL PROTECTED] wrote: Hi all, I need to import in my tap5 project a library which includes tap5 pages and components. But when i try to extend a page from the library in my project, i get the following exception : java.lang.RuntimeException: Base class com.mylibrary.pages.FramePage (super class of com.myproject.pages.Start) is not in a controlled package and is therefore not valid. You should try moving the class to package com.myproject.base. Should i declare the 'pages' and 'components' directories of my library in the tapestry.app-package context of my web.xml ? If yes, what is the syntax to do such a declaration ? Thanks in advance. Stephane - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Home page : http://www.lombok.demon.co.uk/ ___ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Passing Pages into Components
Hi Klaus Take a look at http://tapestry.apache.org/tapestry5/tapestry-core/guide/coercion.html: Type coercions occur when a value passed into a parameter (as bound in template or in an annotation) does not match the type of the parameter. The exception message indicates that the TypeCoercer Service is making use of the coercion strategies at its disposal. The doco elsewhere says you can extend the TypeCoercer service but this is outside my experience as yet so somebody else will have to help you there. If your webshops.pages.article.ArticleList does not implement the Page interface then it cannot be cast/coerced in the way you have indicated in your implementation for Component: ArticleSearch.java. For a quick fix you might try using Object rather than Page: Component: ArticleSearch.java [code] @Parameter(required=true) private Object nextPage; public Object onSuccess() { ... return nextPage; } [/code] J. Klaus wrote: Hi! I have a problem passing a page into a component. Its quite simple... The component contains a form, which is responsible for the navigation (it returns a Page by the onSuccess-Method). To allow further customization I want to pass the page to the component by a parameter (e.g. nextPage). I can run the page without problems, but if i successfully submit the form (- call the onSuccess-Method) a java.lang.IllegalArgumentException is thrown. (Could not find a coercion from type webshops.pages.article.ArticleList to type org.apache.tapestry.internal.structure.Page. Available coercions: Double -- Float, Float -- Double, ...) A few pices of code might be helpful: Component: ArticleSearch.java [code] @Parameter(required=true) private Page nextPage; public Page onSuccess() { ... return nextPage; } [/code] Implementation of the Component: ArticleSearchImpl.java [code] @InjectPage private ArticleList articleList; @Component(parameters={nextPage=articleList}) private com.poi.egh.webshops.components.article.ArticleSearch articleSearch; public ArticleMaintenanceLayout getArticleMaintenanceLayout() { return articleMaintenanceLayout; } public ArticleList getArticleList() { return articleList; } [/code] I have no idea why this doesnt work. klaus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Passing Pages into Components
So you missed the great big warning signs about not using internal classes? Page is an internal interface; you classes don't implement Page. You'd be better off making nextPage type java.lang.Object. On 7/17/07, bayk [EMAIL PROTECTED] wrote: Hi! I have a problem passing a page into a component. Its quite simple... The component contains a form, which is responsible for the navigation (it returns a Page by the onSuccess-Method). To allow further customization I want to pass the page to the component by a parameter (e.g. nextPage). I can run the page without problems, but if i successfully submit the form (- call the onSuccess-Method) a java.lang.IllegalArgumentException is thrown. (Could not find a coercion from type webshops.pages.article.ArticleList to type org.apache.tapestry.internal.structure.Page. Available coercions: Double -- Float, Float -- Double, ...) A few pices of code might be helpful: Component: ArticleSearch.java [code] @Parameter(required=true) private Page nextPage; public Page onSuccess() { ... return nextPage; } [/code] Implementation of the Component: ArticleSearchImpl.java [code] @InjectPage private ArticleList articleList; @Component(parameters={nextPage=articleList}) private com.poi.egh.webshops.components.article.ArticleSearch articleSearch; public ArticleMaintenanceLayout getArticleMaintenanceLayout() { return articleMaintenanceLayout; } public ArticleList getArticleList() { return articleList; } [/code] I have no idea why this doesnt work. klaus -- View this message in context: http://www.nabble.com/-T5--Passing-Pages-into-Components-tf4097307.html#a11650728 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Passing Pages into Components
Howard, maybe you should hide the internal interfaces by making them package-private or something. Then mark internal classes final like Spring does! Bill On 7/18/07, Howard Lewis Ship [EMAIL PROTECTED] wrote: So you missed the great big warning signs about not using internal classes? Page is an internal interface; you classes don't implement Page. You'd be better off making nextPage type java.lang.Object. On 7/17/07, bayk [EMAIL PROTECTED] wrote: Hi! I have a problem passing a page into a component. Its quite simple... The component contains a form, which is responsible for the navigation (it returns a Page by the onSuccess-Method). To allow further customization I want to pass the page to the component by a parameter (e.g. nextPage). I can run the page without problems, but if i successfully submit the form (- call the onSuccess-Method) a java.lang.IllegalArgumentException is thrown. (Could not find a coercion from type webshops.pages.article.ArticleListto type org.apache.tapestry.internal.structure.Page. Available coercions: Double -- Float, Float -- Double, ...) A few pices of code might be helpful: Component: ArticleSearch.java [code] @Parameter(required=true) private Page nextPage; public Page onSuccess() { ... return nextPage; } [/code] Implementation of the Component: ArticleSearchImpl.java [code] @InjectPage private ArticleList articleList; @Component(parameters={nextPage=articleList}) private com.poi.egh.webshops.components.article.ArticleSearcharticleSearch; public ArticleMaintenanceLayout getArticleMaintenanceLayout() { return articleMaintenanceLayout; } public ArticleList getArticleList() { return articleList; } [/code] I have no idea why this doesnt work. klaus -- View this message in context: http://www.nabble.com/-T5--Passing-Pages-into-Components-tf4097307.html#a11650728 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5] Passing Pages into Components
Hi! I have a problem passing a page into a component. Its quite simple... The component contains a form, which is responsible for the navigation (it returns a Page by the onSuccess-Method). To allow further customization I want to pass the page to the component by a parameter (e.g. nextPage). I can run the page without problems, but if i successfully submit the form (- call the onSuccess-Method) a java.lang.IllegalArgumentException is thrown. (Could not find a coercion from type webshops.pages.article.ArticleList to type org.apache.tapestry.internal.structure.Page. Available coercions: Double -- Float, Float -- Double, ...) A few pices of code might be helpful: Component: ArticleSearch.java [code] @Parameter(required=true) private Page nextPage; public Page onSuccess() { ... return nextPage; } [/code] Implementation of the Component: ArticleSearchImpl.java [code] @InjectPage private ArticleList articleList; @Component(parameters={nextPage=articleList}) private com.poi.egh.webshops.components.article.ArticleSearch articleSearch; public ArticleMaintenanceLayout getArticleMaintenanceLayout() { return articleMaintenanceLayout; } public ArticleList getArticleList() { return articleList; } [/code] I have no idea why this doesnt work. klaus -- View this message in context: http://www.nabble.com/-T5--Passing-Pages-into-Components-tf4097307.html#a11650728 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]