Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » [XWT] Update textfield value if context changed
[XWT] Update textfield value if context changed [message #645243] Thu, 16 December 2010 08:45 Go to next message
Wolfgang Herbst is currently offline Wolfgang HerbstFriend
Messages: 4
Registered: December 2010
Junior Member
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 #645474 is a reply to message #645243] Fri, 17 December 2010 11:15 Go to previous messageGo to next message
Wolfgang Herbst is currently offline Wolfgang HerbstFriend
Messages: 4
Registered: December 2010
Junior Member
Anyone? Is the requested functionality not available?

Thanks for replying!
Re: [XWT] Update textfield value if context changed [message #645751 is a reply to message #645243] Mon, 20 December 2010 12:08 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
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
Previous Topic:Running Dojo Demo
Next Topic:How to: XWT and Helios
Goto Forum:
  


Current Time: Sun Dec 21 01:52:39 GMT 2014

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

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