[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: how to use databinding to bind dynamic data

WritableValue v = new WritableValue(Contact.class);
BeansObservable.observeDetailValue(v,"name");

v.setValue(new Contact());

So in fact this is a master-detail problem :-)

Tom

hao schrieb:
Let me explain what I am trying to ask:

For example, I have a model called Contact which has a name attribute. The name field of the Contact is binded to a GUI text field called nameText. When the GUI class is constructed, the following is called:

private Contact contact;
private Text nameText;
private DataBindingContext bindingContext;

...
//In constructor

IObservableValue contactNameObserveValue = BeansObservables.observeValue(contact, "name");
IObservableValue nameTextTextObserveWidget = SWTObservables.observeText(nameText, SWT.Modify);
bindingContext.bindValue(nameTextTextObserveWidget, contactNameObserveValue, null, null);



For some reason, during the operation of the application, the contact object is replaced with a new contact object. (Not the property name of the contact object is changed but contact object itself is changed.) How could I rebind the newly created contact object to nameText object?


thanks!





--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl                                          JFace-Committer
--------------------------------------------------------------------