You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2005/06/04 02:22:27 UTC

Yet another border question.

Thanks to Ron and Jamie I got things started here with composite
screens. Well But I found it most ackward to have a component called
Border with my page layout. What if I have diferent layouts, should I
create a new component for each one? What about nesting? Imagine a
page that has a menu on top and content underneath. Ok here's my
component:
<tr>
<td> some menu</<td>
<td>@RenderBody</td>
<tr>

Ok, now what happens is let's say one of the itens of the menu has
another composite page with a menu on the left? How to compose them?

thanks all

Vinicius

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


Re: Yet another border question.

Posted by Ron Piterman <mp...@vollbio.de>.
ציטוט Ron Piterman:
> ציטוט Vinicius Carvalho:
> This is just like the page title question.
> You use one border, but you need for each page another title, so you use 
> pass parameter to the border, indicating the title.
> 
> Now, if some pages use just the same layout, but vary slightly, you can 
> include these parts as optional, dynamic parts of your border.
> 
> <tr>
>  <td> some menu </td>
>  <span jwcid="@Conditional" condition="ognl:displaySubmenu">
>   <td> submenu </td>
>  </span>
>  <td>@RenderBody</td>
> </tr>
> 
> Now I go a bit further with implementation, but that acctualy was 
> already everything.
> 
> public boolean getDisplayBorder() {
>  return getPage() instaceof ISubmenuPage;
> }
> 
> public List<SubmenuItems> getSubmenuItems() {
>  return ((ISubmenuPage)getPage()).getSubmenuItems();
> }
> 
> Just an idee...

Answering myself...
I dislike that. I think it would be better to pass an optional list 
parameter to the border, containing the submenu items, than implementing 
it with an interface on the page class.

> 
> Cheers,
> Ron
> 
>> Thanks to Ron and Jamie I got things started here with composite
>> screens. Well But I found it most ackward to have a component called
>> Border with my page layout. What if I have diferent layouts, should I
>> create a new component for each one? What about nesting? Imagine a
>> page that has a menu on top and content underneath. Ok here's my
>> component:
>> <tr>
>> <td> some menu</<td>
>> <td>@RenderBody</td>
>> <tr>
>>
>> Ok, now what happens is let's say one of the itens of the menu has
>> another composite page with a menu on the left? How to compose them?
>>
>> thanks all
>>
>> Vinicius
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: Yet another border question.

Posted by Ron Piterman <mp...@vollbio.de>.
ציטוט Vinicius Carvalho:
This is just like the page title question.
You use one border, but you need for each page another title, so you use 
pass parameter to the border, indicating the title.

Now, if some pages use just the same layout, but vary slightly, you can 
include these parts as optional, dynamic parts of your border.

<tr>
  <td> some menu </td>
  <span jwcid="@Conditional" condition="ognl:displaySubmenu">
   <td> submenu </td>
  </span>
  <td>@RenderBody</td>
</tr>

Now I go a bit further with implementation, but that acctualy was 
already everything.

public boolean getDisplayBorder() {
  return getPage() instaceof ISubmenuPage;
}

public List<SubmenuItems> getSubmenuItems() {
  return ((ISubmenuPage)getPage()).getSubmenuItems();
}

Just an idee...

Cheers,
Ron

> Thanks to Ron and Jamie I got things started here with composite
> screens. Well But I found it most ackward to have a component called
> Border with my page layout. What if I have diferent layouts, should I
> create a new component for each one? What about nesting? Imagine a
> page that has a menu on top and content underneath. Ok here's my
> component:
> <tr>
> <td> some menu</<td>
> <td>@RenderBody</td>
> <tr>
> 
> Ok, now what happens is let's say one of the itens of the menu has
> another composite page with a menu on the left? How to compose them?
> 
> thanks all
> 
> Vinicius
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: Yet another border question.

Posted by Vinicius Carvalho <ja...@gmail.com>.
Thanks Robert :D I'll give it a try.

On 6/3/05, Robert Zeigler <ro...@scazdl.org> wrote:
> Weeelll... it's possible to do everything you want. Yes, you can have
> your cake and eat it, too. ;) But it comes at the cost of complexity one
> way or another.
> So, right now, I have a project that has two different layouts. For this
> project, which layout to use was very well defined, so I simply defined
> three border components. Yes, three. ;) One is the one that the pages
> use. It, in turn, wraps the other two border components, rendering
> whichever one is appropriate for the situation. So, you have something like:
> <span jwcid="@base:If" condition="ognl:condition" element="ognl:null">
> <body jwcid="@border1">
>   <div jwcid="@RenderBody"/>
> </body>
> </span>
> </span jwcid="@base:Else" element="ognl:null">
> <body jwcid="@border2">
>   <div jwcid="@RenderBody"/>
> </body>
> </span>
> 
> But, what happens if your needs are more complex? (Like the top + side
> menu) I've also implemented a system for border which would support any
> number of layouts, without knowing a thing about the other layouts ahead
> of time. The trick here, or at least the one that I used, was my good
> friends block and render block.
> 
> It's been awhile since I looked at this setup, but the general idea was
> that each page was wrapped by the border component, but the border used
> block/render block to delegate the rendering to the unknown layouts.
> So, it's something like:
> 
> <body jwcid="@Body">
> 
> <div jwcid="@RenderBlock" block="ognl:layoutBlock"
> mainContent="ognl:components.bodyContent"/>
> 
> <!-- important piece... :) -->
> 
> <div jwcid="bodyContent@Block">
>   <div jwcid="@RenderBody"/>
> </div>
> 
> Notice how the render body is, itself, in a block.
> The individual layouts then do something like:
> 
> <div jwcid="layout1@Block">
> <!-- various markup for the individual layout -->
> <!-- now insert the body -->
> <div jwcid="@RenderBlock"
> block="ognl:components.layout1.inserter.bindings.mainContent.object"/>
> </div>
> 
> It's a bit twisted and demented... but it works. ;)
> Happy tapestry'ing.
> 
> Robert
> 
> Vinicius Carvalho wrote:
> > Thanks to Ron and Jamie I got things started here with composite
> > screens. Well But I found it most ackward to have a component called
> > Border with my page layout. What if I have diferent layouts, should I
> > create a new component for each one? What about nesting? Imagine a
> > page that has a menu on top and content underneath. Ok here's my
> > component:
> > <tr>
> > <td> some menu</<td>
> > <td>@RenderBody</td>
> > <tr>
> >
> > Ok, now what happens is let's say one of the itens of the menu has
> > another composite page with a menu on the left? How to compose them?
> >
> > thanks all
> >
> > Vinicius
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Re: Yet another border question.

Posted by Robert Zeigler <ro...@scazdl.org>.
Weeelll... it's possible to do everything you want. Yes, you can have
your cake and eat it, too. ;) But it comes at the cost of complexity one
way or another.
So, right now, I have a project that has two different layouts. For this
project, which layout to use was very well defined, so I simply defined
three border components. Yes, three. ;) One is the one that the pages
use. It, in turn, wraps the other two border components, rendering
whichever one is appropriate for the situation. So, you have something like:
<span jwcid="@base:If" condition="ognl:condition" element="ognl:null">
<body jwcid="@border1">
  <div jwcid="@RenderBody"/>
</body>
</span>
</span jwcid="@base:Else" element="ognl:null">
<body jwcid="@border2">
  <div jwcid="@RenderBody"/>
</body>
</span>

But, what happens if your needs are more complex? (Like the top + side
menu) I've also implemented a system for border which would support any
number of layouts, without knowing a thing about the other layouts ahead
of time. The trick here, or at least the one that I used, was my good
friends block and render block.

It's been awhile since I looked at this setup, but the general idea was
that each page was wrapped by the border component, but the border used
block/render block to delegate the rendering to the unknown layouts.
So, it's something like:

<body jwcid="@Body">

<div jwcid="@RenderBlock" block="ognl:layoutBlock"
mainContent="ognl:components.bodyContent"/>

<!-- important piece... :) -->

<div jwcid="bodyContent@Block">
  <div jwcid="@RenderBody"/>
</div>

Notice how the render body is, itself, in a block.
The individual layouts then do something like:

<div jwcid="layout1@Block">
<!-- various markup for the individual layout -->
<!-- now insert the body -->
<div jwcid="@RenderBlock"
block="ognl:components.layout1.inserter.bindings.mainContent.object"/>
</div>

It's a bit twisted and demented... but it works. ;)
Happy tapestry'ing.

Robert

Vinicius Carvalho wrote:
> Thanks to Ron and Jamie I got things started here with composite
> screens. Well But I found it most ackward to have a component called
> Border with my page layout. What if I have diferent layouts, should I
> create a new component for each one? What about nesting? Imagine a
> page that has a menu on top and content underneath. Ok here's my
> component:
> <tr>
> <td> some menu</<td>
> <td>@RenderBody</td>
> <tr>
> 
> Ok, now what happens is let's say one of the itens of the menu has
> another composite page with a menu on the left? How to compose them?
> 
> thanks all
> 
> Vinicius
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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