You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tobias Wehrum <Le...@dragonlab.de> on 2008/07/09 17:56:06 UTC

[T5] Rendering a block a component received as parameter

Hi there,

I am developing a tree component which can take several classes as 
nodes. Each class should have it's own body, stored in parameters - and 
then rendered, of course.

Now, lets say I have I have this code in my Test.tml:

--------------------------------------------------------------------------
<t:ExTree t:id="taskTree" source="treeNodes" currentNode="currentTreeNode">
    <t:parameter name="taskClassContent">
        <t:pagelink t:page="Task" 
context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.title}</t:pagelink>
    </t:parameter>
    <t:parameter name="projectClassContent">
        <t:pagelink t:page="Project" 
context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.projectName}</t:pagelink>
    </t:parameter>
</t:ExTree>
--------------------------------------------------------------------------

As you can see, taskClassContent and projectClassContent are Block elements.

Now how can I render this Block element in my ExTree component? By the 
way, ExTree hasn't a template, just a class.

Hope that someone can help me,
Tobias

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] Rendering a block a component received as parameter

Posted by Josh Canfield <jo...@thedailytube.com>.
But you can't use a delegate component without a template, right?

On Wed, Jul 9, 2008 at 12:15 PM, Howard Lewis Ship <hl...@gmail.com> wrote:

> Another option is to use the Delegate component and pass it the Block
> instance.
>
> On Wed, Jul 9, 2008 at 9:59 AM, Josh Canfield <jo...@thedailytube.com>
> wrote:
> > I don't recall if you can use MarkupWriter to write blocks yet, but one
> > method I've used is to return the block from the beginRender method, it's
> > rendered after whatever you write within the method. I believe for both
> > blocks you would have to use both beginRender and beforeRenderTemplate,
> or I
> > suppose you could loop from the beginRender method.
> >
> > If you want to wrap your blocks in an element you would start it in
> > beginRender and finish it in afterRender...
> >
> > In the case you've laid out though, it might be easier to just create a
> > template.
> >
> > Josh
> > On Wed, Jul 9, 2008 at 8:56 AM, Tobias Wehrum <Le...@dragonlab.de>
> wrote:
> >
> >> Hi there,
> >>
> >> I am developing a tree component which can take several classes as
> nodes.
> >> Each class should have it's own body, stored in parameters - and then
> >> rendered, of course.
> >>
> >> Now, lets say I have I have this code in my Test.tml:
> >>
> >>
> --------------------------------------------------------------------------
> >> <t:ExTree t:id="taskTree" source="treeNodes"
> currentNode="currentTreeNode">
> >>   <t:parameter name="taskClassContent">
> >>       <t:pagelink t:page="Task"
> >>
> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.title}</t:pagelink>
> >>   </t:parameter>
> >>   <t:parameter name="projectClassContent">
> >>       <t:pagelink t:page="Project"
> >>
> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.projectName}</t:pagelink>
> >>   </t:parameter>
> >> </t:ExTree>
> >>
> --------------------------------------------------------------------------
> >>
> >> As you can see, taskClassContent and projectClassContent are Block
> >> elements.
> >>
> >> Now how can I render this Block element in my ExTree component? By the
> way,
> >> ExTree hasn't a template, just a class.
> >>
> >> Hope that someone can help me,
> >> Tobias
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Re: [T5] Rendering a block a component received as parameter

Posted by Howard Lewis Ship <hl...@gmail.com>.
Another option is to use the Delegate component and pass it the Block instance.

On Wed, Jul 9, 2008 at 9:59 AM, Josh Canfield <jo...@thedailytube.com> wrote:
> I don't recall if you can use MarkupWriter to write blocks yet, but one
> method I've used is to return the block from the beginRender method, it's
> rendered after whatever you write within the method. I believe for both
> blocks you would have to use both beginRender and beforeRenderTemplate, or I
> suppose you could loop from the beginRender method.
>
> If you want to wrap your blocks in an element you would start it in
> beginRender and finish it in afterRender...
>
> In the case you've laid out though, it might be easier to just create a
> template.
>
> Josh
> On Wed, Jul 9, 2008 at 8:56 AM, Tobias Wehrum <Le...@dragonlab.de> wrote:
>
>> Hi there,
>>
>> I am developing a tree component which can take several classes as nodes.
>> Each class should have it's own body, stored in parameters - and then
>> rendered, of course.
>>
>> Now, lets say I have I have this code in my Test.tml:
>>
>> --------------------------------------------------------------------------
>> <t:ExTree t:id="taskTree" source="treeNodes" currentNode="currentTreeNode">
>>   <t:parameter name="taskClassContent">
>>       <t:pagelink t:page="Task"
>> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.title}</t:pagelink>
>>   </t:parameter>
>>   <t:parameter name="projectClassContent">
>>       <t:pagelink t:page="Project"
>> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.projectName}</t:pagelink>
>>   </t:parameter>
>> </t:ExTree>
>> --------------------------------------------------------------------------
>>
>> As you can see, taskClassContent and projectClassContent are Block
>> elements.
>>
>> Now how can I render this Block element in my ExTree component? By the way,
>> ExTree hasn't a template, just a class.
>>
>> Hope that someone can help me,
>> Tobias
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] Rendering a block a component received as parameter

Posted by Tobias Wehrum <Le...@dragonlab.de>.
Hi Josh,

thanks, this works great!

I think I understand the rendering process now a little bit better, so a 
Delegate would have been fine too - thank you, Howard. I just didn't 
understand how to render that Delegate before, since it is a component 
too. (I hope I now understand it correctly that I just would've put it 
in the Template and set the Block which should be rendered in 
beforeRenderTemplate.)

- Tobias

Josh Canfield schrieb:
> I don't recall if you can use MarkupWriter to write blocks yet, but one
> method I've used is to return the block from the beginRender method, it's
> rendered after whatever you write within the method. I believe for both
> blocks you would have to use both beginRender and beforeRenderTemplate, or I
> suppose you could loop from the beginRender method.
>
> If you want to wrap your blocks in an element you would start it in
> beginRender and finish it in afterRender...
>
> In the case you've laid out though, it might be easier to just create a
> template.
>
> Josh
> On Wed, Jul 9, 2008 at 8:56 AM, Tobias Wehrum <Le...@dragonlab.de> wrote:
>
>   
>> Hi there,
>>
>> I am developing a tree component which can take several classes as nodes.
>> Each class should have it's own body, stored in parameters - and then
>> rendered, of course.
>>
>> Now, lets say I have I have this code in my Test.tml:
>>
>> --------------------------------------------------------------------------
>> <t:ExTree t:id="taskTree" source="treeNodes" currentNode="currentTreeNode">
>>   <t:parameter name="taskClassContent">
>>       <t:pagelink t:page="Task"
>> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.title}</t:pagelink>
>>   </t:parameter>
>>   <t:parameter name="projectClassContent">
>>       <t:pagelink t:page="Project"
>> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.projectName}</t:pagelink>
>>   </t:parameter>
>> </t:ExTree>
>> --------------------------------------------------------------------------
>>
>> As you can see, taskClassContent and projectClassContent are Block
>> elements.
>>
>> Now how can I render this Block element in my ExTree component? By the way,
>> ExTree hasn't a template, just a class.
>>
>> Hope that someone can help me,
>> Tobias
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] Rendering a block a component received as parameter

Posted by Josh Canfield <jo...@thedailytube.com>.
I don't recall if you can use MarkupWriter to write blocks yet, but one
method I've used is to return the block from the beginRender method, it's
rendered after whatever you write within the method. I believe for both
blocks you would have to use both beginRender and beforeRenderTemplate, or I
suppose you could loop from the beginRender method.

If you want to wrap your blocks in an element you would start it in
beginRender and finish it in afterRender...

In the case you've laid out though, it might be easier to just create a
template.

Josh
On Wed, Jul 9, 2008 at 8:56 AM, Tobias Wehrum <Le...@dragonlab.de> wrote:

> Hi there,
>
> I am developing a tree component which can take several classes as nodes.
> Each class should have it's own body, stored in parameters - and then
> rendered, of course.
>
> Now, lets say I have I have this code in my Test.tml:
>
> --------------------------------------------------------------------------
> <t:ExTree t:id="taskTree" source="treeNodes" currentNode="currentTreeNode">
>   <t:parameter name="taskClassContent">
>       <t:pagelink t:page="Task"
> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.title}</t:pagelink>
>   </t:parameter>
>   <t:parameter name="projectClassContent">
>       <t:pagelink t:page="Project"
> context="${ognl:currentTreeNode.id}">${ognl:currentTreeNode.projectName}</t:pagelink>
>   </t:parameter>
> </t:ExTree>
> --------------------------------------------------------------------------
>
> As you can see, taskClassContent and projectClassContent are Block
> elements.
>
> Now how can I render this Block element in my ExTree component? By the way,
> ExTree hasn't a template, just a class.
>
> Hope that someone can help me,
> Tobias
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.