Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » CDateTime Databinding
CDateTime Databinding [message #600065] Thu, 29 July 2010 08:06 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hello together,

i have a question for the CDateTime databinding. Why it doesn't work? What is the mistake? Model gets alwasys the value null
CDateTime cDateTime = new CDateTime(parent, CDT.BORDER | CDT.COMPACT | CDT.DROP_DOWN | CDT.DATE_LONG | CDT.TIME_MEDIUM);

DataBindingContext m_bindingContext = new DataBindingContext();

m_bindingContext.bindValue(new CDateTimeObservableValue(cDateTime), BeansObservables.observeValue(model, MyModel.PROP_BIRTHDAY),
null, null);

public class MyModel {
public static final String PROP_BIRTHDAY = "birthday";
private Date m_birthday;

public Date getBirthday(){
return m_birthday;
}

public void setBirthday(final Date newValue){
Date oldValue = getBirthday();
m_birthday = newValue;
m_propertyChangeSupport.firePropertyChange(PROP_BIRTHDAY, oldValue, newValue);
}
Re: CDateTime Databinding [message #600072 is a reply to message #600065] Thu, 29 July 2010 08:16 Go to previous message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Is this a bug??
The current Listener in CDateTimeObserverable is:

private SelectionListener listener = new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
if (!updating) {
Date newSelection = CDateTimeObservableValue.this.dateTime.getSelection();
fireValueChange(Diffs.createValueDiff(currentSelection, newSelection));
currentSelection = newSelection;
}
}
public void widgetSelected(SelectionEvent e) {
// skip
}


But the widgetDefaultSelected method is never called, if i switch the code, it works:


private SelectionListener listener = new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
//Skip
}
public void widgetSelected(SelectionEvent e) {
if (!updating) {
Date newSelection = CDateTimeObservableValue.this.dateTime.getSelection();
fireValueChange(Diffs.createValueDiff(currentSelection, newSelection));
currentSelection = newSelection;
}
}
};
Previous Topic:Scientific notation in formattedtext
Next Topic:migrating from Ganymede to Galileo
Goto Forum:
  


Current Time: Tue Apr 16 17:26:12 GMT 2024

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

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

Back to the top