it is saying that you are trying to replace a component that hasnt been added yet. you have to add a component before you can replace it, otherwise you are replacing nothing.

so in your code you need to do this:
if (get("detailMsg")==null) {
  add(new label("detailMsg"....))
} else {
  replace(new Label("detailMsg"...));
}


-Igor


On 11/2/05, Alex Chew <[EMAIL PROTECTED]> wrote:
I got the console output:
 
09:53:35,497 INFO  [STDOUT] wicket.WicketRuntimeException: Cannot replace a component which has not been added: id='detailMsg':
[Page class = wicket.examples.navtree.ContentPage, id = 1]
09:53:35,497 INFO  [STDOUT]  at wicket.MarkupContainer.replace(MarkupContainer.java:508)
09:53:35,497 INFO  [STDOUT]  at wicket.examples.navtree.MyTree.nodeLinkClicked(MyTree.java:83)
09:53:35,497 INFO  [STDOUT]  at wicket.markup.html.tree.Tree$5.onClick (Tree.java:716)
09:53:35,497 INFO  [STDOUT]  at wicket.markup.html.link.Link.onLinkClicked(Link.java:183)

 
On 11/3/05, Alex Chew <[EMAIL PROTECTED] > wrote:
 
I tried wicket 1.1, with same code fragment, i got RunTimeException:

wicket.WicketRuntimeException: The component(s) below failed to render:

1. [Component id = detailMsg, page = wicket.examples.navtree.ContentPage, path = 1:detailMsg.Label, isVisible = true, isVersioned = true]

    at wicket.Page.checkRendering(Page.java:993)
    at wicket.Page.doRender(Page.java:257)
    at wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:218)
    at wicket.RequestCycle.respond( RequestCycle.java:869)
    at wicket.RequestCycle.request(RequestCycle.java:421)
    at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:197)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java :697)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

and wicket show me the component tree of the page:
# Path Type Model Object
1    _body    wicket.markup.html.BodyOnLoadContainer       
2    detailMsg    wicket.markup.html.basic.Label    tree node link was clicked, user object: Node1.1   

   
It seems the model of Label detailMsg has been update, but Error occured while redering it.
I cannot find any tips from the  exception stack.
 

 
I used wicket1.0.2.
In my Application, i want to show a tree as navigator and detail message a=
s
body.It is a parellel layout, left panel is a treeview, right is content
view. What i want is show node name in right panel when i click a tree node=
.
Followed the example(1.0.2) , i used two Border-left and right. In method
nodeLinkClicked i used following code:

protected void nodeLinkClicked(DefaultMutableTreeNode node)
{
super.nodeLinkClicked(node);
Page p =3D this.getPage();
p.replace(new Label("detailMsg","tree node link was clicked, user object: "
+ node.getUserObject()));//NullPointerException
log.info("tree node link was clicked, user object: " + node.getUserObject
());
}
But i cannot replace the content in right border.
Thanks for your advice.

Reply via email to