org.jfree.ui

Class SerialDateChooserPanel

Implemented Interfaces:
ActionListener

public class SerialDateChooserPanel
extends JPanel
implements ActionListener

A panel that allows the user to select a date.

This class is incomplete and untested. You should not use it yet...

Author:
David Gilbert

Field Summary

static Color
DEFAULT_DATE_BUTTON_COLOR
The default background color for the selected date.
static Color
DEFAULT_MONTH_BUTTON_COLOR
The default background color for the current month.

Constructor Summary

SerialDateChooserPanel()
Constructs a new date chooser panel, using today's date as the initial selection.
SerialDateChooserPanel(SerialDate date, boolean controlPanel)
Constructs a new date chooser panel.
SerialDateChooserPanel(SerialDate date, boolean controlPanel, Color dateButtonColor, Color monthButtonColor)
Constructs a new date chooser panel.

Method Summary

void
actionPerformed(ActionEvent e)
Handles action-events from the date panel.
protected Color
getButtonColor(SerialDate targetDate)
Returns the button color according to the specified date.
SerialDate
getDate()
Returns the date selected in the panel.
protected SerialDate
getFirstVisibleDate()
Returns the first date that is visible in the grid.
protected void
refreshButtons()
Update the button labels and colors to reflect date selection.
void
setDate(SerialDate date)
Sets the date chosen in the panel.

Field Details

DEFAULT_DATE_BUTTON_COLOR

public static final Color DEFAULT_DATE_BUTTON_COLOR
The default background color for the selected date.

DEFAULT_MONTH_BUTTON_COLOR

public static final Color DEFAULT_MONTH_BUTTON_COLOR
The default background color for the current month.

Constructor Details

SerialDateChooserPanel

public SerialDateChooserPanel()
Constructs a new date chooser panel, using today's date as the initial selection.

SerialDateChooserPanel

public SerialDateChooserPanel(SerialDate date,
                              boolean controlPanel)
Constructs a new date chooser panel.
Parameters:
date - the date.
controlPanel - a flag that indicates whether or not the 'today' button should appear on the panel.

SerialDateChooserPanel

public SerialDateChooserPanel(SerialDate date,
                              boolean controlPanel,
                              Color dateButtonColor,
                              Color monthButtonColor)
Constructs a new date chooser panel.
Parameters:
date - the date.
controlPanel - the control panel.
dateButtonColor - the date button color.
monthButtonColor - the month button color.

Method Details

actionPerformed

public void actionPerformed(ActionEvent e)
Handles action-events from the date panel.
Parameters:
e - information about the event that occurred.

getButtonColor

protected Color getButtonColor(SerialDate targetDate)
Returns the button color according to the specified date.
Parameters:
targetDate - the target date.
Returns:
the button color.

getDate

public SerialDate getDate()
Returns the date selected in the panel.
Returns:
the selected date.

getFirstVisibleDate

protected SerialDate getFirstVisibleDate()
Returns the first date that is visible in the grid. This should always be in the month preceding the month of the selected date.
Returns:
the first visible date.

refreshButtons

protected void refreshButtons()
Update the button labels and colors to reflect date selection.

setDate

public void setDate(SerialDate date)
Sets the date chosen in the panel.
Parameters:
date - the new date.