Hello ,
I had exactly the same problem , and solved by searching to this post.
Thanks a lot.
BUT , today , I have another problem...
Today , the ChildPanel can accept a new parameter : boolean defaultVisible
if true , the content will be shown;
if false , the content will be invisible , only the title bar is visible.
The title bar is defined in ParentPanel , containing a title label and a
"expand/collapse" ajax link (a toggle).
Here comes the problem.
In the ChildPanel , if I write :
setVisible(defaultVisible);
and if the defaultVisible is false , the whole panel , including ParentPanel
(including title bar) will be invisible;
This makes users unable to make it re-appear.
However , if I write code like this :
get("content").setVisible(defaultVisible);
("content" is the WebMarkupContainer defined in ParentPanel returning
isTransparentResolver() TRUE)
It will throw WicketRuntimeException while
org.apache.wicket.Page.checkRendering
org.apache.wicket.WicketRuntimeException: The component(s) below failed to
render. A common problem is that you have added a component in code but
forgot to reference it in the markup (thus the component will never be
rendered).
How to solve it ?
2008/4/6 Martijn Dashorst <[EMAIL PROTECTED]>:
> You should do this:
>
> WMC wmc = new WMC("childContainer") {
> @override boolean isTransparentResolver() { return true; }
> };
>
> This is not a bug. If you do add() in the subclass's constructor, you
> add to the page itself. Which is how the hierarchy is constructed. By
> telling the WMC that it is a transparent resolver, you tell it to look
> for children without attached markup in its siblings.
>
> Martijn
>
> On 4/5/08, Oliver Sawade <[EMAIL PROTECTED]> wrote:
> > Hi everyone,
> > my first mail to the list, i hope this wasn`t answered million times
> > before, but the wicket users faq is empty so i couldn`t find it there ;)
> >
> > I'm using wicket1.3 to create a generic panel with the option to hide
> > everything inside when clicking an ajax-button. While the actual
> > hiding&showing works fine I'm having trouble with inheritance.
> > This example should show what I mean:
> >
> > This is my generic super panel (no ajax stuff in it here to show the
> > essential problem). The idea is, that the childContainer is set to
> > Visible:false when the button is clicked. All of this should happen in
> the
> > super class, so i don't have to care about it in the child class:
> >
> > public class testSuperPanel extends Panel {
> > public testSuperPanel(String id) {
> > super(id);
> > add(new WebMarkupContainer("childContainer"));
> > }
> > }
> >
> > The markup for testSuperPanel:
> > <wicket:panel>
> > <div wicket:id="childContainer">
> > <wicket:child/>
> > </div>
> > </wicket:panel>
> >
> > This is a sample child panel:
> >
> > public class testChildPanel extends testSuperPanel {
> > public testChildPanel(String id) {
> > super(id);
> > add(new Label("childLabel","Test!"));
> > }
> > }
> >
> > and the Markup:
> > <wicket:extend>
> > <span wicket:id="childLabel"></span>
> > </wicket:extend>
> >
> > As you see, it should simply display "Test" inside a MarkupContainer
> (which
> > could be hidden from the superClass). When i try to display this Panel
> > however I get an Exception stating that no code is added for the Label
> > "childLabel"!
> > This can be solved by adding the childLabel to the container in the
> > superClass, but thats obviously not the way it is meant to be:
> >
> > public class testSuperPanel extends Panel {
> > public testSuperPanel(String id) {
> > super(id);
> > WebMarkupContainer wmc = new
> > WebMarkupContainer("childContainer");
> > wmc.add(new Label("childLabel","Test!"));
> > add(wmc);
> > }
> > }
> >
> > So, is this a wicket bug with inheritance inside containers or am I just
> > doing things the wrong way?
> >
> > Thanks for your help!
> > best regards, Oli
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.2 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>