Style: NONE (GTK shown) |
Style: DROP_DOWN (Win32 shown) |
Description
The CDatepickerCombo is a textual version of a date selection widget which can display both dates and times in many different formats, patterns, and locales. It is also able to set a CDatepicker as its drop component so that the date and time may be selected graphically.top
I18N
The CDatepickerCombo makes full use of Java's Locale object throughout, allowing it to be set via the constructor or a setter method at runtime. Locale can be changed any number of times and will automatically update the locale of the corresponding CDatepicker, if there is one.An area of concern is BIDI languages, though the project has little means of testing them. If you are someone who can assist with this, please file a Feature Request.
top
Date Formats and Patterns
The CDatepickerCombo uses Java's abstract class, DateFormat, to maintain the format of its text and assist in navigation of its fields. Because of this, any Formatting object that can be assigned to a DateFormat can be used:- DateFormat.getDateInstance of all styles
- DateFormat.getDateTimeInstance of all styles
- DateFormat.getTimeInstance of all styles
- SimpleDateFormat
setFormat(ACW.DATE_SHORT)
or as complex as setFormat("'Meeting on' EEEE, MMMM d '@' h:mm 'in the'a")
. In
both instances CDatepickerCombo will navigate through, and allow editing of, each text region
which relates to a Calendar Field.top
Text Operation
When the CDatepicker 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 CDatepickerCombo cannot be edited. When the CDatepicker looses focus, by any means, all fields are unselected and again, the CDatepickerCombo cannot be edited. Before editing, an individual field must be selected.Fortunately, though, it is pretty intuitive: simply select the field to be edited by clicking on it with the mouse.
Once the CDatepicker has focus, there are also many other ways of moving between fields:
- Clicking the center mouse button will cycle through the fields
- The left and right arrow keys move one field at time
- Typing the first character of the next separation sequence will move to the next field.
For example, given the pattern "MM/dd/yy", pressing the '/' key will move to the next field.
Likewise, given the pattern "MM'long separation sequence'dd'another long sequence'yy", typing 'l' when on the "MM" field will move to the "dd" field, and then typing 'a' will move to the last field. - If the user is entering the field's value via the keyboard and the maximum number of digits for that field have been typed, selection is automatically moved to the next field.
- A Spinner, which will be present if the CDatepickerCombo is not of DROP_DOWN style, can be used to increment and decrement the field's value
- Scrolling with the mouse wheel will increase and decrease the field
- The Up and Down arrow keys will increment and decrement the field
- The "+" and "-" keys will increment and decrement the field
- The "=" key will increment the field (i18n problem?)
- Enter the value directly with the keyboard
Drop Operation
When the user selects the "drop button" a CDatepicker will be dropped to allow graphical editing of the date and / or time, as appropriate for its format. This CDatepicker works exactly as it does on its own (refer to CDatepicker) with the exception that it will be operating in a "Combo" mode, and will thus have two extra buttons - an Accept Button, and a Cancel Button - in the upper right:
CDatepickerCombo with Clock dropped (Win32 shown)
top
Developer API
View the full JavaDocThe CDatepickerCombo has the following public constructors:
CDatepickerCombo(Composite parent, int style)
CDatepickerCombo(Composite parent, int style, Date date)
CDatepickerCombo(Composite parent, int style, Date date, Locale locale)
CDatepickerCombo(Composite parent, int style, Locale locale)
void addSelectionListener(SelectionListener listener);
Locale[] getAvailableLocales()
CDatepicker getCDatepicker()
int getFormat()
String getFormatPattern()
Locale getLocale()
Date getSelection()
void popUp(boolean pop)
void removeSelectionListener(SelectionListener listener)
void setFormat(int format)
void setFormat(String pattern)
void setLocale(Locale locale)
void setSelection(Date date)
Road Map
Current Priorities:- Stability
- Additional Features:
- Time Zones
- Select a Timespan: "from 6/3/06 at 10:30 to 6/4/06 at 11:30"
- Select a Duration or Interval: "One Hour"
- Allow multiple styles - date selection and interval selection
eg: "Meet at 10:30 for One Hour" - Allow different drop components, such as a CCalendar