com::cosylab::gui::components::r2::DateChooser Class Reference

Collaboration diagram for com::cosylab::gui::components::r2::DateChooser:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

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 (

See also:
java.util.Calendar). GregorianCalendar class is used to calculate the dates. Since only the number of years is unlimited, it is set to 20 by default, allowing years 2000 through 2019 inclusively to be chosen. This can, however, be modified. Creation date: (2/4/02 9:53:10 AM)
Author:
:

Constructor & Destructor Documentation

com::cosylab::gui::components::r2::DateChooser::DateChooser (  )  [inline]

Member Function Documentation

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)

Returns:
java.awt.GridBagConstraints
Parameters:
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)

Returns:
java.util.Date

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)

Returns:
int

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)

Returns:
int

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)

Returns:
int

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)

Returns:
int

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)

Returns:
int

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]
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)

Parameters:
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)

Parameters:
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)

Parameters:
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)

Parameters:
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)

Parameters:
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)

Parameters:
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().


Member Data Documentation

Referenced by createComponents().

Referenced by createComponents().

Referenced by createComponents().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2