Re: T5: Best practice for rendering a dynamic component
Hi, I need to translate a WebObjects WOSwitchComponent to something equivalent in T5. I've looked at the BeanEditForm source, but I'm afraid I don't understand how this is working. The relevant bit seems to be: ... but maybe the key is actually somewhere in PropertyEditor? When you say "put the components on another page", do you mean that I would need to list every type of component explicitly? Also, I'm not clear on what you mean by, "choose the component from that page". Ideally, I'd like to have something really simple, like this: I appreciate that templates are supposed to be statically typed, but what can I do if I don't have the name of the component until runtime? Thanks, Marc Howard Lewis Ship wrote: > > This is very easy in Tapestry; just put the components on another page, > inject the page, and choose the component from that page. > > This same approach is what drives BeanEditForm and Grid: the ability to > choose components or blocks to render at any particular time. > > On 5/23/07, Daniel Tabuenca <[EMAIL PROTECTED]> wrote: >> >> What I'm trying to do is related to this. It would be very useful to >> be able to get components from some pool (just like pages). Then I >> could dynamiclally render any component dynamically on any page using >> the Delegator. This is useful in dynamic pages where the page >> structure itself is highly dynamic. Each delegator can then >> dynamically ask for the component it should render. I know you could >> do this by by listing all the possible @Components in each page class, >> but this gets very ugly if you have lots of possible components to >> choose from but you only use one. Is there anyway to do this or >> simulate this? >> >> On 5/23/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote: >> > Absolutely. You can put it inside a to keep it from >> rendering >> > normally. >> > >> > On 5/23/07, Joel Wiegman <[EMAIL PROTECTED]> wrote: >> > > >> > > Hrm... >> > > >> > > I have the code setup as listed below, but I'm getting: >> > > >> > > org.apache.tapestry.ioc.internal.util.TapestryException: Component >> > > org.foo.pages.Start does not contain an embedded component with id >> > > 'apple'. >> > > >> > > Does it expect me to have a tag in the page even though >> I'm >> > > delegating the rendering of it? >> > > >> > > -Original Message- >> > > From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] >> > > Sent: Wednesday, May 23, 2007 1:41 PM >> > > To: Tapestry users >> > > Subject: Re: T5: Best practice for rendering a dynamic component >> > > >> > > The Delegate component is what you need: >> > > >> > > >> > > >> > > @Component >> > > private Apple apple; >> > > >> > > @Component >> > > private Banana banana; >> > > >> > > public Object getFruit() { >> > > if ( ... ) return apple; >> > > >> > > return banana; >> > > } >> > > >> > > With Tapestry, the construction of pages is static, fixed, >> unchanging, >> > > much like the construction of your classes. However, Tapestry is >> quite >> > > dynamic when it comes to rendering, you can choose which objects >> render >> > > at what time in the rendering process, which ends up being about the >> > > same thing. >> > > >> > > >> > > On 5/23/07, Joel Wiegman <[EMAIL PROTECTED]> wrote: >> > > > >> > > > Hello all, >> > > > >> > > > I'm interested in rendering a component template that I can >> > > > selectively declare. For example, I'd like to do something like >> the >> > > following: >> > > > >> > > > >> > > > >> > > > public class MyPage { >> > > > >> > > > @Component >> > > > private Fruit myFruit; >> > > > >> > > > Object onAction(String switchValue) { >> > > > if(switchValue.equals("apple") { >> > > > myFruit = new Apple(); >> > > > } else { >> > > > myFruit = new Banana(); >> > > > } >> > > > } >> > > > } >> > > > >> > > > >> > > > >> > > > >> > > > >> > > > Make me an Apple! >> > > > >> > > > >> > > > >> > > > I'll save you from having to read the "Apple.html" and >> "Banana.html" >> > > > component templates. :-) >> > > > >> > > > Anyway, I'm pretty sure it's not this easy, and I was wondering >> what's >> > > >> > > > the "best practice" for accomplishing what I'm after. >> > > > >> > > > Thanks! >> > > > >> > > > Joel >> > > > >> > > > >> - >> > > > 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 >> > > >> > >
Ajax polling using zone
Hi! Still finding little problems upgrading from 5.0.11 to 5.0.17. Here is my latest issue: I was using prototype's Ajax.PeriodicalUpdater to do polling by refreshing a zone. My code goes like this: component tml: Poll ${gameId} component java: @Inject private Block pollResultsBlock; @OnEvent(component = "pollLink") Block poll() { return pollResultsBlock; } public int getGameId() { return this.gameId; } I inject this javascript: var url = $("pollLink").href; var updater = new Ajax.PeriodicalUpdater('pollResults', url, { asynchronous:true, frequency:2, evalJS:true, onLoaded: function(transport) { $("pollResults").style.display = "none"; var result = $("pollResults").innerHTML; eval("gameId = " + result + "['content']"); // do some stuff with gameId } }); All this used to word in 5.0.11, but in 5.0.17, although the ActionLink works if I click it manually, the PeriodicUpdate now fails. Instead of putting gameId in the block, I get the entire contents of the page. In fact, the poll() method is never even invoked unless I click the link manually. Moreover, I'd like to know if there is some right way to do polling via Ajax. Notwithstanding the fact that it no longer works, my method seems like a horrible hack... Thanks again, Marc -- View this message in context: http://www.nabble.com/Ajax-polling-using-zone-tp20873920p20873920.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]
PageRenderSupport deprecated?
Hi again, I recently upgraded an app from 5.0.11 to 5.0.17, and now it can no longer find PageRenderSupport, which I was using to inject some javascript, like this: @Inject @Path("scripts/injected.js") private Asset injectedJsAsset; @Inject private PageRenderSupport pageRenderSupport; void setupRender() { pageRenderSupport.addScriptLink(injectedJsAsset); } This no longer compiles in 5.0.17, due to the fact that PageRenderSupport seems to have disappeared. What is the proper way to do this now? Thanks in advance, Marc -- View this message in context: http://www.nabble.com/PageRenderSupport-deprecated--tp20869794p20869794.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: creating components with Tapestry 5
Thanks, Howard, that seems to have been the issue. I moved Layout.tml to /src/main/resources/org/apache/tapestry5/tutorial/components, and now everything works beautifully. Is this the right place? An annotation would be nice, but also might I suggest a less cryptic error message for components which do not have this annotation, something like "Layout.tml not found in ". Thanks again, Marc Howard Lewis Ship wrote: > > Tapestry couldn't find your component's template and was forced to > assume it didn't exist. I'm beginning to wonder if we need an > annotation for components that don't have a template, since this can > be a bastard for newbies to track down. > > > Component templates are stored on the classpath, with the associated > .class file; i..e, src/main/resources. In addition, you must match > the name of the Java class to the name of the template filed > (MyComponent.java --> MyComponent.tml). > > On Thu, Nov 27, 2008 at 9:49 AM, mad <[EMAIL PROTECTED]> wrote: >> >> Hi again, >> >> I hate to ask the same question twice. I did actually have this working >> with a previous version of T5, but in 5.0.15, the tag is failing, >> like this: >> >> Render queue error in Text[ toto ]: This markup writer does not have a >> current element. The current element is established with the first call >> to >> element() and is maintained across subsequent calls. >> >> >> Here is what I have: >> >> Layout.tml: >> >> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> >> >> ... >> >> >> >> ... >> >> >> >> >> Layout.java: >> >> package org.apache.tapestry5.tutorial.components; >> >> import net.rbcdexia_is.ds.application.Formatters; >> >> public class Layout { >> } >> >> >> Page.tml: >> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> >> toto >> >> >> >> Page.java: >> package org.apache.tapestry5.tutorial.pages; >> >> public class Page { >> >> } >> >> >> As you can see, there really isn't much to it. What am I doing wrong? I >> believe I am following the example given in >> http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html >> in >> the "Tapestry Elements" section, for the tag, pretty much to the >> letter. >> >> >> As usual, thanks for all your help, >> Marc >> >> >> >> mad wrote: >>> >>> Hi everyone, >>> >>> First off, I am new to Tapestry, although I've been doing WebObjects for >>> about 8 years, so the I'm hoping the transition won't be too painful. >>> I've chosen to work with Tapestry 5 since it seems like quite a >>> signifiicant evolution from the previous version, but I'm having some >>> difficulty finding resoureces. I've done the excellent Tapestry 5 >>> tutorial, but I need much more input! Can anybody point me to some >>> useful >>> places. I am especially interested in words of wisdom regarding use of >>> Tapestry and Cayenne together (which I am also learning). >>> >>> My current issue is trying to understand how to create a page wrapper >>> component (or any sort of component, actually) in Tapestry 5 -- >>> something >>> like the old WOComponentContent, which I know and love. >>> >>> tia, >>> Marc >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/creating-components-with-Tapestry-5-tp12850384p20723258.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] >> >> > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/creating-components-with-Tapestry-5-tp12850384p20732079.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: creating components with Tapestry 5
The Layout component contains the tag: as shown below. (Maybe my ellipsis was confusing... sorry about that.) Sven Homburg wrote: > > is there no tag in your layout ? > > 2008/11/27 mad <[EMAIL PROTECTED]> > >> >> Hi again, >> >> I hate to ask the same question twice. I did actually have this working >> with a previous version of T5, but in 5.0.15, the tag is failing, >> like this: >> >> Render queue error in Text[ toto ]: This markup writer does not have a >> current element. The current element is established with the first call >> to >> element() and is maintained across subsequent calls. >> >> >> Here is what I have: >> >> Layout.tml: >> >> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> >> ... >> >> ... >> >> >> >> Layout.java: >> >> package org.apache.tapestry5.tutorial.components; >> >> import net.rbcdexia_is.ds.application.Formatters; >> >> public class Layout { >> } >> >> >> Page.tml: >> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> >> toto >> >> >> >> Page.java: >> package org.apache.tapestry5.tutorial.pages; >> >> public class Page { >> >> } >> >> >> As you can see, there really isn't much to it. What am I doing wrong? I >> believe I am following the example given in >> http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html >> in >> the "Tapestry Elements" section, for the tag, pretty much to the >> letter. >> >> >> As usual, thanks for all your help, >> Marc >> >> >> >> mad wrote: >> > >> > Hi everyone, >> > >> > First off, I am new to Tapestry, although I've been doing WebObjects >> for >> > about 8 years, so the I'm hoping the transition won't be too painful. >> > I've chosen to work with Tapestry 5 since it seems like quite a >> > signifiicant evolution from the previous version, but I'm having some >> > difficulty finding resoureces. I've done the excellent Tapestry 5 >> > tutorial, but I need much more input! Can anybody point me to some >> useful >> > places. I am especially interested in words of wisdom regarding use of >> > Tapestry and Cayenne together (which I am also learning). >> > >> > My current issue is trying to understand how to create a page wrapper >> > component (or any sort of component, actually) in Tapestry 5 -- >> something >> > like the old WOComponentContent, which I know and love. >> > >> > tia, >> > Marc >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/creating-components-with-Tapestry-5-tp12850384p20723258.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] >> >> > > > -- > with regards > Sven Homburg > http://www.chenillekit.org > http://tapestry5-components.googlecode.com > > > - > best regards > Sven > -- View this message in context: http://www.nabble.com/creating-components-with-Tapestry-5-tp12850384p20723928.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: creating components with Tapestry 5
Hi again, I hate to ask the same question twice. I did actually have this working with a previous version of T5, but in 5.0.15, the tag is failing, like this: Render queue error in Text[ toto ]: This markup writer does not have a current element. The current element is established with the first call to element() and is maintained across subsequent calls. Here is what I have: Layout.tml: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> ... ... Layout.java: package org.apache.tapestry5.tutorial.components; import net.rbcdexia_is.ds.application.Formatters; public class Layout { } Page.tml: http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> toto Page.java: package org.apache.tapestry5.tutorial.pages; public class Page { } As you can see, there really isn't much to it. What am I doing wrong? I believe I am following the example given in http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html in the "Tapestry Elements" section, for the tag, pretty much to the letter. As usual, thanks for all your help, Marc mad wrote: > > Hi everyone, > > First off, I am new to Tapestry, although I've been doing WebObjects for > about 8 years, so the I'm hoping the transition won't be too painful. > I've chosen to work with Tapestry 5 since it seems like quite a > signifiicant evolution from the previous version, but I'm having some > difficulty finding resoureces. I've done the excellent Tapestry 5 > tutorial, but I need much more input! Can anybody point me to some useful > places. I am especially interested in words of wisdom regarding use of > Tapestry and Cayenne together (which I am also learning). > > My current issue is trying to understand how to create a page wrapper > component (or any sort of component, actually) in Tapestry 5 -- something > like the old WOComponentContent, which I know and love. > > tia, > Marc > > -- View this message in context: http://www.nabble.com/creating-components-with-Tapestry-5-tp12850384p20723258.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]
T5: Ajax periodic update
Hi list, I'd like to know if there is a simple way to perform a periodic Ajax update request. I've invented hacked a solution using the Ajax.PeriodicalUpdater from prototype.js. It involves putting an ActionLink on the page, giving it a client id, making it invisible to the user (with display: none), and then making a new Ajax.PeriodicalUpdater using the a.href from the ActionLink. The result of this call is a string containing the content generated by the Block element, which I must then parse. If I do not manipulate the response, the Zone will contain something like "{ content : "blah blah blah" }". I'm not crazy about my solution, and, moreover, it results in a mysterious 403 Forbidden reply on some platforms. Otherwise, having great fun with T5. Keep up the excellent work! Regards, Marc -- View this message in context: http://www.nabble.com/T5%3A-Ajax-periodic-update-tp17315174p17315174.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: How to Intergrate GWT into Tapestry pages Article by Geoff Longman
Hi, I'd just like to revive this thread. Has anybody had any good/bad experiences integrating Tapestry and GWT? I am especially interested in T5, as we are considering using this mix for an enterprise application. Thanks for your input, Marc Jessek wrote: > > Awesome! Thanks for the link. I was worried/wondering how hard this > was for tap users and now I remember Geoff's work. Maybe we should add > a link to the home page referencing gwt support via this article. > > On 12/13/06, Emmanuel Sowah <[EMAIL PROTECTED]> wrote: >> Hi all, >> >> Geoff Longman, our Spindle man and former Tapestry commiter has written >> an >> article on how to integrate Google Web Toolkit into a generated Tapestry >> page. >> http://www.cleancode.com/blog/2006/12/13/glongman/gwt-article/ >> >> Enjoy. >> Emmanuel >> >> > > > -- > Jesse Kuhnert > Tapestry/Dojo team member/developer > > Open source based consulting work centered around > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/How-to-Intergrate-GWT-into-Tapestry-pages-Article-by-Geoff-Longman-tf2816691.html#a13839868 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 tutorial not working out... Javassist, Maven problems
Marcus, wow, i can't believe that just worked! i've been fighting this thing for a whole day. thanks so much. cheers, Marc Marcus-11 wrote: > > Hi Marc, > > Try 5.0.5-SNAPSHOT in POM.xml instead 5.0.4-SNAPSHOT > > Marcus > > -- View this message in context: http://www.nabble.com/T5-tutorial-not-working-out...-Javassist%2C-Maven-problems-tf3953119.html#a11220332 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5 tutorial not working out... Javassist, Maven problems
Hi, I am trying to do the T5 tutorial, but I am having many problems. First of all, I couldn't get the maven install to work at all. The "mvn archetype:create -DarchetypeGroupId=org.apache.tapestry -DarchetypeArtifactId=quickstart -DarchetypeVersion=5.0.4 -DgroupId=org.example -DartifactId=hilo -DpackageName=org.example.hilo" line works (now), but on doing "mvn jetty:run", I get fatal compilation errors: [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'jetty'. [INFO] [INFO] Building hilo Tapestry 5 Application [INFO]task-segment: [jetty:run] [INFO] [INFO] Preparing jetty:run [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. Downloading: http://people.apache.org/~hlship/tapestry-snapshot-repository//org/apache/tapestry/tapestry-core/5.0.4-SNAPSHOT/tapestry-core-5.0.4-SNAPSHOT.pom Downloading: http://snapshots.repository.codehaus.org/org/apache/tapestry/tapestry-core/5.0.4-SNAPSHOT/tapestry-core-5.0.4-SNAPSHOT.pom Downloading: http://maven.openqa.org//org/apache/tapestry/tapestry-core/5.0.4-SNAPSHOT/tapestry-core-5.0.4-SNAPSHOT.pom [INFO] [compiler:compile] [INFO] Compiling 2 source files to C:\Projects\tapestry_tutorial\hilo\target\classes [INFO] [ERROR] BUILD FAILURE [INFO] [INFO] Compilation failure C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[5,33] package org.apache.commons.logging does not exist C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[6,30] package org.apache.tapestry.ioc does not exist C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[7,30] package org.apache.tapestry.ioc does not exist C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[8,42] package org.apache.tapestry.ioc.annotations does not exist C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[21,12] cannot find symbol symbol : class MappedConfiguration location: class org.example.hilo.services.AppModule C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[40,49] cannot find symbol symbol : class Log location: class org.example.hilo.services.AppModule C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[72,41] cannot find symbol symbol : class OrderedConfiguration location: class org.example.hilo.services.AppModule C:\Projects\tapestry_tutorial\hilo\src\main\java\org\example\hilo\services\AppModule.java:[73,13] cannot find symbol symbol : class InjectService location: class org.example.hilo.services.AppModule So, I retreated to more familiar territory: Ant. Sadly, I can't even make this work. I have a war file, which I built from the example source that was downloaded by Maven. When I deploy this file in my Jetty server, it seems that some javassist classes are missing. Now, having installed javassist.jar, I am getting this in Jetty's console when I try to access the hilo application: 13860 [btpool0-7] ERROR org.example.hilo.pages.Start - Render queue error in BeginRender[org.example.hilo.pages.Start:pagelink]: org.apache.tapestry.PageRenderSupport java.lang.RuntimeException: org.apache.tapestry.PageRenderSupport at javassist.runtime.Desc.getClassType(Desc.java:153) at javassist.runtime.Desc.getType(Desc.java:119) at javassist.runtime.Desc.getType(Desc.java:75) at org.apache.tapestry.corelib.components.PageLink._$environment_read_support(PageLink.java) at org.apache.tapestry.corelib.components.PageLink.beginRender(PageLink.java:63) at org.apache.tapestry.corelib.components.PageLink.beginRender(PageLink.java) at org.apache.tapestry.internal.structure.ComponentPageElementImpl$10$1.run(ComponentPageElementImpl.java:345) at org.apache.tapestry.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:932) at org.apache.tapestry.internal.structure.ComponentPageElementImpl.access$100(ComponentPageElementImpl.java:69) .. and so on Perhpas I have the wrong version of javassist.jar? Is something installed improperly somehow? I'm at a bit of a loss. Thanks for any help, Marc -- View this message in context: http://www.nabble.com/T5-tutorial-not-working-out...-Javassist%2C-Maven-problems-tf3953119.html#a11215935 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]