Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [Databinding]
[Databinding] [message #19687] Thu, 09 July 2009 13:00
Fabian M. is currently offline Fabian M.Friend
Messages: 4
Registered: July 2009
Junior Member
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
Previous Topic:TextCellEditor variant supporting different fonts/colors?
Next Topic:[Databinding] update widget if model changes?
Goto Forum:
  


Current Time: Thu Apr 25 09:25:36 GMT 2024

Powered by FUDForum. Page generated in 0.02842 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top