Hi,
I have a LinkTree on a page, that page also contains a panel. First time
the page will be loaded with an empty panel. But if user clicks on link,
then i wanted to replace the empty panel with a new panel. but it seems
like its not working. Below is the part of my code-
1. public ListContractsPage() {
2. add(prepareTree());
3. add(new
EmptyPanel("detailsPanel","").setOutputMarkupId(true));
4. }
5. private BaseTree prepareTree() {
6. DefaultMutableTreeNode rootNode = new
DefaultMutableTreeNode("Contracts");
7. TreeModel treeModel = new DefaultTreeModel(rootNode);
8. assembleContracts(rootNode);
9. final LinkTree linkTree=new LinkTree("tree", treeModel){
10. @Override
11. protected void onNodeLinkClicked(Object node, BaseTree
tree, AjaxRequestTarget target) {
12. Object userObject = ((DefaultMutableTreeNode)
node).getUserObject();
13. Panel targetPanel;
14. if (userObject instanceof ServiceHandle) {
15. targetPanel = new
ServiceDetailsPanel<ServiceHandle>("detailsPanel", (ServiceHandle)
userObject);
16. } else if (userObject instanceof ContractHandle) {
17. targetPanel = new
ContractDetailsPanel<ContractHandle>("detailsPanel",
(ContractHandle) userObject);
18. } else {
19. throw new AssertionError("Expected: master,
sub or service handle, but found: " +
userObject.getClass().getSimpleName());
20. }
21. targetPanel.setOutputMarkupId(true);
22. target.addComponent(targetPanel);
23. }
24. };
25. return linkTree;
26. }
27.
The panel which is added on line3, will be replaced by line15 or line17.
But it seems like its not replacing. I actually debugged, and the
control reaches over there and executes upto line22. But the new panel
was never rendered on browser.
I am using wicket 1.4.2.
Anyone have any idea why new panels are not rendered?
Thanks in advance.
Jahid