Wednesday, November 3, 2010

How can I use a Widget to edit a CellTree node?

When the user edits a node of my CellTree, I want to inject a
composite widget into the tree at that point to handle the editing.

To experiment with this, I created the following custom TextArea sub-
class:

class MyTextArea extends TextArea {
public static MyTextArea addToElement(Element parent) {
MyTextArea textArea = new MyTextArea();
parent.appendChild(textArea.getElement());

textArea.onAttach();
RootPanel.detachOnWindowClose(textArea);

return textArea;
}
}

When the user clicks on a node in the tree, I create an instance of
MyTextArea as follows:

ta = MyTextArea.addToElement(parent);

Tragically, I'm getting the following error message: "A widget that
has an existing parent widget may not be added to the detach list"

I understand that when MyTextArea calls
parent.appendChild(textArea.getElement()), it attaches itself via a
chain of parent elements to the CellTree; and in doing so, it
disqualifies itself from registration in the 'detach list'.

Soooo...can you see a way to do what I'm trying to do?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment