[Databinding] [message #19687] |
Thu, 09 July 2009 09:00 |
Eclipse User |
|
|
|
hello newsgroup,
i'm working on a rcp-project and want to use eclipse databinding.
i already implemented the update-function of my model if the value in the
gui-widget is changed.
how can a do the opposite way? i want to update the gui, if the model
changes.
my sample-View:
public void createPartControl(Composite parent) {
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
ScrolledForm form = toolkit.createScrolledForm(parent);
form.setText("Databinding-Test");
GridLayout layout = new GridLayout();
layout.numColumns = 2;
form.getBody().setLayout(layout);
// TestModel has an attribute "testValue" with a getter and a setter
(eclipse-generated)
final TestModel testModel = new TestModel();
Text testText = toolkit.createText(form.getBody(), "");
DataBindingContext context = new DataBindingContext();
context.bindValue(SWTObservables.observeText(testText, SWT.Modify),
PojoObservables.observeValue(testModel, "testValue"), null,
null);
...}
my test-code is:
Button button = toolkit.createButton(form.getBody(), "Test it!",
SWT.PUSH);
button.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
System.out.println("Button clicked");
testModel.setTestValue("newValue");
}
});
what is my mistake?
thanks,
fabian
|
|
|
Powered by
FUDForum. Page generated in 0.02862 seconds