
Classes | |
| class | DateChangeListener |
Public Member Functions | |
| DateChooser () | |
| Date | getDate () |
| int | getDay () |
| int | getMonth () |
| int | getNumberOfYears () |
| int | getStartingYear () |
| int | getYear () |
| void | setDate (Date date) |
| void | setDay (int index) |
| void | setEnabled (boolean how) |
| void | setNumberOfYears (int newNumberOfYears) |
| void | setStartingYear (int newStartingYear) |
| void | setYear (int index) |
Static Public Member Functions | |
| static void | main (String[] args) |
Protected Member Functions | |
| void | createComponents () |
| GridBagConstraints | createConstraints (int x, int y, double ratio, int top, int bottom) |
| void | displayDays () |
| void | setMonth (int index) |
Protected Attributes | |
| int | startingYear = 2000 |
| JComboBox | daySelector = null |
| JComboBox | monthSelector = null |
| JComboBox | yearSelector = null |
Private Member Functions | |
| void | updateComponents () |
Private Attributes | |
| int | numberOfYears = 20 |
| JLabel | dayLabel = null |
| JLabel | monthLabel = null |
| JLabel | yearLabel = null |
| Calendar | calendar = null |
This class provides user-friendly entry of dates. The components consists of three combo boxes containing year, month and day values. All values are validated and always display a valid date. This is then provided by getDate and setDate methods. When setting or getting the date from or to java.util.Date class, only YEAR, MONTH and DAY_OF_MONTH properties are set (
| com::cosylab::gui::components::r2::DateChooser::DateChooser | ( | ) | [inline] |
Creates a new DateChooser.
References calendar, createComponents(), daySelector, monthSelector, updateComponents(), and yearSelector.
Referenced by main().
| void com::cosylab::gui::components::r2::DateChooser::createComponents | ( | ) | [inline, protected] |
Creates and layouts the components that represent this panel. Creation date: (2/4/02 9:56:24 AM)
References createConstraints(), dayLabel, daySelector, monthLabel, monthSelector, numberOfYears, startingYear, yearLabel, and yearSelector.
Referenced by DateChooser().
| GridBagConstraints com::cosylab::gui::components::r2::DateChooser::createConstraints | ( | int | x, | |
| int | y, | |||
| double | ratio, | |||
| int | top, | |||
| int | bottom | |||
| ) | [inline, protected] |
Internal helper routine returns GridBagConstraints object.
Creation date: (2/4/02 9:57:12 AM)
| x | int | |
| y | int | |
| ratio | double |
Referenced by createComponents(), and main().
| void com::cosylab::gui::components::r2::DateChooser::displayDays | ( | ) | [inline, protected] |
Internal helper routine updates the correct number of days for the selected month.
Creation date: (2/4/02 10:37:59 AM)
References calendar, and daySelector.
Referenced by setMonth(), setYear(), and updateComponents().
| Date com::cosylab::gui::components::r2::DateChooser::getDate | ( | ) | [inline] |
Returns the currently selected date as java.util.Date. Creation date: (2/4/02 12:35:43 PM)
References calendar.
| int com::cosylab::gui::components::r2::DateChooser::getDay | ( | ) | [inline] |
Returns number of the selected day in current month, starting with 1. Creation date: (2/4/02 10:58:33 AM)
References calendar.
Referenced by com::cosylab::gui::components::r2::DateTimeChooser::getDate(), setDay(), and updateComponents().
| int com::cosylab::gui::components::r2::DateChooser::getMonth | ( | ) | [inline] |
Returns the index of the currently selected month starting with 1. Creation date: (2/4/02 10:56:46 AM)
References calendar.
Referenced by com::cosylab::gui::components::r2::DateTimeChooser::getDate(), setMonth(), and updateComponents().
| int com::cosylab::gui::components::r2::DateChooser::getNumberOfYears | ( | ) | [inline] |
Returns the number of year to display in the year selector.
Creation date: (2/10/2002 18:12:00)
References numberOfYears.
| int com::cosylab::gui::components::r2::DateChooser::getStartingYear | ( | ) | [inline] |
Returns the starting year to display in the year selector. No year lower than this can be selected by the user or set using setDate method.
Creation date: (2/10/2002 18:12:00)
References startingYear.
| int com::cosylab::gui::components::r2::DateChooser::getYear | ( | ) | [inline] |
Returns the currently selected year. Creation date: (2/4/02 10:57:25 AM)
References calendar.
Referenced by com::cosylab::gui::components::r2::DateTimeChooser::getDate(), setYear(), and updateComponents().
| static void com::cosylab::gui::components::r2::DateChooser::main | ( | String[] | args | ) | [inline, static] |
References createConstraints(), and DateChooser().
| void com::cosylab::gui::components::r2::DateChooser::setDate | ( | Date | date | ) | [inline] |
Sets the date to display. Creation date: (2/4/02 12:36:48 PM)
| date | java.util.Date |
References calendar, and updateComponents().
Referenced by com::cosylab::gui::components::r2::DateTimeChooser::setDate().
| void com::cosylab::gui::components::r2::DateChooser::setDay | ( | int | index | ) | [inline] |
Sets the day to the specified index. To ensure compatibility with java.util.Calendar class, first day of month is specified as 1. Creation date: (2/4/02 10:51:15 AM)
| index | int |
References calendar, daySelector, and getDay().
Referenced by com::cosylab::gui::components::r2::DateChooser::DateChangeListener::itemStateChanged().
| void com::cosylab::gui::components::r2::DateChooser::setEnabled | ( | boolean | how | ) | [inline] |
Sets the enabled state of this component. If the component is disabled, all the combo boxes are also disabled. Creation date: (2/5/02 5:23:59 PM)
| how | boolean |
References daySelector, monthSelector, and yearSelector.
Referenced by com::cosylab::gui::components::r2::DateTimeChooser::setEnabled().
| void com::cosylab::gui::components::r2::DateChooser::setMonth | ( | int | index | ) | [inline, protected] |
Sets the currently selected month. January has the index of 0. Creation date: (2/4/02 10:36:44 AM)
References calendar, displayDays(), and getMonth().
Referenced by com::cosylab::gui::components::r2::DateChooser::DateChangeListener::itemStateChanged().
| void com::cosylab::gui::components::r2::DateChooser::setNumberOfYears | ( | int | newNumberOfYears | ) | [inline] |
Sets the number of years to display in the year selector. User can only select the years shown in the year selector.
Creation date: (2/10/2002 18:19:55)
| newNumberOfYears | int |
References numberOfYears.
| void com::cosylab::gui::components::r2::DateChooser::setStartingYear | ( | int | newStartingYear | ) | [inline] |
Sets the starting year to be displayed in the year selector. Only the years between startingYear and startingYear+numberOfYears inclusively can be selected by the user or by calling the setDate method.
Creation date: (2/10/2002 18:19:55)
| newStartingYear | int |
References startingYear.
| void com::cosylab::gui::components::r2::DateChooser::setYear | ( | int | index | ) | [inline] |
Sets the currently selected year. Years are specified absolutely, although only years between startingYear and numberOfYears will be displayed. If the year is not within this range, the closest value will be set. Creation date: (2/4/02 11:22:21 AM)
| index | int |
References calendar, displayDays(), getYear(), numberOfYears, and startingYear.
Referenced by com::cosylab::gui::components::r2::DateChooser::DateChangeListener::itemStateChanged().
| void com::cosylab::gui::components::r2::DateChooser::updateComponents | ( | ) | [inline, private] |
Updates the display after setting the value properties. Creation date: (2/4/02 10:09:05 AM)
References daySelector, displayDays(), getDay(), getMonth(), getYear(), monthSelector, startingYear, and yearSelector.
Referenced by DateChooser(), and setDate().
Calendar com::cosylab::gui::components::r2::DateChooser::calendar = null [private] |
Referenced by DateChooser(), displayDays(), getDate(), getDay(), getMonth(), getYear(), setDate(), setDay(), setMonth(), and setYear().
JLabel com::cosylab::gui::components::r2::DateChooser::dayLabel = null [private] |
Referenced by createComponents().
JComboBox com::cosylab::gui::components::r2::DateChooser::daySelector = null [protected] |
JLabel com::cosylab::gui::components::r2::DateChooser::monthLabel = null [private] |
Referenced by createComponents().
JComboBox com::cosylab::gui::components::r2::DateChooser::monthSelector = null [protected] |
int com::cosylab::gui::components::r2::DateChooser::numberOfYears = 20 [private] |
Referenced by createComponents(), getNumberOfYears(), setNumberOfYears(), and setYear().
int com::cosylab::gui::components::r2::DateChooser::startingYear = 2000 [protected] |
JLabel com::cosylab::gui::components::r2::DateChooser::yearLabel = null [private] |
Referenced by createComponents().
JComboBox com::cosylab::gui::components::r2::DateChooser::yearSelector = null [protected] |
1.6.2