I believe panels can and do offer you several insertion points. Panels also
offer a superior solution to my original idea, I'm sorry I didn't explore them
earlier on.
I'm still not 100% sure exactly what you're looking to do, but imagine a
template something like this:
...
#if ($panels.size() >= 4)
<div>
$panels.get(3)
<div>
#if ($panels.size() >= 5)
$panels.get(4)
#else
Oops, no panel 5.
#end
</div>
</div>
#else
Oops, no panel 4!
#end
...
and a BorderPage.java something like this:
public class BorderPage extends Page {
@Bindable private ArrayList<Panel> panels = new ArrayList<Panel>();
...
public void onInit(){
...
panels.add(new Panel("panel1", "/menu.htm"));
addControl(panels.get(0));
panels.get(0).addModel("logo", new Logo(customerId));
...
panels.add(new Panel("panel2", "/test.htm"));
addControl(panels.get(1));
...
panels.add(new Panel("panel3", "/test.htm"));
addControl(panels.get(2));
...
}
}
and a page like this:
public class IntranetPage extends BorderPage {
...
public void onInit(){
...
panels.add(new Panel("panel4", "/test.htm"));
addControl(panels.get(3));
panels.get(3).addModel("thisControl", new Submit("Submit"));
panels.add(new Panel("panel5", "/test.htm"));
addControl(panels.get(4));
TextField txt = new TextField("name", "Name", 10);
panels.get(4).addModel("thisControl ", txt);
...
}
}
You could use the same simple template for each panel:
$thisControl
If you really wanted to use labeled insertion points, you could use a HashMap
<String, Panel>. I think this is pretty close to what you are looking for.
-----Original Message-----
From: Andrei Ionescu [mailto:[email protected]]
Sent: Thursday, September 02, 2010 4:10 AM
To: [email protected]
Subject: Re: Page Decoration with the Border vs. Page inclusion in the Border?
> Why not use Panels?
Because it don't see how it could solve the problem :).
The problem is that the "child page" has no information(nor should it)
about the structure of the base border page. That border page might
change at runtime and have a totally different structure. The only thing
that remains constant is that the content of child page is inserted,
i.e. it should be in the several insertion points.
regards,
Andrei.