Still not seeing why the basic general approach I outlined wouldn't work, only 
now you have a formal parameter.

<t:menu>
  <p:menutype>
        <t:fruitsmenu/>
  </p:menutype>
</t:menu>

menu.java:
  @Parameter
  @Property
  private Block menutype;

menu.tml:
  <t:delegate to="menutype"/>

Alternatively, have menu render the body, which simplifies things further:

<t:menu><t:fruitsmenu/></t:menu>

menu.tml:
  markup <t:body/> more markup

This way, menu is entirely agnostic to what the menu actually is.

A third approach, if you want to avoid specifying <t:fruitsmenu/> in your 
"fruits" page:


menu.tml:

markup <t:delegate to="menu"/> more markup

<t:block id="fruitmenu">
  <t:fruitsmenu/>
</t:block>
<t:block id="meatmenu">
  <t:meatmenu/>
</t:block>

menu.java

@Inject
private Block fruitmenu;
@Inject
private Block meatmenu;

public Block getMenu() {
  if (some_condition) {
    return fruitmenu;
  } else {
    return meatmenu;
  } 
}


So the next question is: what happens when you add a new menu type 
("vegetablemenu") and associated pages; for instance, what if this is a system 
where you are dropping third-party components/pages in and they need to tie 
into your menu?
  a) Either use a solution similar to solution 1 above where your menu is 
agnostic to (most) of the content inside of it
  b) In fact, the Blocks don't have to be in the menu's component page. Check 
out how BeanEditor and BeanDisplay work. Basically, blocks can be unused from 
any page in your application and rendered into the current page. Again, check 
out BeanEditor and related components in tapestry-core to see detailed examples 
of doing this.

Robert

On Mar 13, 2012, at 3/135:16 PM , TechniciuM wrote:

> That's not exactly what I was looking for, but thanks for the effort. Here is
> the image of what I am at least trying to achieve. Hope you will understand
> it now.
> 
> http://imageshack.us/photo/my-images/839/tapestry.png/
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/How-to-represent-this-tp5558903p5562782.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


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

Reply via email to