Tuesday, January 8, 2013

How to add ValueChangeHandler to Tree?

Hi,

as far as I can see a GWT Tree has no ValueChangeHandler by default (for modifying elements in the tree).
Therefore I'm trying to extend the Tree and add a ValueChangeHandlermy myself. But it never get's called:

class MyTree extends Tree implements ValueChangeHandler<String> {

    //never gets called
    @Override
    public void onValueChange(ValueChangeEvent<String> event) {
        System.out.println("value changed");
    }
}


What's wrong here?

I'm changing the trees' content with:
@UiBinder
TextBox box;


@UiBinder
Button save;

@UiHandler("save") {
void onSave(ClickEvent evt) {
  tree.getSelectedItem().setText(box.getText());
}


From debugging I can see that the value in the tree items is already changed by this! But it is not reflected in the tree in GUI. So I probably have to write something in the onChangeHandler to update the tree visually.
But as I said, onValueChange never gets called...

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/BCnqEs-BkRUJ.
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