You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pratibha <pr...@gmail.com> on 2010/06/03 14:01:34 UTC
LinkTree and panel
Hi Team
I have got a LinkTree, I am overriding newContentComponent of LinkTree with
Panel, what i need is When user
clicks on Link a TextBox underneath Link should get Visible using Ajax.
Please find below code for the above.
treeModel = createTreeModel();
tree = new LinkTree("tree", treeModel) {
@Override
protected Component newNodeComponent(String
id, IModel model) {
return new LinkIconPanel(id, model,
this) {
@Override
protected void
onNodeLinkClicked(TreeNode node, BaseTree tree, AjaxRequestTarget target) {
System.out.println("onNodeLinkClicked");
}
@Override
protected Component
newContentComponent(String componentId, BaseTree tree, IModel model) {
Department item =
(Department) ((DefaultMutableTreeNode) model.getObject()).getUserObject();
//return new
Label(componentId, new Model(item.getName()));
return new
MyPanel(componentId, new Model(item.getName())).setOutputMarkupId(true);
}
};
}
};
add(tree);
And MYPanel is-------------
public class MyPanelForm extends Form {
private static final long serialVersionUID = 1L;
MyPanelForm(String id) {
super(id);
setOutputMarkupId(true);
txt = new TextField("txtname",new
PropertyModel(department, "name"));
txt.setOutputMarkupId(true);
add(txt);
txt.setVisible(false);
add(new AjaxLink("name") {
@Override
public void onClick(AjaxRequestTarget
target) {
txt.setOutputMarkupId(true);
txt.setVisible(true);
target.addComponent(txt);
}
}.add(new Label("cname",name)));
}
}
Thanks
Prati
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/LinkTree-and-panel-tp2241551p2241551.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org