Well ok. I tried it this way: 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) { Label label = new Label("luname",node.toString()); label.setOutputMarkupId(true); page.addOrReplace(label); ConfirmPage page = (ConfirmPage)tree.getWebPage(); AjaxTabbedPanel tpanel = page.getTpanel(); MyPanel panel = (MyPanel)tpanel.get("panel"); Label label2 = new Label("test","TestText"); label2.setOutputMarkupId(true); panel.addOrReplace(label2); target.addComponent(label); target.addComponent(label2); } } It works so far, but is this really the right way? How do I access the MyPanel which is included in the AjaxTabbedPanel? I don't think that MyPanel panel = (MyPanel)tpanel.get("panel"); is the best way. Any suggestions? Fabian "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 15.08.2007 09:53 Bitte antworten an users@wicket.apache.org An users@wicket.apache.org Kopie Thema Re: updateing a component on AjaxTabbedPanel The ajax tabbed panel should be an instance variable. Then you can use target.addComponent(tabbedPanel). 2007/8/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]