>
>Can you give some code fragments?
>
>Eelco

On HomePage there are two divs, with tree and panel.

HomePage.html
...
<div id="wrapper">
  <div id="content">
    show clicked node
  </div>
</div>
<div id="navigation">
   tree
</div>
...

HomePage.java
public class HomePage extends WebPage {

        private static final long serialVersionUID = 5775904098165685837L;

        private Tree tree;
        private Panel testPanel;
        TestPanelBean tpb;

        public HomePage() {

                add(HeaderContributor.forCss("/css/netport.css"));

                // testPanel
                tpb = new TestPanelBean("---");
                
                testPanel = new TestPanel("testpanel", tpb);
                testPanel.setOutputMarkupId(true);
                add(testPanel);

                

                tree = new Tree("tree", createTreeModel()) {

                        protected String renderNode(TreeNode node) {
                                ModelBean bean = (ModelBean) 
((DefaultMutableTreeNode)
node).getUserObject();
                                return bean.getProperty1();
                        }

                        protected void onNodeLinkClicked(AjaxRequestTarget 
target, TreeNode node)
{
                                super.onNodeLinkClicked(target, node);

                                ModelBean mtn = (ModelBean) 
((DefaultMutableTreeNode)
node).getUserObject();
                                updatePanel("Node: " + mtn.getProperty1() + " 
:clicked");
                                
                                
                                target.addComponent(tree);
                                target.addComponent(testPanel);
                        }

                }; // end new TreeTable

                tree.getTreeState().setAllowSelectMultiple(false);
                //tree.setLinkType(LinkType.AJAX);
                add(tree);
                tree.getTreeState().collapseAll();

        }

        private void updatePanel(String txt) {
                tpb.setNodeName(txt);
                //remove(testPanel);
                //testPanel = new TestPanel("testpanel", tpb);
                //testPanel.setOutputMarkupId(true);
                //add(testPanel);
        }

        protected TreeModel createTreeModel() {
        ...
        // code copied from examples
               ...
        }

}


For Tree I've used code and model from SimpleTree from ajax examples.
For Panel I have ths code:

TestPanel.java
public class TestPanel extends Panel {
        public TestPanel(String id, TestPanelBean tpb) {
                super(id);
                add(new Label("text", tpb.getNodeName()));
        }
}

TestPanel.html
<html> 
<body>
        <wicket:panel>          
        Text:<div wicket:id="text">--node--</div>
        </wicket:panel>
</body>
</html>

TestPaneBean.java (which holds text to be displayed in TestPanel)
public class TestPanelBean {
        private String nodeName;

        public TestPanelBean(String nodeName) {
                this.nodeName = nodeName;
        }

        public String getNodeName() {
                return nodeName;
        }

        public void setNodeName(String nodeName) {
                this.nodeName = nodeName;
        }
}


So, even a set:
target.addComponent(testPanel);
testPanel is not refreshed. :(

For now, I want to display node name in the panel. In the future, I'll like
to instantiate different panel components regarding to clicked tree node
type (if node represents image, show that image information and so on).


-- 
View this message in context: 
http://www.nabble.com/Tree-and-Panel---refresh-problem-%281.3b1%29-tf3858753.html#a10940029
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to