Hi all,
I use jface databinding in a standalone SWT application.
The databinding famework works well with Texts, Combos and even radio buttons.
I know how to add Validator, use them to display ControlDecoration and even use UpdateValueStrategy.POLICY_CONVERT to update my model only when the user press the save button on my dialog.
But, I can't make it works with TableViewer. I try to have the same functionnalities on the viewer :
I want to :
- track adds
- track removes
- track changes on the objects in the input
- and update the model only when call to getBindingContext().updateModels();
With the code below, and can only track adds and removes. And this is done in real time (the model is updated instantly)
Code:
ViewerSupport.bind(peopleViewer, new WritableList(viewModel
.getPeople(), Person.class), BeanProperties.value(
Person.class, "name"));
Just for the test, I add a double click listener on the table viewer :
Code:
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent arg0) {
Person person =
(Person) ((IStructuredSelection) arg0.getSelection()).getFirstElement();
person.setName("new name");
}
});
The table is never refresh. (The call to tableViewer.refresh() doesn't work). "new name" is never displayed.
Do you have examples on how to do this ? I googled a lot and doesn't find what I want...
Thanks in advance
Fluminis