hello,

after hours of researching and trying get a simple tree running iam completely 
frustrated.

i added a tree to the website in this way:

public class Test extends WebPage {

protected TreeModel createTreeModel() {
                List<Object> l1 = new ArrayList<Object>();
                l1.add("test 1.1");
....
}

public Test(final PageParameters parameters) {
        tree = new LinkTree("tree", createTreeModel()); 
        add(tree);
}
markup:

        <div wicket:id="tree" class="my-tree">  </div>  

now the problem: i am not able to fetch the selected node. iam not able to 
fetch the event...
i tried the following:

add(new LinkTree("tree") {                      
public void onClick(AjaxRequestTarget target) {                         
        System.out.println("Click");
        }
});
error: WicketMessage: Can't instantiate page using constructor public 
com.test.Test(org.apache.wicket.PageParameters) and argument 

what works is: to get an event from a link:

add(new AjaxLink("expandAll") {
@Override
public void onClick(AjaxRequestTarget target) {
        tree.getTreeState().expandAll();
        tree.updateTree(target);
        System.out.println("Click");
        }
});

the same must be possible with the tree?!

any help is appreciated...

cheers hubert



Reply via email to