Hi there, 

i am very new to wicket an got some problems while using a tree and a 
AjaxTabbedPanel.

I want to update a simple label component at an AjaxTabbedPanel after the 
user click something at the tree.

Here is my code:
public class ConfirmPage extends WebPage{
public ConfirmPage()
        {
                super();
                //user is a simple POJO
                User user = new User("test","test");
 
                //Elements for the Tree
                List<ConsUnit> consUnits = new ArrayList<ConsUnit>();
                consUnits.add(new ConsUnit("Single"));
                consUnits.add(new ConsUnit("General"));
                consUnits.add(new ConsUnit());
 
                //simple label at the webpage
                label = new Label("luname",user.getUsername());
                add(label);

                //create the tree
                TreeModel tm = MyBaseTree.createTreeModel(consUnits);
                tree = new MyTree("tree",tm);
                        add(tree);
                        tree.getTreeState().collapseAll();
 

       //create the tabs like the sample app
        tabs.add(new AbstractTab(new Model("first tab"))
        {
            public Panel getPanel(String panelId)
            {
                return new MyPanel(panelId);
            }
        });
 
        tabs.add(new AbstractTab(new Model("second tab"))
        {
            public Panel getPanel(String panelId)
            {
                return new MyPanel2(panelId);
            }
        });
 
        tabs.add(new AbstractTab(new Model("third tab"))
        {
            public Panel getPanel(String panelId)
            {
                return new MyPanel3(panelId);
            }
        });
        tpanel = new AjaxTabbedPanel("tabs", tabs); 
        add(tpanel);
        add(new StyleSheetReference("pageCSS", getClass(), 
"css/style.css"));
}

Here is now the code from the tree:

public class MyTree extends LinkTree{

        public MyTree(String arg0, TreeModel arg1) {
                super(arg0, arg1);
        }
 
 
        protected void onNodeLinkClicked(javax.swing.tree.TreeNode node, 
BaseTree tree, AjaxRequestTarget target)
        {
 
                //update the label on ConfimPage
                Label label = new Label("luname",node.toString());
                label.setOutputMarkupId(true);
                page.addOrReplace(label);
                target.addComponent(label);

                //how to update AjaxTabbedPanel???
        }
}

Here the code from MyPanel:

public class MyPanel extends Panel{
 
        private Label label;
 
        public MyPanel(String id) {
                super(id);
 
                label = new Label("test", "Text");
                label.setOutputMarkupId(true);
                this.add(label);
 
        } 
}

The label at ConfirmPage is updated via Ajax if the user selects something 
from the tree, but not the label at the AjaxTabbedPanel.
If the user selects something from the tree the label at MyPanel should be 
updated with the value of the tree node.
How do i do this?

With kind regards
Fabian Hagen

S&N AG
Klingenderstr. 5
D 33100 Paderborn

voice     +49 5251/1581- 862
fax       +49 5251/1581-71
eMail     [EMAIL PROTECTED]
web       http://www.s-und-n.de

Vorstand
Klaus Beverungen
Josef Tillmann 

Vorsitzender des Aufsichtsrates
Heinz-Dieter Wendorff

Handelsregister
Amtsgericht Paderborn HRB 3270 

Reply via email to