Problem with components in Table

Hello!

I have a problem with table. I have editable table with diffrent components such a combobox, textfield e.t.c. I add value change listener to all components in table field factory. And in value change listener I do the following:

table.getItem(firstItemId).getItemProperty("textField").setValue("1");

After first value change event an infinite loop occurs. What am I doing wrong ? Thanks.

Value Change listeneres are not just for changes the user performs.
They are for all changes to the property.

So, if you in your value change listener do do property.setValue, the value change listener is supposed to fire again.

One easy option to break the loop is to do:

if(!"1".equals(property.getValue()) {
  property.setValue("1");
};

Another is:

int ignoreCount;
public void valueChange(ValueChangeEvent event) {
    if(ignoreCount==0) {
  ignoreCount++;
  try {
  ...
  property.setValue("1");
  }
  finally {
  ignoreCount--;
  }
  }
}

Thanks a lot.