or even

mypage() { add(new HeaderPanel("header") { public boolean isvisible() {
return !MyPage.this.getVariation().contains("noheader"); }}

if the header panel is pretty cheap to construct

-igor


On 3/26/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:

so you want to keep the same page class, and solely control this from
markup? you have to research the api for getting the markup and then search
it for an attribute or whatever marker you set, but if you dont mind
controlling this via the variation string itself something like this might
work:

class mypage extends webpage {

private boolean headeradded=false;

public void onAttach() {
   super.onAttach();
   if (headeradded==false) {
     if (getVariation().contains("noheader")) {
         add(new WebMarkupContainer("header"));
     } else { add(new HeaderPanel("header")); }
     headeradded=true;
     }
}

-igor

On 3/26/07, Chris Colman <[EMAIL PROTECTED]> wrote:
>
> Let's say I've created a Layout and corresponding Java classes for the
> following page
>
> ------------------
> | Header         |
> ------------------
> |      |         |
> | Menu | Content |
> |      |         |
> ------------------
> | Footer         |
> ------------------
>
> Each section is implemented by a separate wicket Panel derived class in
> Java. The page itself is implemented by a derivative of wicket's WebPage
>
> class in the usual manner.
>
> Now I use variations and so I can have lots of different markup for the
> single set of classes detailed above.
>
> I want to be able to have the flexibility to leave the header out in
> certain markup variations without wicket generating an error because the
> page tries to add the header component.
>
> Is there a way to create the markup so I can do this without explicitly
> telling the Page not to load the header component?
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to