Hi Erik, 

in T5 its very easy to create a tab component. 
Just create a component for every tab you have.
Then add a Delegate to the page that should 
display the tab and bind the "to" parameter of
the Delegate to a method. This method then returns
the respective tab component

example code:

template:
<t:delegate to="selectedTab"/>
<a t:id="tab1_link">tab1</a>
<a t:id="tab2_link">tab2</a>
<t:block>
    <div t:id="tab1" />
    <div t:id="tab2" />
</t:block>

java class:

// dont forget getter methods
@Component private Tab tab1_link
@Component private Tab tab2_link

// because of redirect
@Persist("flash") private int selectedComponent;

public void onActionFromTab1_link()  { selectedComponent = 1;}
public void onActionFromTab2_link()  { selectedComponent = 2;}

public Object selectedTab() {
    if(selectedComponent == 1)
        return tab1;
    if(selectedComponent == 2)
        return tab2;
    return tab1;
}

g,
kris




"Erik Vullings" <[EMAIL PROTECTED]> 
10.06.2007 11:54
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
"Tapestry users" <users@tapestry.apache.org>
Kopie

Thema
T5 tab-like component






Hi all,

Since there does not seem to be a T5 tab component, should I use the Dojo
one? Furthermore, what's the best way to use it for offering multiple 
views
on the same object. For example, when choosing a user in a list, I would
like to use a tab-like view to show business details, personal details, 
etc.
However, I would like to separate the development of these views as much 
as
possible, and would prefer not to put everything in one view/page, i.e. I
would prefer not to create one page, and have something like
<t:if "Tab1">Generate tab 1 content</t:if>
 <t:if "Tab2">Generate tab 2 content</t:if>
etc.

What would be the best way to achieve this separation of concern?

Thanks
Erik

Reply via email to