|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.swing.visuals.CalendarPanel
public class CalendarPanel
The CalendarPanel class provides a swing-based JPanel that allows the user to view days of the month and select a single day. The panel provides buttons for navigating up and down through days and months, as well as a way to jump to the current date. The selected date is a date (and possibly time) that the user has selected, or that has been specified via the API. It is represented by inverted colors for the day box. The current date (defaults to today when not specified) is the calendar "page" that should be shown in the component. It is merely a navigational setting and doesn't affect the selected date. The calendar also shows an outline (default blue) around the day representing today. An optional time button can be displayed, allowing the user to expand/collapse a time panel. From this panel, the user can view/change a time associated with the date.
Constructor Summary | |
---|---|
CalendarPanel()
Constructor |
|
CalendarPanel(java.util.GregorianCalendar date)
Constructor |
|
CalendarPanel(java.util.TimeZone timeZone)
Constructor taking a TimeZone to use for dates. |
Method Summary | |
---|---|
protected void |
addComponents()
Method to add all the Components |
protected void |
addDateToSpinnerTime(java.util.GregorianCalendar date)
|
protected void |
addSpinnerTimeToDate(java.util.GregorianCalendar date)
|
protected void |
dateSelected()
|
void |
dispose()
Method to dispose the _owner (if any) |
void |
enableTimeButton(boolean enabled)
Determines whether or not the time (clock) button is enabled (if shown). |
boolean |
get24HourTime()
Returns the format of the time display in the time panel (when enabled). |
protected java.util.GregorianCalendar |
getCalendarWithTimeZone(java.util.GregorianCalendar calendar,
java.util.TimeZone timeZone)
Returns a new calendar that has the same date as the specified calendar and the same time zone as the specified time zone. |
java.util.GregorianCalendar |
getCurrentDate()
Returns the currently viewed date (or calendar "page") for this component. |
protected CalendarDayButton |
getDayButton(int ix)
|
boolean |
getEnabled()
Returns the enabled state of the panel. |
protected int |
getFirstDayOfWeek(java.util.GregorianCalendar calendar)
Get the day of the week for the first day in the specified month |
int |
getGoToButtonMode()
Gets the current mode of the "Go To" button. |
java.util.GregorianCalendar |
getMaxDate()
Method to get the maximum date the can be selected |
java.util.GregorianCalendar |
getMinDate()
Method to get the minimun date the can be selected |
protected java.util.GregorianCalendar |
getNewCalendar()
|
javax.swing.JButton |
getOKButton()
Returns the JButton representing the OK button in the panel. |
java.util.GregorianCalendar |
getSelectedDate()
Method to return the selected date |
boolean |
getShowWeekdayHeaders()
Returns the visibility of the weekday headers which appear above the grid of days in the month. |
java.util.TimeZone |
getTimeZone()
Returns the current time zone for dates that are retrieved from this component. |
java.awt.Color |
getTodayOutlineColor()
Returns the color used for the outline for the day representing today. |
protected CalendarDayButton |
getWeekButton(int ix)
|
protected void |
goNextDisplayMonth()
Method to go to the next Month |
protected void |
goNextYear()
Method to go to the next year |
protected void |
goPrevDisplayMonth()
Method to go to the prev Month |
protected void |
goPrevYear()
Method to go to the prev year |
protected void |
goToDate()
Method to go to date (either selected date or today) |
void |
goToSelectedDate()
Deprecated. This functionality should no longer be needed. |
protected void |
init()
|
protected void |
initializeUI()
|
protected void |
layoutUI()
layoutUI() |
boolean |
okClicked()
Method to see if the ok button was pressed |
void |
propertyChange(java.beans.PropertyChangeEvent e)
|
void |
redraw()
Redraws the components in this panel. |
void |
set24HourTime(boolean mode)
Determines the format of the time display in the time panel (when enabled). |
void |
setAccessibleNamePrefix(java.lang.String prefix)
Sets the string prefix to use when defining accessible names for all components in this panel. |
protected void |
setAccessibleNames()
|
void |
setCurrentDate(java.util.GregorianCalendar date)
Sets the currently viewed date (or calendar "page") for this component. |
protected void |
setDisplayMonth(int monthIndex)
|
protected void |
setDisplayQuarter(int quarterIndex)
|
void |
setEnabled(boolean enabled)
Sets the enabled state of the panel. |
void |
setGoToButtonMode(int mode)
Sets the "Go To" button to the specified mode. |
void |
setGoToButtonText(int mode,
java.lang.String text,
java.lang.String toolTip)
Provides an override for the text used for the "Go To" button. |
void |
setMaxDate(java.util.GregorianCalendar aDate)
Method to set the maximum date the can be selected |
void |
setMinDate(java.util.GregorianCalendar aDate)
Method to set the minimun date the can be selected |
void |
setNextMonthButtonIcon(javax.swing.Icon icon)
Sets the icon to use for the "next month" button at the top of the panel. |
void |
setNextYearButtonIcon(javax.swing.Icon icon)
Sets the icon to use for the "next year" button at the top of the panel. |
void |
setPrevMonthButtonIcon(javax.swing.Icon icon)
Sets the icon to use for the "previous month" button at the top of the panel. |
void |
setPrevYearButtonIcon(javax.swing.Icon icon)
Sets the icon to use for the "previous year" button at the top of the panel. |
void |
setSelectedDate(java.util.GregorianCalendar aDate)
Method to set the selected date |
protected void |
setSelectedDate(java.util.GregorianCalendar aDate,
boolean redraw)
Method to set the selected date |
protected void |
setSelectedWeek(java.util.GregorianCalendar aDate,
boolean redraw)
Method to set the selected week |
void |
setShowWeekdayHeaders(boolean show)
Sets the visibility of the weekday headers which appear above the grid of days in the month. |
void |
setTimePanelText(java.lang.String label)
Provides an override for the text used to preface the time spinner box in the time panel. |
void |
setTimeZone(java.util.TimeZone timeZone)
Sets the time zone to use for dates that are retrieved from this component. |
void |
setTodayDisplayFormat(java.text.DateFormat format)
Method to set the format of the date shown in the Today button. |
void |
setTodayOutlineColor(java.awt.Color color)
Sets the color used for the outline for the day representing today. |
void |
showOKButton(boolean show)
Determines whether or not an OK button is displayed in the lower right corner of the panel. |
void |
showTimeButton(boolean show)
Determines whether or not the time (clock) button is displayed in the lower right corner of the panel. |
void |
showTimePanel(boolean show)
Determines whether or not the time panel is displayed below the calendar days. |
void |
stateChanged(javax.swing.event.ChangeEvent e)
|
protected void |
updateDateComponents()
|
protected void |
updateDayComponents()
|
protected void |
updateGoToButton()
|
protected void |
updateMonthComponents()
|
protected void |
updateMonthQuarterYearComponents()
|
protected void |
updateQuarterComponents()
|
protected void |
updateYearComponents()
|
Field Detail |
---|
public static final java.lang.String RB_KEY
public static final java.lang.String VALUE_CHANGED
public static final java.lang.String DATE_CHANGED
public static final java.lang.String TIME_CHANGED
public static final java.lang.String SIZE_CHANGED
protected java.lang.String accessibleNamePrefix
protected java.util.GregorianCalendar todayDate
protected java.util.GregorianCalendar selectedDate
protected java.util.GregorianCalendar displayDate
protected java.util.GregorianCalendar maxDate
protected java.util.GregorianCalendar minDate
protected java.util.TimeZone timeZone
protected CalendarDayButton selectedDayButton
protected java.text.DateFormat todayDateFormat
protected java.awt.Font weekdayHeaderFont
protected javax.swing.JPanel monthAndYearPanel
protected javax.swing.JPanel daysPanel
protected javax.swing.JPanel weeksPanel
protected javax.swing.JPanel mainPanel
protected javax.swing.JPanel buttonPanel
protected javax.swing.JPanel timePanel
protected javax.swing.JPanel daysUserContentPanel
protected javax.swing.Icon LEFT_ARROW
protected javax.swing.Icon RIGHT_ARROW
protected javax.swing.Icon DOUBLE_LEFT_ARROW
protected javax.swing.Icon DOUBLE_RIGHT_ARROW
protected javax.swing.Icon CALENDAR_CLOCK_ICON
protected java.lang.String GO_TO_SELECTED_DATE_TEXT
protected java.lang.String GO_TO_SELECTED_DATE_TOOLTIP
protected java.lang.String GO_TO_TODAY_FMT
protected java.lang.String GO_TO_TODAY_TOOLTIP
protected java.lang.String TIME_PANEL_TEXT
protected javax.swing.JButton nextYearButton
protected javax.swing.JButton prevYearButton
protected javax.swing.JButton prevDisplayMonthButton
protected javax.swing.JButton nextDisplayMonthButton
protected javax.swing.JButton goToButton
protected javax.swing.JButton timeButton
protected javax.swing.JButton okButton
protected javax.swing.JLabel monthLabel
protected javax.swing.JLabel quarterLabel
protected javax.swing.JLabel yearLabel
protected ComboBox headingMonthComboBox
protected ComboBox headingQuarterComboBox
protected javax.swing.JSpinner headingYearSpinner
protected javax.swing.JLabel timeLabel
protected javax.swing.JSpinner timeSpinner
protected int goToMode
public static final int GO_TO_TODAY
public static final int GO_TO_CURRENT_DATE
public static final int GO_TO_SELECTED_DATE
protected boolean enabled
protected int daysInMonth
protected boolean okClicked
protected boolean showWeekdayHeaders
protected java.util.Vector vectorDays
protected boolean timePanelVisible
protected boolean timeMode24Hour
protected boolean showSeconds
protected java.awt.Color todayOutlineColor
public static final int DAY_SELECTION
public static final int WEEK_SELECTION
public static final int MONTH_SELECTION
public static final int QUARTER_SELECTION
public static final int TIME_SELECTION
public static final int WEEKDAY_SELECTION
protected int weekStartingDay
protected int minimalDaysInFirstWeek
protected boolean showWeekNumbers
protected boolean showCalendar
protected boolean showMonthQuarterYearLabels
protected int selectMode
protected java.util.Vector vectorWeeks
Constructor Detail |
---|
public CalendarPanel()
public CalendarPanel(java.util.TimeZone timeZone)
timeZone
- The TimeZone to use.public CalendarPanel(java.util.GregorianCalendar date)
date
- The current date associated with this panelMethod Detail |
---|
protected void init()
public void setAccessibleNamePrefix(java.lang.String prefix)
prefix
- The string prefix to use.protected void setAccessibleNames()
public void setShowWeekdayHeaders(boolean show)
show
- Set to true to show the headers, false otherwise.public boolean getShowWeekdayHeaders()
protected void initializeUI()
protected void layoutUI() throws java.lang.Exception
java.lang.Exception
protected void addComponents()
protected void updateDateComponents()
protected void updateMonthQuarterYearComponents()
protected void updateMonthComponents()
protected void updateQuarterComponents()
protected void updateYearComponents()
protected void updateDayComponents()
protected CalendarDayButton getDayButton(int ix)
protected CalendarDayButton getWeekButton(int ix)
protected void updateGoToButton()
public void setTimeZone(java.util.TimeZone timeZone)
timeZone
- The TimeZone to use.getTimeZone()
public java.util.TimeZone getTimeZone()
setTimeZone(TimeZone)
protected java.util.GregorianCalendar getCalendarWithTimeZone(java.util.GregorianCalendar calendar, java.util.TimeZone timeZone)
calendar
- The calendar with the desired datetimeZone
- The desired time zone for the new calendar
public java.util.GregorianCalendar getSelectedDate()
public void setSelectedDate(java.util.GregorianCalendar aDate)
aDate
- the date that you want to be selectedprotected void setSelectedDate(java.util.GregorianCalendar aDate, boolean redraw)
aDate
- the date that you want to be selectedredraw
- Set to true to redraw the calendar, false otherwiseprotected void setSelectedWeek(java.util.GregorianCalendar aDate, boolean redraw)
aDate
- the date that belongs to the week that you want to be selectedredraw
- Set to true to redraw the calendar, false otherwisepublic java.util.GregorianCalendar getCurrentDate()
public void setCurrentDate(java.util.GregorianCalendar date)
date
- The currently viewed date.public java.util.GregorianCalendar getMaxDate()
public void setMaxDate(java.util.GregorianCalendar aDate)
aDate
- max datepublic java.util.GregorianCalendar getMinDate()
public void setMinDate(java.util.GregorianCalendar aDate)
aDate
- min datepublic boolean okClicked()
public void setTodayDisplayFormat(java.text.DateFormat format)
format
- The DateFormat to use for the date display.protected void goToDate()
public void goToSelectedDate()
protected void goPrevDisplayMonth()
protected void goNextDisplayMonth()
protected void goPrevYear()
protected void goNextYear()
protected void dateSelected()
protected int getFirstDayOfWeek(java.util.GregorianCalendar calendar)
public void dispose()
public void setPrevYearButtonIcon(javax.swing.Icon icon)
icon
- The icon to use.public void setNextYearButtonIcon(javax.swing.Icon icon)
icon
- The icon to use.public void setPrevMonthButtonIcon(javax.swing.Icon icon)
icon
- The icon to use.public void setNextMonthButtonIcon(javax.swing.Icon icon)
icon
- The icon to use.protected void setDisplayMonth(int monthIndex)
protected void setDisplayQuarter(int quarterIndex)
public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
protected void addSpinnerTimeToDate(java.util.GregorianCalendar date)
protected void addDateToSpinnerTime(java.util.GregorianCalendar date)
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
public javax.swing.JButton getOKButton()
public void showOKButton(boolean show)
show
- Set to true to display the OK button, false otherwise.public void showTimeButton(boolean show)
show
- Set to true to display the Time button, false otherwise.public void enableTimeButton(boolean enabled)
enabled
- Set to true to enable the button, false otherwise.public void showTimePanel(boolean show)
show
- Set to true to display the panel, false otherwise.public boolean get24HourTime()
public void set24HourTime(boolean mode)
mode
- True if 24-hr time display is desired, false otherwise.public void setGoToButtonMode(int mode)
mode
- The mode to set for the "Go To" button.public int getGoToButtonMode()
public void setGoToButtonText(int mode, java.lang.String text, java.lang.String toolTip)
mode
- Change text for the specified mode, either GO_TO_TODAY or GO_TO_SELECTED_DATE.text
- The new text of the button. You can include {0} in the text for the GO_TO_TODAY mode
and today's date will be substituted in its place.toolTip
- The new tool tip text for the button.public void setTimePanelText(java.lang.String label)
label
- The new text to use for the label.public boolean getEnabled()
public void setEnabled(boolean enabled)
setEnabled
in class javax.swing.JComponent
enabled
- True if the panel should be enabled, false otherwise.public void setTodayOutlineColor(java.awt.Color color)
color
- The color to use for the outlinepublic java.awt.Color getTodayOutlineColor()
protected java.util.GregorianCalendar getNewCalendar()
public void redraw()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |