links.add(new AjaxLink("addTopLevel") {
@Override
public void onClick(AjaxRequestTarget target) {
MenuTreeNode parent = (MenuTreeNode) treeModel.getRoot();
ChildEntry entry = new ChildEntry(parent.getEntry());
entry.setTitle(getString("newEntry"));
parent.getEntry().getChildren().add(entry);
MenuTreeNode node = new MenuTreeNode(entry);
treeModel.nodeInserted(tree, parent, node);
tree.getTreeState().selectNode(node, true);
tree.updateTree();
}
});
links.add(new AjaxLink("add") {
@Override
public void onClick(AjaxRequestTarget target) {
ChildEntry entry = new ChildEntry(getSelected().getEntry());
entry.setTitle(getString("newEntry"));
getSelected().getEntry().getChildren().add(entry);
MenuTreeNode node = new MenuTreeNode(entry);
treeModel.nodeInserted(tree, getSelected(), node);
tree.getTreeState().selectNode(node, true);
tree.updateTree();