I have an existing T5 application that contains approx. 25 components. In
it's current "stable" version the arrangement of these components across
pages is pre-defined and everything works fine. Given Tapestry's component
approach it comes as no suprise that users are now requesting a more
flexible dashboard interface where they can pick and choose what components
they see across multiple tabbed pages. 

So step one I've made all my components extend a new "panel" super-class and
created "layout" pages containing approx. 10 layouts (with 1-6 panel
components). The first attempt had a switcher component to decide what panel
finally gets rendered. Needless to say I ran straight into the
Uber-component anti-pattern as discussed in this thread
(http://old.nabble.com/-T5.0.18--Out-of-Memory-Error---Potential-Leak-%28doesn%27t-reduce-after-forced-GC%29-td25403474s302.html#a25406254).

Employing a ComponentLoader approach as discussed in the thread fixed the
memory issue. I have a page with all my components defined and a panel
loader class that auto-magically selects the right component. On startup
everything looks ok, however when I try to interact with the
component/"panels" they appear to have lost their context. I'm guessing this
is the  result of the component being re-used? The problem is further
compounded when trying to use Ajax zones to update specific intances of the
components.

I'm currently doing:

pages/Layout1.tml:
<table xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";
width="100%">
  <tr>
    <td><t:panelSwitcher t:panel="panel1"/></td>
    <td><t:panelSwitcher t:panel="panel2"/></td>
    <td><t:panelSwitcher t:panel="panel3"/></td>
  <tr>
</table>

components/PanelSwitcher.java:
public PanelSwitcher { 

  ...

  @BeginRender
        PanelComponent selectComponent() {
                environment.push(MyPanel.class,panel);
                return componentSource.getComponent("panels/PanelComponents" + 
":" +
panel.getShortType());
        }
        
}

pages/panels/PanelComponents.java:
public class PanelComponents {
        
        @Environmental
        private MyPanel panel;
        
        @Component(parameters = {"panel=panel"})
  private Panel1 panel1;

        @Component(parameters = {"panel=panel"})
        private Panel2 panel2;
        
        etc...
}

pages/panels/PanelComponents.tml:
<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
        <t:Panel1 t:id="panel1"/>
    <t:Panel2 t:id="panel2"/>
</div>

I'm sure I'm doing something silly here but how can I ensure components keep
their "panel" context when events occur later?

More broadly speaking has anyone managed to implement a dashboard style
application (i.e.layouts/panels) and what is the correct pattern to use?

Regards,

Scyta1e
-- 
View this message in context: 
http://old.nabble.com/T5%3A-Dashboard-Application-tp28949567p28949567.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

Reply via email to