tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Adams (JIRA)" <j...@apache.org>
Subject [jira] Commented: (TAP5-705) Let a page choose its layout
Date Fri, 15 May 2009 15:08:45 GMT

    [ https://issues.apache.org/jira/browse/TAP5-705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709864#action_12709864
] 

Dan Adams commented on TAP5-705:
--------------------------------

We actually have a need for exactly feature on our end in that pages need to be able to indicate
which layout to use or delegate the layout rendering without knowing a head of time which
layout will be used or even allowing swapping out the implementation to a different layout.
I was planning on doing this in our library somehow but being able to delegate rendering to
an implementation of a component would be great.

> Let a page choose its layout
> ----------------------------
>
>                 Key: TAP5-705
>                 URL: https://issues.apache.org/jira/browse/TAP5-705
>             Project: Tapestry 5
>          Issue Type: Wish
>          Components: tapestry-core
>    Affects Versions: 5.0.18
>            Reporter: Borut Bolcina
>
> It would be great if a page could dynamically choose its layout. In some cases the page
would use Layout1 component and in some cases Layout2.
> The t:type="${layout}" does not get expanded to whatever I set in Index.java.
> PageWithLayout.tml
> ===============
> <div t:type="${layout}" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>     <p>page with ${layout}</p>
> </div>
> PageWithLayout.java
> ===============
> public class PageWithLayout {
>     private String layout;
>    
>     public String getLayout() {
>         return layout;
>     }
>     public void setLayout(String layout) {
>         this.layout = layout;
>     }
> }
> Index.tml
> =======
> <t:actionlink t:id="PageWithLayout1">layout1</t:actionlink><br/>
> <t:actionlink t:id="PageWithLayout2">layout2</t:actionlink>
> Index.java
> =======
> public class Index {
>     @InjectPage
>     private PageWithLayout pageWithLayout;
>    
>     Object onActionFromPageWithLayout1() {
>         pageWithLayout.setLayout("layout1");
>         return pageWithLayout;
>     }
>    
>     Object onActionFromPageWithLayout2() {
>         pageWithLayout.setLayout("layout2");
>         return pageWithLayout;
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message