if you look at the hierarchy of your message label it is like this:

in java:

page->message

in markup:

page->border->message

so when wicket tries to render message in the markup it cannot find it because it expects it to be in the border, but in fact you have added it to the page itself in extendpage.

so what you should do is either someting like this

ExtendPage() { getBorder().add(message); } to put it in the right place

or

BasPage() { add(new MyBorder("blah").setTransparentResolver(true); } this will tell wicket that the border is transparent - if component inside border cannot be found wicket should try to locate it in the border's parent

or use markup inheritance which is a much much better fit for this usecase

-Igor



On 5/19/06, Jerry Smith < [EMAIL PROTECTED]> wrote:

Sorry to send this again, I know you're all very busy trying to get the 1.2 release together, but I didn't want this to fall through the cracks if it is a bug.

 

I'm get a "WicketMessage: Unable to find component with id 'message'"

error. Maybe this can't be done or I'm doing it wrong using 1.2rc4, but what I'm working with is a MyBorder component, a BasePage, and ExtendPage.  Here's the distilled code bits:

 

MyBorder.html:

<wicket:border>

    <div wicket:id="header">[header]</div>

    <div>

        <wicket:body/>

    </div>

    <div wicket:id="footer">[footer]</div> </wicket:border>

 

MyBorder.java:

public class MyBorder extends Border {

    public MyBorder(String id) {

        super(id);

        add(new Label("header", new Model("Border Header")));

        add(new Label("footer", new Model("Border Footer")));

    }   

}

 

BasePage.html

<html>

    <body>

        <div wicket:id="border">

            <wicket:child/>

        </div>

    </body>

</html>

 

BasePage.java

public class BasePage extends WebPage {

    public BasePage() {

        add(new MyBorder("border"));

    }   

}

 

ExtendPage.html:

<wicket:extend>

    <span wicket:id="message">[message]</span>

</wicket:extend>

 

ExtendPage.java:

public class ExtendPage extends BasePage {

    public ExtendPage() {

        super();

        add(new Label("message", new Model("Extended message")));

    }   

}

 

Here's the error output minus stack:

<html>

    <head>

        <title></title>

    </head>

    <body>

        <div wicket:id="border">

            <wicket:child><wicket:extend>

    <span wicket:id="message">[message]</span>

</wicket:extend></wicket:child>

        </div>

    </body>

</html>

 

[Page class = ExtendPage, id = 4]:

#     Path                    Size        Type                                            Model Object

1    _<body>                 2.7K        wicket.markup.html.internal.HtmlBodyContainer             

2    _header                 473 bytes   wicket.markup.html.internal.HtmlHeaderContainer             

3    border                  1.3K        com.ses.wicket.components.test.x.MyBorder          

4    border:_child           485 bytes   wicket.markup.html.WebMarkupContainer       

5    border:_child:_extend   456 bytes   wicket.markup.html.WebMarkupContainer       

6    border:footer           456 bytes   wicket.markup.html.basic.Label                  Border Footer  

7    border:header           456 bytes   wicket.markup.html.basic.Label                  Border Header  

8    message                 460 bytes   wicket.markup.html.basic.Label                  Extended message

 

 

From this it looks like the "message" Label isn't being added to the correct component(border:_child:_extend?), am I doing something wrong, or is this a bug?

 

Thanks for any input!

 

-Jerry

 


Reply via email to