Are you using the GWT default TreeItem? If so, when you add the node, you could add the TreeItem
with a Widget
which you write which contains a TextBox
and a Button
to save.
When the save button is clicked, it calls setText()
on the tree item with the text box's text, thus removing the widgets from the tree item.
It may be an even better idea to subclass TreeItem
to encapsulate this logic and provide more functionality.
edit: Here, just because I'm feeling generous...
public class EditableTreeItem extends TreeItem {
public EditableTreeItem() {
super();
TextBox textBox = new TextBox();
Button saveButton = new Button("Save");
saveButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent e) {
if (!textBox.getText().isEmpty()) {
EditableTreeItem.this.setText(textBox.getText());
}
}
});
}
}