日期时间的 SWT 数据绑定
我想使用两个 DateTime
控件显示一个 java.util.Date
- 一个显示日期,一个显示时间。
我尝试在此处使用数据绑定来设置在控件中输入的值。我尝试将控件绑定到日期,如下所示:
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, null, null);
这里发生的情况是,日期与正确的日期或正确的时间相关,具体取决于稍后更改的控件。是否可以将两个日期时间控件(一个用于日期,一个用于时间)绑定到同一日期。
感谢您的支持。
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, null, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是忽略了这里有帮助的课程:
相对于="nofollow">日期和时间ObservableValue
just overlooked the class that helps here:
DateAndTimeObservableValue