You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by David Avenante <d....@gmail.com> on 2007/07/03 22:26:08 UTC

[T5] How create sub component

Hi,

I try to create sub compponent in T5 (5.0.5).

My template is :

<div t:type="myComponent1">
        <div t:type="myCompopnent2">
            <h1>Content</h1>
        </div>
</div>

In myComponent2 class when i try to access to the Container :

@Inject
private ComponentResources componentResources;

componentResources.getContainer(), tapestry return to me my page and
not my component.

If I place :
<div t:type="myCompopnent2">
        <h1>Content</h1>
</div>

in myCompnent1 template it's works !!!!

Why and what is the difference ?

Thank for any input.

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


Re: [T5] How create sub component

Posted by David Avenante <d....@gmail.com>.
Thank you  Hugo, I'll explore this way.

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


Re: [T5] How create sub component

Posted by Hugo Palma <hu...@gmail.com>.
Well, i think the only way you could achieve that would be to use the Block
component.
You could create a master page where your component blocks are declared.
That would be the only page your web designer would edit. In the other pages
where you use the components you would would the RenderBlock component and
reference the blocks on the master page.
I think this might work.....

On 7/4/07, David Avenante <d....@gmail.com> wrote:
>
> Yes there is always  workaround but what I liked in the definition of
> tapestry is :
>
> Tapestry is organized around four key principles:
>
>     * Simplicity
>     * Consistency
>     * Efficiency
>     * Feedback
>
> And I like the first term ;) I like to have SIMPLE  file, easy
> readable and understandable.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [T5] How create sub component

Posted by David Avenante <d....@gmail.com>.
Yes there is always  workaround but what I liked in the definition of
tapestry is :

Tapestry is organized around four key principles:

    * Simplicity
    * Consistency
    * Efficiency
    * Feedback

And I like the first term ;) I like to have SIMPLE  file, easy
readable and understandable.

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


Re: [T5] How create sub component

Posted by Hugo Palma <hu...@gmail.com>.
Regarding helping the web designers get around the templates, i have found
in the past that providing a master HTML file with server side includes to
include the component templates that you want them to edit worked fine. It
was actually a web designer that suggested this, I think they used
Dreamweaver to edit the templates which works fine with SSI.
This way they only see it as one template when in fact they are editing all
the component templates.

On 7/4/07, David Avenante <d....@gmail.com> wrote:
>
> Yes I can understand but this approach is a big constraint, with big
> implication for my web designer who need to play in templates and need
> to have a good understanding of my templates hierarchy
>
> For me it's an issue with lot of limitation. A simple exemple :
>
> I want to create a component who can generate a complex layout for my
> page.
> I want something like :
>
> <div t:type="myLayout">
>   <div t:type="contentPanel" name="north">
>       content a
>   <div>
>
> <div t:type="contentPanel" name="south">
>       content b
>   <div>
>
> </div>
>
> So as you can see I can have many contentPanel (like east west center...)
> And each contentPanel can content a new layout.
>
> It's crazy for me to let play a web designer in a hierarchy of template.
> I need to have a "flat" view a this type of complex component.
>
> So I don't see the origins of this technical limitation.
>
> Cheers,
> David
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [T5] How create sub component

Posted by David Avenante <d....@gmail.com>.
Yes I can understand but this approach is a big constraint, with big
implication for my web designer who need to play in templates and need
to have a good understanding of my templates hierarchy

For me it's an issue with lot of limitation. A simple exemple :

I want to create a component who can generate a complex layout for my page.
I want something like :

<div t:type="myLayout">
  <div t:type="contentPanel" name="north">
      content a
  <div>

 <div t:type="contentPanel" name="south">
      content b
  <div>

</div>

So as you can see I can have many contentPanel (like east west center...)
And each contentPanel can content a new layout.

It's crazy for me to let play a web designer in a hierarchy of template.
I need to have a "flat" view a this type of complex component.

So I don't see the origins of this technical limitation.

Cheers,
David

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


Re: [T5] How create sub component

Posted by Nick Westgate <ni...@key-planning.co.jp>.
All components declared in a template or class for a component/page are
"embedded components". They all share the same parent component/page
which is returned by getContainer() as you've seen.

This is completely separate from the DOM hierarchy that T5 builds as it
renders. In that case you can navigate elements (but not components) e.g:

void beginRender(MarkupWriter writer)
{
	Element element = writer.getElement();
	Element parent = element.getParent();
	...
}

At least, that is my undestanding so far.

Cheers,
Nick.


David Avenante wrote:
> Hi,
> 
> I try to create sub compponent in T5 (5.0.5).
> 
> My template is :
> 
> <div t:type="myComponent1">
>        <div t:type="myCompopnent2">
>            <h1>Content</h1>
>        </div>
> </div>
> 
> In myComponent2 class when i try to access to the Container :
> 
> @Inject
> private ComponentResources componentResources;
> 
> componentResources.getContainer(), tapestry return to me my page and
> not my component.
> 
> If I place :
> <div t:type="myCompopnent2">
>        <h1>Content</h1>
> </div>
> 
> in myCompnent1 template it's works !!!!
> 
> Why and what is the difference ?
> 
> Thank for any input.
> 
> ---------------------------------------------------------------------
> 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