I'm looking for advice on how to deal with the component hierarchy below.
I'm getting a MarkupException and think that the problem is that the "body"
defined in base page is a sibling of content, header, and footer instead of
their parent. Content, header, and footer should be children of body.
Any suggestions on a clean way to add them as children? I could define body
as a property and then in HomePage do getBody().add(new HomePanel("content")
or some such, but is there a better way to do this? I suppose I could pull
the body into the HomePage as well.
I'm working on a site that has different color schemes for different
sections. So my thought was to add a CSS class to the body so that I can
use CSS selectors to specify colors based on which pageStyle the page is set
to use. There are only a few color changes necessary, so I wanted to keep
it all in one CSS file instead of adding wicket:head to each page with
customizations on a per page basis.
I'd appreciate any suggestions on nice clean solutions to this, or even
ideas on completely different approaches to this problem.
Thanks!
Tauren
BasePage
--------
private void init() {
WebMarkupContainer body = new WebMarkupContainer("pageStyle");
body.add(new SimpleAttributeModifier("class",getPageStyle()));
add(body);
}
<body wicket:id="pageStyle">
<wicket:child />
</body>
HomePage extends BasePage
-------------------------
public void init() {
add(new HomePanel("content"));
add(new HeaderPanel("header"));
add(new FooterPanel("footer"));
}
<wicket:extend>
<div wicket:id="header"></div>
<div id="doc4" class="yui-t5">
<div wicket:id="content"></div>
</div>
<div wicket:id="footer"></div>
</wicket:extend>