Tree and ValueChangeListener

Hi,

I try to add ValueChangeListener to my Tree, so I can have ValueChangeEvent.

code:


this.mainTree.addListener(new ValueChangeListener() {			
			@Override
			public void valueChange(ValueChangeEvent event) {
				initRightPanel();				
			}
		});

It says:

Multiple markers at this line
- The method addListener(Tree.ExpandListener) in the type Tree is not applicable for the arguments (new
ValueChangeListener(){})
- ValueChangeListener cannot be resolved to a type

So, How can I code so initRightPanel() will be called when mainTree.getValue() changed?

EDIT: I tried make Layout under tree to listen LayoutClickEvents.

mainLayout.addListener(new LayoutClickListener() {
			@Override
			public void layoutClick(LayoutClickEvent event) {
				initRightPanel();
			}
		});

But problem was that initRightPanel() was called before tree’s value changet so right panel was updated with old value.

tkok

Check that you have:
import com.vaadin.data.Property.ValueChangeListener;

thx, I was imported just com.vaadin.data.Property.ValueChangeEvent;
now works fine!