This panel is designed to be used in a JDialog in a modal session; show the panel, then call getReturnCode() to see if the user clicked OK, and if so call getDate() to get the date the user chose.
Public Member Functions | |
ChooseDueDatePanel () | |
Constructs a new DueDatePanel with its initially selected date set to the current date and time. | |
ChooseDueDatePanel (Task t) | |
Constructs a new DueDatePanel with its initially selected date set to the due date of the given task, or the current date and time if the task has no due date. | |
Calendar | getDate () |
Returns the date the user chose from the panel, or null if they selected the "no due date" radio button. | |
JButton | getOKButton () |
Returns the OK button. | |
int | getReturnCode () |
Gets the return code, which will have the value OK if the user clicked the OK button and USER_CANCELLED if the user clicked the Cancel button or closed the window without clicking OK. | |
void | Change (PropertyChangeEvent e) |
Set the due date radio button to selected if the user interacts with the calendar to set the date. | |
void | stateChanged (ChangeEvent e) |
Invoked when the value of the time spinner changes. | |
Static Public Attributes | |
static final int | OK = 0 |
The ID returned by getReturnCode() when the user clicks the OK button. | |
static final int | USER_CANCELED = 1 |
The ID returned by getReturnCode() when the user clicks the Cancel button or closes the window without clicking OK. | |
Private Member Functions | |
void | setup (Task t) |
Sets up the visual appearance of this panel. | |
Private Attributes | |
int | returnCode = ChooseDueDatePanel.USER_CANCELED |
The return code that we should return from getReturnCode(). | |
Controls | |
The various controls in the panel. | |
JCalendar | calendar |
TimeSpinner | timeSpinner |
JRadioButton | noDueDateRadio |
JRadioButton | dueDateRadio |
JButton | okButton |
Static Private Attributes | |
static final long | serialVersionUID = 7157144022358657916L |
Prevent serialization collisions. |
edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.ChooseDueDatePanel | ( | ) |
Constructs a new DueDatePanel with its initially selected date set to the current date and time.
edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.ChooseDueDatePanel | ( | Task | t | ) |
Constructs a new DueDatePanel with its initially selected date set to the due date of the given task, or the current date and time if the task has no due date.
t | the task whose due date we should use to initialize the panel |
Calendar edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.getDate | ( | ) |
Returns the date the user chose from the panel, or null
if they selected the "no due date" radio button.
Note that this will NOT return null
if the user clicked Cancel; the return value in that case is what they would have chosen had they clicked OK. Thus, it is important to call getReturnCode() before assuming the return value of this method is valid.
null
if the user chose "no due date" as the value JButton edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.getOKButton | ( | ) |
Returns the OK button.
This is necessary so the OK button can be set as the default button in whatever JFrame or JDialog it is placed into.
int edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.getReturnCode | ( | ) |
Gets the return code, which will have the value OK if the user clicked the OK button and USER_CANCELLED if the user clicked the Cancel button or closed the window without clicking OK.
If getReturnCode() is called while the panel is still visible, USER_CANCELLED is also returned, so don't call this until you're sure the interaction has finished.
void edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.Change | ( | PropertyChangeEvent | e | ) |
Set the due date radio button to selected if the user interacts with the calendar to set the date.
void edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.setup | ( | Task | t | ) | [private] |
Sets up the visual appearance of this panel.
t | the task to use to initialize the panel |
void edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.stateChanged | ( | ChangeEvent | e | ) |
Invoked when the value of the time spinner changes.
final long edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.serialVersionUID = 7157144022358657916L [static, private] |
Prevent serialization collisions.
final int edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.OK = 0 [static] |
The ID returned by getReturnCode() when the user clicks the OK button.
final int edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.USER_CANCELED = 1 [static] |
The ID returned by getReturnCode() when the user clicks the Cancel button or closes the window without clicking OK.
int edu.cmu.hcii.calo.view.task.ChooseDueDatePanel.returnCode = ChooseDueDatePanel.USER_CANCELED [private] |
The return code that we should return from getReturnCode().