CDateTime Databinding [message #600065] |
Thu, 29 July 2010 04:06  |
Eclipse User |
|
|
|
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 04:16  |
Eclipse User |
|
|
|
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;
}
}
};
|
|
|
Powered by
FUDForum. Page generated in 0.88198 seconds