Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Data binding of dates and times(Are dates and times (DateTime control, Calendar class) included in the data binding framework?)
icon5.gif  Data binding of dates and times [message #1181425] Mon, 11 November 2013 15:47 Go to next message
Baruch Youssin is currently offline Baruch YoussinFriend
Messages: 29
Registered: April 2013
Junior Member
I have the impression that even though there is an SWT control DateTime and a Java class Calendar that represent dates and times, they have not yet been included in the data binding framework.

Am I missing something?
Re: Data binding of dates and times [message #1231261 is a reply to message #1181425] Tue, 14 January 2014 07:52 Go to previous message
Baruch Youssin is currently offline Baruch YoussinFriend
Messages: 29
Registered: April 2013
Junior Member
I have found an answer myself.
The DateTime control has selection property which is of type Date and can be bound to a bean property of type Date.
(Date is a type that is used just as a wrapper for the time indicated as the number of milliseconds, see http://docs.oracle.com/javase/7/docs/api/java/util/Date.html )
This binding can be done through the Bindings tab as usual.
It works!

(However, the JFace Automatic Databinding feature of WindowBuilder does not offer to bind a bean property of Date type to a DateTime control; it offers to bind it only to a Text control.
If you want to use JFace Automatic Databinding first to create a composite with bindings to other bean properties and after that add your DateTime controls to bind them to your Date properties, you may run into a WindowBuilder bug (or a weird feature?) if you ask JFace Automatic Databinding to create a Controller class for you, as follows.
Adding a DateTime control from Palette places its constructor in the code after the constructor of the Controller class that does the databinding. As the result, the latter constructor attempts to bind the DateTime control while it is still null, and fails. You can fix it by interchanging the constructors manually.)

[Updated on: Tue, 14 January 2014 07:53]

Report message to a moderator

Previous Topic:NPE at editor opening from toolbar
Next Topic:ScrolledForm Layout Problem
Goto Forum:
  


Current Time: Thu Nov 27 16:35:01 GMT 2014

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

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