开发者

SWT DataBinding for DateTime

开发者 https://www.devze.com 2023-03-17 21:42 出处:网络
I want to display a java.util.Date using two DateTime controls - one displaying the date and one the time.

I want to display a java.util.Date using two DateTime controls - one displaying the date and one the time.

I try to use databinding here to set the values entered in the controls. I try to bind the controls to the date as follows:

IObservableValue getPostponeDateDayObserveValue = SWTObservables.observeSelection(getPostponeDate());
IObservableValue getPostponeTargetDateDateObserveValue = PojoObservables.observeValue(this, "postponeTargetDate");
bindingContext.bindValue(getPostponeDateDayObserveValue, getPostponeTargetDateDateObserveValue, null, null);
    //
IObservableValue getPostponeTimeSecondsObserveValue = SWTObservables.observeSelection(getPostponeTime());
IObservableValue postponeTargetDateSecondsObserveValue = PojoObservables.observeValue(this, "postponeTargetDate");
bindingContext.bindValue(getPostponeTimeSecondsObserveValue, postponeTargetDateSecondsObserveValue, nul开发者_开发知识库l, null);

What happens here is that the date corries the correct date or the correct time depending on which control was changed later. Is there a possibility to bind two datetime controls (one for date one for time) to the same date.

Thanks for your support.


just overlooked the class that helps here: DateAndTimeObservableValue

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号