Re: [Wicket-user] Flexible markup with same Java classes - autoAdd?
I was just wondering if another possible solution to this might be to somehow use autoAdd - ie., only add the components to the page class when requested based on the components in the markup. I'm not sure if the autoAdd is intended for this purpose or if it's a completely different beast altogether but the name sounds right ;) 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Flexible markup with same Java classes
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? I though of another idea of solving this problem but I am not sure if this is possible within the wicket page/component lifecycle model: After construction my WebPage derived class has NO components added to it. As the markup is processed components are added to the page on an 'as needed' basis. I'm not sure which method I would need to override in my page class, perhaps onComponentTag or onComponentTagBody? I just look at the tag's id, look up which component class that represents and then instantiate such and add it to the WebPage class then call super.onComponentTag() or super.onComponentTagBody(). Will there be any problems with adding components so late in the game? - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Flexible markup with same Java classes
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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Flexible markup with same Java classes
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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Flexible markup with same Java classes
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.phpp=sourceforgeCID=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.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Flexible markup with same Java classes
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. guess in your base webpage you should fill the header-div/span with a default WebMarkupContainer ( add(new WebMarkupContainer(header)); ); later in your subclasses you could replace the headersection with the appropriate panel: ... MyHeaderPanel hp = new MyHeaderPanel(header); this.replace(hp); ... - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Flexible markup with same Java classes
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 Yes that looks like an quicker and easier solution. The header is very cheap to construct. Thanks, I'll give it a try, Chris - 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.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user