A java.util.Date object may encapsulate a moment in time, but specifying it may take several steps as
a user sets each field individually. A java.util.Calendar object is a little closer to what we are used
to using in the real-world, and is therefore closer to how a Date is selected with the CDateTime widget.
Consider how a user may navigate a table with the cursor: selection moves between rows and/or cells until it reaches the one the user wants to activate, at which point they press (for example)
Likewise, a user may navigate past severals dates/times before reaching the one they are really
trying to select. When the user reaches this selection, they will indicate it by what I've called
a 'Full' selection, meaning that every field is being selected.
Different components of the CDateTime widget consider a 'Full' selection differently simply because users interact with them differently. A 'Full' selection notifies listeners via the widgetDefaultSelected interface and their occurence will be pointed out in the following text.
Depending upon the pattern, or format, set on the CDateTime widget, the textual selector allows the user to select any form of date and/or time.
|As plain as it gets||ooo, that's exciting||And a button!|
When the CDateTime gains focus by a means other than a mouse click (such as tabbing through
a form), its entire text area is selected. The intent is to allow it to be copied and has the
side affect that no field is actually selected, and thus the CDateTime cannot be
edited. When the CDateTime looses focus, by any means, all fields are unselected and again,
the CDateTime cannot be edited. Before editing, an individual field must be selected.
Field Selection via Mouse:
Field Selection via Keyboard:
Field Editing via Mouse:
Field Editing via Keyboard:
ENTERkey (like a normal SWT Text widget)
When the selection is set to null, the text shows a translatable string as shown below.
The biggest problem with a null value in a date/time selector is how go back to an actual value. This is because it cannot always be done in a single user action and the value of the selection could be left in an undefined state. CDateTime deals with this by simply holding on to the value of the selection before it was set to null, and restores it upon any user interaction. This way, there will be a value which is always valid and can be modified one field at a time; it is also the most relative value to start from rather than always resetting to the current date/time.
Opening the Drop Shell:
Cancellation:When the graphical selector is dropped, the current selection is saved.
The user is able to select a date (year, month, and day) by selecting a day on the calendar.
|Standard Calendar||Compact style Calendar|
Navigation via Mouse:
Navigation via Keyboard:
Full Selection via Mouse:
Full Selection via Keyboard:
The user is able to select a time (hour, minute, and second) by dragging the hands of the clock with the mouse.
|Digital Readout with Spinner||Compact, 24 Hour style with Spinner|
The user may also set the selection in other ways:
The Discrete Clock (held open for the screen-shot with
The 24 Hour style (Romanian Locale) Discrete Clock
Back to the top