[XWT] Update textfield value if context changed [message #645243] |
Thu, 16 December 2010 03:45  |
Eclipse User |
|
|
|
Hi guys,
if the underlying context of an UI Element changed, how get's the UI updated? I have following example:
Object context = XWT.findElementByName(e.widget, "Root");
Client clientModel = (Client)XWT.getDataContext(context);
clientModel.setName("Mr. Smith");
Text clientNameText= (Text) XWT.findElementByName(e.widget, "clientName");
//Something like clientNameText.refresh() ?
If I click a button, the code above gets executed. Is there a way which allows the binding to get automated updated? Calling
clientNameText.setText(clientModel.getName());
wouldn't be nice as the name is already bound to the textfield.
Thanks for any help!
Wolfgang
|
|
|
|
Re: [XWT] Update textfield value if context changed [message #645751 is a reply to message #645243] |
Mon, 20 December 2010 07:08  |
Eclipse User |
|
|
|
If your Java model has the support of Bean property change notification,
your code should work as it is. Otherwise, you need to do via Jface Data
Binding (see my comment below).
> clientModel.setName("Mr. Smith");
It should be replaced by:
IObservableValue observableValue = XWT.findObservableValue(context,
clientModel, "name");
observableValue.setValue("Mr. Smith");
Best regards
Yves YANG
|
|
|
Powered by
FUDForum. Page generated in 0.02671 seconds