You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tauren Mills <ta...@tauren.com> on 2008/10/18 22:51:54 UTC
Component hierarchy in a subclass situation
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>
Re: Component hierarchy in a subclass situation
Posted by Tauren Mills <ta...@tauren.com>.
Thanks! That did the trick.
On Tue, Oct 21, 2008 at 10:50 AM, Igor Vaynberg <ig...@gmail.com>wrote:
> erm, override istransparentresolver() { return true; }
>
> -igor
>
> On Tue, Oct 21, 2008 at 10:43 AM, Tauren Mills <ta...@tauren.com> wrote:
>
> > Igor,
> >
> > Thanks for the help, but I'm not finding setTransparentResolver in
> > WebMarkupContainer. Should I be using a Border?
> >
> > Thanks,
> > Tauren
> >
> >
> > On Sat, Oct 18, 2008 at 1:55 PM, Igor Vaynberg <igor.vaynberg@gmail.com
> > >wrote:
> >
> > > WebMarkupContainer body = new
> > > WebMarkupContainer("pageStyle").setTransparentResolver(true);
> > >
> > > -igor
> > >
> > >
> > > On Sat, Oct 18, 2008 at 1:51 PM, Tauren Mills <ta...@tauren.com>
> wrote:
> > >
> > > > 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>
> > > >
> > >
> >
>
Re: Component hierarchy in a subclass situation
Posted by Igor Vaynberg <ig...@gmail.com>.
erm, override istransparentresolver() { return true; }
-igor
On Tue, Oct 21, 2008 at 10:43 AM, Tauren Mills <ta...@tauren.com> wrote:
> Igor,
>
> Thanks for the help, but I'm not finding setTransparentResolver in
> WebMarkupContainer. Should I be using a Border?
>
> Thanks,
> Tauren
>
>
> On Sat, Oct 18, 2008 at 1:55 PM, Igor Vaynberg <igor.vaynberg@gmail.com
> >wrote:
>
> > WebMarkupContainer body = new
> > WebMarkupContainer("pageStyle").setTransparentResolver(true);
> >
> > -igor
> >
> >
> > On Sat, Oct 18, 2008 at 1:51 PM, Tauren Mills <ta...@tauren.com> wrote:
> >
> > > 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>
> > >
> >
>
Re: Component hierarchy in a subclass situation
Posted by Tauren Mills <ta...@tauren.com>.
Igor,
Thanks for the help, but I'm not finding setTransparentResolver in
WebMarkupContainer. Should I be using a Border?
Thanks,
Tauren
On Sat, Oct 18, 2008 at 1:55 PM, Igor Vaynberg <ig...@gmail.com>wrote:
> WebMarkupContainer body = new
> WebMarkupContainer("pageStyle").setTransparentResolver(true);
>
> -igor
>
>
> On Sat, Oct 18, 2008 at 1:51 PM, Tauren Mills <ta...@tauren.com> wrote:
>
> > 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>
> >
>
Re: Component hierarchy in a subclass situation
Posted by Igor Vaynberg <ig...@gmail.com>.
WebMarkupContainer body = new
WebMarkupContainer("pageStyle").setTransparentResolver(true);
-igor
On Sat, Oct 18, 2008 at 1:51 PM, Tauren Mills <ta...@tauren.com> wrote:
> 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>
>