Re: T5 t:renderObject and pageLink won't render link just text instead
Hi, it's me again :-) Filip S. Adamsen-2 wrote: > > It still looks to me like you only need a PageLink. It has three > parameters that you should use: page, context, and disabled. Page is the > page name, context is a list/array of context parameters, and disabled > decides whether to render a link or just the text. > This "disabled" attribute is a great tip, now I finally see that you were right from the beginning! Filip S. Adamsen-2 wrote: > > "Renders out an object using the > org.apache.tapestry5.services.ObjectRenderer service. Used primarily on > the org.apache.tapestry5.corelib.pages.ExceptionReport page. This is > focused on objects that have a specific > org.apache.tapestry5.services.ObjectRenderer strategy. The > org.apache.tapestry5.corelib.components.BeanDisplay component is used > for displaying the contents of arbitrary objects in terms of a series of > property names and values." > > So that's why it doesn't work for Links. > That's because Links don't have "specific org.apache.tapestry5.services.ObjectRenderer stategy" ? Will try to find more about that in documentation. -- View this message in context: http://www.nabble.com/T5-t%3ArenderObject-and-pageLink-won%27t-render-link-just-text-instead-tp17782707p17817465.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 t:renderObject and pageLink won't render link just text instead
Hi there, I wasn't being ironic at all. (Nor am I now.) It still looks to me like you only need a PageLink. It has three parameters that you should use: page, context, and disabled. Page is the page name, context is a list/array of context parameters, and disabled decides whether to render a link or just the text. What values to use for these three parameters can be decided in your Java class, just create getPage, getContext and isDisabled methods that you can call from your template like this t:context="context" t:disabled="disabled"/>. By the way, I just checked RenderObject in the Component Reference. It says: "Renders out an object using the org.apache.tapestry5.services.ObjectRenderer service. Used primarily on the org.apache.tapestry5.corelib.pages.ExceptionReport page. This is focused on objects that have a specific org.apache.tapestry5.services.ObjectRenderer strategy. The org.apache.tapestry5.corelib.components.BeanDisplay component is used for displaying the contents of arbitrary objects in terms of a series of property names and values." So that's why it doesn't work for Links. -Filip On 2008-06-12 19:17, Konstantin wrote: Thanks for trying to help me. And as I said I managed to get what I want by creating custom component. With markup like: ${simpleDescription} and appropriate backing class. But it looks like I'm back to here ... Ideal solution for my needs would be: And Java class with getDynaObject sending actual component to render. I would say: inline component. I'm not sure (will check) but I think that's possible with Wicket (I can construct any component replacing placeholder) :-) Thanks for help guys! Moving forward slowly in getting Tapestry concepts. nille hammer wrote: Hi Konstanin, I don´t think Filips post was irony. It really is simple. Anyway answering your question: Simply returning a component from a getter (in your case a Link from getMyDynaObject) won´t cause tapestry to render it. For a component to be rendered you have to place it somewhere in the template. The eplanation of the strange behaviour you see is you handing over a Link to a Grid as a data object. The default behaviour of Grid is to "scan" the data object for simple properies (i.e. a public getter and corresponding setter are present and getter returns simple types like Integer, String, Date etc.) and display the values in a table. The only property a Link contains is anchor (look here: http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Link.html). And that is displayed. To achieve what you want you have to use within the Grid and place some type of Link-component in the template. Look here for example: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html The UserList.tml right at the middle of the page. Hope that helps, nillehammer - original Nachricht ---- Betreff: Re: T5 t:renderObject and pageLink won't render link just text instead Gesendet: Do, 12. Jun 2008 Von: Konstantin<[EMAIL PROTECTED]> Irony ... good :-) Thanks for trying to help me with my dumb questions. I simplified my first sample, let me make it more close to what I wanted: @Property private MyGridRowObject myObject; // public Object getMyDynaObject() { Link testLink; switch(myObject.type) { case TYPE1: testLink = componentResources.createPageLink("targetPageHere", true, "11"); // here I need to get myObject.description to put it into link, but // don't know how to do that, you know ? // also some link context would be nice but that could be addParameter("context", "...") ?? return testLink; case TYPE2: return myObject.description; // no link just render text into this grid cell } } I created custom component with and syntetic properties isType1(), isType2() as a workaround (or should I say: "As a right way of doing things in Tapestry"). But that seems weird to do like that. Why can't I use getMyDynaObject() to tell Tapestry of what I need to render ? Filip S. Adamsen-2 wrote: Hi, I see. It's actually easier than you'd think. Here's what you do: Class: @Inject private ComponentResources componentResources; public String getLink() { return componentResources.createPageLink("targetpagehere", true").toURI(); } Template: ${link} text for link See? It's easy. :) But since you're linking to a page, why not just use the PageLink component? That's even easier. text for link You can see all the components here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/index.html Hope this helps. -Filip Konstantin skre
Re: Re: T5 t:renderObject and pageLink won't render link just text instead
Thanks for trying to help me. And as I said I managed to get what I want by creating custom component. With markup like: ${simpleDescription} and appropriate backing class. But it looks like I'm back to here ... Ideal solution for my needs would be: And Java class with getDynaObject sending actual component to render. I would say: inline component. I'm not sure (will check) but I think that's possible with Wicket (I can construct any component replacing placeholder) :-) Thanks for help guys! Moving forward slowly in getting Tapestry concepts. nille hammer wrote: > > > Hi Konstanin, > > I don´t think Filips post was irony. It really is simple. Anyway answering > your question: Simply returning a component from a getter (in your case a > Link from getMyDynaObject) won´t cause tapestry to render it. For a > component to be rendered you have to place it somewhere in the template. > > The eplanation of the strange behaviour you see is you handing over a Link > to a Grid as a data object. The default behaviour of Grid is to "scan" the > data object for simple properies (i.e. a public getter and corresponding > setter are present and getter returns simple types like Integer, String, > Date etc.) and display the values in a table. The only property a Link > contains is anchor (look here: > http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Link.html). > And that is displayed. > > To achieve what you want you have to use within the Grid and > place some type of Link-component in the template. Look here for example: > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html > > The UserList.tml right at the middle of the page. > > Hope that helps, nillehammer > > > ----- original Nachricht > > Betreff: Re: T5 t:renderObject and pageLink won't render link just text > instead > Gesendet: Do, 12. Jun 2008 > Von: Konstantin<[EMAIL PROTECTED]> > >> >> Irony ... good :-) Thanks for trying to help me with my dumb questions. >> I simplified my first sample, let me make it more close to what I wanted: >> >> @Property >> private MyGridRowObject myObject; // >> >> public Object getMyDynaObject() { >> Link testLink; >> switch(myObject.type) { >> case TYPE1: >> testLink = >> componentResources.createPageLink("targetPageHere", true, "11"); >> // here I need to get myObject.description to put it into >> link, but >> // don't know how to do that, you know ? >> // also some link context would be nice but that could be >> addParameter("context", "...") ?? >> return testLink; >> case TYPE2: >> return myObject.description; // no link just render text >> into this grid cell >> } >> } >> >> I created custom component with and syntetic properties isType1(), >> isType2() as a workaround (or should I say: "As a right way of doing >> things >> in Tapestry"). But that seems weird to do like that. Why can't I use >> getMyDynaObject() to tell Tapestry of what I need to render ? >> >> >> Filip S. Adamsen-2 wrote: >> > >> > Hi, >> > >> > I see. It's actually easier than you'd think. Here's what you do: >> > >> > Class: >> > >> >@Inject >> >private ComponentResources componentResources; >> > >> >public String getLink() { >> > return componentResources.createPageLink("targetpagehere", >> > true").toURI(); >> >} >> > >> > Template: >> > >> > ${link} text for link >> > >> > See? It's easy. :) >> > >> > But since you're linking to a page, why not just use the PageLink >> > component? That's even easier. >> > >> >text for link >> > >> > You can see all the components here: >> > http://tapestry.apache.org/tapestry5/tapestry-core/ref/index.html >> > >> > Hope this helps. >> > >> > -Filip >> > >> > Konstantin skrev: >> >> I think I'm missing concept behind renderObject component. >> >> The original idea was to render Link or just some text basing on other >> >> page >> >> properties and actual object to be rendered should be returned by
Re: Re: T5 t:renderObject and pageLink won't render link just text instead
Hi Konstanin, I don´t think Filips post was irony. It really is simple. Anyway answering your question: Simply returning a component from a getter (in your case a Link from getMyDynaObject) won´t cause tapestry to render it. For a component to be rendered you have to place it somewhere in the template. The eplanation of the strange behaviour you see is you handing over a Link to a Grid as a data object. The default behaviour of Grid is to "scan" the data object for simple properies (i.e. a public getter and corresponding setter are present and getter returns simple types like Integer, String, Date etc.) and display the values in a table. The only property a Link contains is anchor (look here: http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Link.html). And that is displayed. To achieve what you want you have to use within the Grid and place some type of Link-component in the template. Look here for example: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html The UserList.tml right at the middle of the page. Hope that helps, nillehammer - original Nachricht Betreff: Re: T5 t:renderObject and pageLink won't render link just text instead Gesendet: Do, 12. Jun 2008 Von: Konstantin<[EMAIL PROTECTED]> > > Irony ... good :-) Thanks for trying to help me with my dumb questions. > I simplified my first sample, let me make it more close to what I wanted: > > @Property > private MyGridRowObject myObject; // > > public Object getMyDynaObject() { > Link testLink; > switch(myObject.type) { > case TYPE1: > testLink = > componentResources.createPageLink("targetPageHere", true, "11"); > // here I need to get myObject.description to put it into > link, but > // don't know how to do that, you know ? > // also some link context would be nice but that could be > addParameter("context", "...") ?? > return testLink; > case TYPE2: > return myObject.description; // no link just render text > into this grid cell > } > } > > I created custom component with and syntetic properties isType1(), > isType2() as a workaround (or should I say: "As a right way of doing things > in Tapestry"). But that seems weird to do like that. Why can't I use > getMyDynaObject() to tell Tapestry of what I need to render ? > > > Filip S. Adamsen-2 wrote: > > > > Hi, > > > > I see. It's actually easier than you'd think. Here's what you do: > > > > Class: > > > >@Inject > >private ComponentResources componentResources; > > > >public String getLink() { > > return componentResources.createPageLink("targetpagehere", > > true").toURI(); > >} > > > > Template: > > > > ${link} text for link > > > > See? It's easy. :) > > > > But since you're linking to a page, why not just use the PageLink > > component? That's even easier. > > > >text for link > > > > You can see all the components here: > > http://tapestry.apache.org/tapestry5/tapestry-core/ref/index.html > > > > Hope this helps. > > > > -Filip > > > > Konstantin skrev: > >> I think I'm missing concept behind renderObject component. > >> The original idea was to render Link or just some text basing on other > >> page > >> properties and actual object to be rendered should be returned by public > >> Object getMyDynaObject(). > >> So I need to get in page markup for link, but instead I get > >> "targetPageHere/11". > >> Is it possible to do without creating custom component ? > >> > >> > >> Filip S. Adamsen-2 wrote: > >>> Hi, > >>> > >>> Tapestry does what you ask it to do - returns a (relative) URI for the > >>> link. (Check out the Javadocs/source for AbstractLink to see this.) > >>> > >>> I suspect that calling toAbsoluteURI() on the link will give you what > >>> you want. Oh, and you won't need RenderObject for that - you can just do > > >>> an expansion ${myDynaObject} in that case. > >>> > >>> -Filip > >>> > >>> Konstantin skrev: > >>>> in tml: > >>>> > >>>> > >>>> > >>>> in java: > >>>> > >>>> @Inje
Re: T5 t:renderObject and pageLink won't render link just text instead
Irony ... good :-) Thanks for trying to help me with my dumb questions. I simplified my first sample, let me make it more close to what I wanted: @Property private MyGridRowObject myObject; // public Object getMyDynaObject() { Link testLink; switch(myObject.type) { case TYPE1: testLink = componentResources.createPageLink("targetPageHere", true, "11"); // here I need to get myObject.description to put it into link, but // don't know how to do that, you know ? // also some link context would be nice but that could be addParameter("context", "...") ?? return testLink; case TYPE2: return myObject.description; // no link just render text into this grid cell } } I created custom component with and syntetic properties isType1(), isType2() as a workaround (or should I say: "As a right way of doing things in Tapestry"). But that seems weird to do like that. Why can't I use getMyDynaObject() to tell Tapestry of what I need to render ? Filip S. Adamsen-2 wrote: > > Hi, > > I see. It's actually easier than you'd think. Here's what you do: > > Class: > >@Inject >private ComponentResources componentResources; > >public String getLink() { > return componentResources.createPageLink("targetpagehere", > true").toURI(); >} > > Template: > > ${link} text for link > > See? It's easy. :) > > But since you're linking to a page, why not just use the PageLink > component? That's even easier. > >text for link > > You can see all the components here: > http://tapestry.apache.org/tapestry5/tapestry-core/ref/index.html > > Hope this helps. > > -Filip > > Konstantin skrev: >> I think I'm missing concept behind renderObject component. >> The original idea was to render Link or just some text basing on other >> page >> properties and actual object to be rendered should be returned by public >> Object getMyDynaObject(). >> So I need to get in page markup for link, but instead I get >> "targetPageHere/11". >> Is it possible to do without creating custom component ? >> >> >> Filip S. Adamsen-2 wrote: >>> Hi, >>> >>> Tapestry does what you ask it to do - returns a (relative) URI for the >>> link. (Check out the Javadocs/source for AbstractLink to see this.) >>> >>> I suspect that calling toAbsoluteURI() on the link will give you what >>> you want. Oh, and you won't need RenderObject for that - you can just do >>> an expansion ${myDynaObject} in that case. >>> >>> -Filip >>> >>> Konstantin skrev: in tml: in java: @Inject private ComponentResources componentResources; public Object getMyDynaObject() { Link testLink; testLink = componentResources.createPageLink("targetPageHere", true, "11"); return testLink; } Renders text "targetPageHere/11" instead of actual link. What am I doing wrong here ? >>> - >>> 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] > > > -- View this message in context: http://www.nabble.com/T5-t%3ArenderObject-and-pageLink-won%27t-render-link-just-text-instead-tp17782707p17794921.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 t:renderObject and pageLink won't render link just text instead
Hi, I see. It's actually easier than you'd think. Here's what you do: Class: @Inject private ComponentResources componentResources; public String getLink() { return componentResources.createPageLink("targetpagehere", true").toURI(); } Template: text for link See? It's easy. :) But since you're linking to a page, why not just use the PageLink component? That's even easier. text for link You can see all the components here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/index.html Hope this helps. -Filip Konstantin skrev: I think I'm missing concept behind renderObject component. The original idea was to render Link or just some text basing on other page properties and actual object to be rendered should be returned by public Object getMyDynaObject(). So I need to get in page markup for link, but instead I get "targetPageHere/11". Is it possible to do without creating custom component ? Filip S. Adamsen-2 wrote: Hi, Tapestry does what you ask it to do - returns a (relative) URI for the link. (Check out the Javadocs/source for AbstractLink to see this.) I suspect that calling toAbsoluteURI() on the link will give you what you want. Oh, and you won't need RenderObject for that - you can just do an expansion ${myDynaObject} in that case. -Filip Konstantin skrev: in tml: in java: @Inject private ComponentResources componentResources; public Object getMyDynaObject() { Link testLink; testLink = componentResources.createPageLink("targetPageHere", true, "11"); return testLink; } Renders text "targetPageHere/11" instead of actual link. What am I doing wrong here ? - 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 t:renderObject and pageLink won't render link just text instead
I think I'm missing concept behind renderObject component. The original idea was to render Link or just some text basing on other page properties and actual object to be rendered should be returned by public Object getMyDynaObject(). So I need to get in page markup for link, but instead I get "targetPageHere/11". Is it possible to do without creating custom component ? Filip S. Adamsen-2 wrote: > > Hi, > > Tapestry does what you ask it to do - returns a (relative) URI for the > link. (Check out the Javadocs/source for AbstractLink to see this.) > > I suspect that calling toAbsoluteURI() on the link will give you what > you want. Oh, and you won't need RenderObject for that - you can just do > an expansion ${myDynaObject} in that case. > > -Filip > > Konstantin skrev: >> in tml: >> >> >> >> in java: >> >> @Inject >> private ComponentResources componentResources; >> >> public Object getMyDynaObject() { >> Link testLink; >> testLink = componentResources.createPageLink("targetPageHere", >> true, >> "11"); >> return testLink; >> } >> >> Renders text "targetPageHere/11" instead of actual link. What am I doing >> wrong here ? >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T5-t%3ArenderObject-and-pageLink-won%27t-render-link-just-text-instead-tp17782707p17783044.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 t:renderObject and pageLink won't render link just text instead
Hi, Tapestry does what you ask it to do - returns a (relative) URI for the link. (Check out the Javadocs/source for AbstractLink to see this.) I suspect that calling toAbsoluteURI() on the link will give you what you want. Oh, and you won't need RenderObject for that - you can just do an expansion ${myDynaObject} in that case. -Filip Konstantin skrev: in tml: in java: @Inject private ComponentResources componentResources; public Object getMyDynaObject() { Link testLink; testLink = componentResources.createPageLink("targetPageHere", true, "11"); return testLink; } Renders text "targetPageHere/11" instead of actual link. What am I doing wrong here ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5 t:renderObject and pageLink won't render link just text instead
in tml: in java: @Inject private ComponentResources componentResources; public Object getMyDynaObject() { Link testLink; testLink = componentResources.createPageLink("targetPageHere", true, "11"); return testLink; } Renders text "targetPageHere/11" instead of actual link. What am I doing wrong here ? -- View this message in context: http://www.nabble.com/T5-t%3ArenderObject-and-pageLink-won%27t-render-link-just-text-instead-tp17782707p17782707.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]