I have a problem with LinkTree in Wicket, namely : 
I have a LinkTree where NodeComponent a TreeLinkIconPanel is.
TreeLinkIconPanel is a subclass of LinkIconPanel.

public TreeLinkIconPanel(String id, IModel model, BaseTree tree) {
        super(id, model, tree);
}

Where a content as a label and image as a normal Icon:

protected Component newContentComponent(String componentId, BaseTree tree,
                        IModel model) {
        ...
        if (model.getObject() instanceof ProcessNode) {
              lLabel = new Label(componentId, ((ProcessNode) model.getObject())
                                        .getName());
        }
        ...
        return lLabel;
}

@Override
protected Component newImageComponent(String componentId, BaseTree tree,
                        IModel model) {
        Image lImage=(Image)super.newImageComponent(componentId, tree, model);
        if (model.getObject() instanceof ProcessNode) {
                lImage = new Image(componentId,((ProcessNode)model.getObject   
                              ()).getState());
        }
        ...
        return lImage;
        }


The model is not updated, when the Tree to AjaxRequestTarget added.
And when ClickEven must this tree, in my case image the tree's, refresh
But what is not done:

protected void onNodeLinkClicked(TreeNode node, BaseTree tree,
                        AjaxRequestTarget target) {
        super.onNodeLinkClicked(node, tree, target);
        if (node instanceof ProcessNode) {
                ((ProcessNode)node).setStateGreen();
                fireProcessClickEvent(target);
        } else if (node instanceof ActivityNode) {
                ((ActivityNode)node).setStateYellow();
                fireActivityClickEvent(((ActivityNode) node).getName(), 
                        target);
        }
}

Here, this event is received:

tree.addTreeListener(new TreeListener() {

        @Override
        public void onActivityClicked(String nameOfNode,AjaxRequestTarget 
                                                        target){
                ...
                target.addComponent(tree);
        }
        @Override
        public void onProcessClicked(AjaxRequestTarget target) {
                ... 
                target.addComponent(tree);
        }

});


But if I befor the tree, the new model set, then it works:

tree.addTreeListener(new TreeListener() {

        @Override
        public void onActivityClicked(String nameOfNode,AjaxRequestTarget 
                                                        target){
                ...
                tree.setModel(new Model((Serializable) new DefaultTreeModel
                                                  (processNode)));
                target.addComponent(tree);
        }
        @Override
        public void onProcessClicked(AjaxRequestTarget target) {
                ... 
                tree.setModel(new Model((Serializable) new DefaultTreeModel
                                                  (processNode)));
                target.addComponent(tree);
        }

});
It is of course not as nice and not so expected. 
If someone can help me - that would be very nice. 
Thanks in advance.
Elena




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to