JIDE 3.5.15

com.jidesoft.combobox
Class DateChooserPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.combobox.PopupPanel
                      extended by com.jidesoft.combobox.DateChooserPanel
All Implemented Interfaces:
DateModelListener, ActionListener, ComponentListener, MouseListener, MouseWheelListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible

public class DateChooserPanel
extends PopupPanel
implements ActionListener, ComponentListener, MouseListener, MouseWheelListener, DateModelListener

DateChooserPanel is a popup panel that can choose Date. User can click and select a Date. It also support various operations such as typing year directly, choose a month from a popup menu, go to next or previous month. It also supports ItemListener. Whenever a Date is selected, itemStateChanged will be fired.

By default, DateChooserPanel only supports single selection, meaning only one date can be selected at a time. It also supports multiple selections such as a range of dates or several ranges of dates. You can choose which selection mode by calling getSelectionModel(), then call DateSelectionModel.setSelectionMode(int). You can always use methods on DateSelectionModel to find out current selection or get notification if selection changes.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ButtonPanel _buttonPanel
           
 ItemListener _itemListener
           
static int NAVIGATION_BUTTON_HEIGHT
           
static int NAVIGATION_BUTTON_WIDTH
           
static String PROPERTY_DISPLAY_MONTH
           
static String PROPERTY_SHOW_NEXT_BUTTON
           
static String PROPERTY_SHOW_NEXT_MONTH_DAYS
           
static String PROPERTY_SHOW_NEXT_YEAR_BUTTON
           
static String PROPERTY_SHOW_NONE_BUTTON
           
static String PROPERTY_SHOW_OK_BUTTON
           
static String PROPERTY_SHOW_PREVIOUS_BUTTON
           
static String PROPERTY_SHOW_PREVIOUS_MONTH_DAYS
           
static String PROPERTY_SHOW_PREVIOUS_YEAR_BUTTON
           
static String PROPERTY_SHOW_TODAY_BUTTON
           
static String PROPERTY_SHOW_WEEK_NUMBERS
           
static String PROPERTY_SHOW_YEAR_BUTTONS
           
static String PROPERTY_TODAY_HIGHLIGHTED
           
static String PROPERTY_VIEWONLY
           
static String VIEWONLY_PROPERTY
          Property of view only.
 
Fields inherited from class com.jidesoft.combobox.PopupPanel
_previousSelectedObject, SELECTED_BY_MOUSE_ROLLOVER
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DateChooserPanel()
          Creates a new DateChooserPanel with DefaultDateModel.
DateChooserPanel(boolean useToday)
          Choose to use today button.
DateChooserPanel(boolean useToday, boolean useNone)
          Choose to use today or none button.
DateChooserPanel(boolean useToday, boolean useNone, boolean showWeeks)
          Choose to use the
DateChooserPanel(DateModel model)
          Set a model and show today, none buttons and week of year labels
DateChooserPanel(DateModel model, boolean useToday)
          Set a model and choose to show today.
DateChooserPanel(DateModel model, boolean useToday, boolean useNone)
          Set a DateModel and choose to see today or none.
DateChooserPanel(DateModel model, boolean useToday, boolean useNone, boolean showWeeks)
          Creates a new DateChooserPanel with a specified DateModel.
DateChooserPanel(DateModel model, boolean useToday, boolean useNone, boolean showWeeks, Locale locale)
          Creates a new DateChooserPanel with a specified DateModel.
DateChooserPanel(DateModel model, boolean useToday, boolean useNone, boolean showWeeks, String timeFormat, Locale locale)
          Creates a new DateChooserPanel with a specified DateModel.
DateChooserPanel(DateModel model, Locale locale)
          Set a model and show today, none buttons and week of year labels
 
Method Summary
 void actionPerformed(ActionEvent e)
           
protected  void addModelListener()
          Adds DateModelListener to DateModel.
protected  void changeSelectedCalendar()
           
 Calendar changeSelection(Date date, boolean toggle, boolean extend)
          Changes the selected date.
protected  void checkShortenLabels()
          Check if the labels with the weekday names (Sun, Mon, Tue, Wed, Thu, Fri, Sat, Sun) will fill on all the labels, if any one will not fit the 3 letters, then shorten the labels to (S,M,T,W,T,F,S)
 void componentHidden(ComponentEvent ce)
           
 void componentMoved(ComponentEvent ce)
           
 void componentResized(ComponentEvent ce)
           
 void componentShown(ComponentEvent ce)
           
static Calendar convertToMidnight(Calendar instance)
           
protected  AbstractButton createButton(String text, String mnemonic)
           
protected  Component createButtonPanel()
          Creates the the bottom button panel.
protected  Calendar createCalendarInstance()
          Creates a new Calendar instance that will be used internally.
protected  JComponent createDateLabel(int i)
          Creates the component that will display the date in DateChooserPanel.
protected  Component createDatePanel()
           
protected  Component createDayHeaderPanel()
           
protected  JComponent createDayOfWeekLabel(int i)
           
protected  Component createDayPanel()
           
protected  JComponent createMonthLabel()
           
protected  Component createMonthPanel()
           
protected  Component createMonthYearPanel()
          Create the panel contains the month and year information.
protected  JPanel createPanel(LayoutManager layoutManager)
           
protected  DateSpinner createTimeSpinner()
          Creates time spinner.
protected  JComponent createWeekOfYearLabel(int i)
           
protected  JComponent createWeekOfYearPanel()
           
protected  JComponent createYearLabel()
           
protected  MouseListener createYearLabelListener()
          Create the mouse listener for the year label.
 void dateModelChanged(DateModelEvent e)
          This notification tells listeners the something changed in date model.
 void disableMouseWheel()
           
 void doLayout()
           
 void enableMouseWheel()
           
protected  ButtonPanel getButtonPanel()
          Gets the ButtonPanel that contains the "Today", "None" buttons.
protected  Border getButtonsBorder()
           
 CalendarViewer getCalendarViewer()
           
 DateModel getDateModel()
          Gets the DateModel.
protected  Map<Component,Date> getDayMap()
           
 Component getDefaultFocusComponent()
          Gets the default focus component.
 Calendar getDisplayedCalendar()
          Get the displayed calendar for this date chooser.
 int getDisplayIndex()
           
protected  Border getEmptyBorder()
           
 int getFirstDayOfWeek()
          Gets the first day of the week is; e.g., Sunday in US, Monday in France.
 SimpleDateFormat getMonthFormatter()
           
protected  JComponent getMonthLabel()
           
protected  Color getMonthYearBackground()
           
protected  Border getMonthYearBorder()
           
protected  Color getMonthYearForeground()
           
protected  JPanel getMonthYearPanel()
          Gets the panel that includes the month label and year label.
protected  AbstractButton getNextButton()
           
protected  AbstractButton getNextYearButton()
           
protected  AbstractButton getNoneButton()
           
protected  AbstractButton getPrevButton()
           
protected  AbstractButton getPrevYearButton()
           
protected  String getResourceString(String key, Locale locale)
          Gets the localized string from resource bundle of specified locale.
 Calendar getSelectedCalendar()
          Gets the selected calendar.
 Date getSelectedDate()
          Gets the selected date.
protected  int getSelectedDay()
           
 int getSelectedHour()
           
 int getSelectedMillisecond()
           
 int getSelectedMinute()
           
protected  int getSelectedMonth()
           
 int getSelectedSecond()
           
protected  int getSelectedYear()
           
 DateSelectionModel getSelectionModel()
          Gets selection model.
protected  JTextField getTextField(JSpinner spinner)
          Return the formatted text field used by the editor, or null if the editor doesn't descend from JSpinner.DefaultEditor.
 String getTimeFormat()
           
 TimeZone getTimeZone()
           
 JPanel getTitlePanel()
          Gets the panel that includes the month year panel and the next/previous month buttons.
protected  AbstractButton getTodayButton()
           
protected  Calendar getTodayCalendar()
           
protected  int getTodayDay()
           
protected  int getTodayMonth()
           
protected  int getTodayYear()
           
 SimpleDateFormat getWeekFormatter()
           
 SimpleDateFormat getWeekOfYearFormatter()
           
 SimpleDateFormat getYearFormatter()
           
protected  JComponent getYearLabel()
           
protected  SpinnerModel getYearModel()
           
protected  JComponent getYearSpinner()
           
protected  int hideYearSpinner()
           
protected  void initCalendar()
           
protected  void initComponents()
           
protected  void initDateFormat(Locale locale)
           
 boolean isAlwaysShowShortWeekLabels()
           
protected  boolean isDateSelected(Calendar calendar)
           
protected  boolean isDayOutOfRange(Calendar calendar)
          Checks if the day is out of the range of the DateModel.
protected  boolean isMonthOutOfRange(Calendar calendar)
          Checks if the month is out of the range of the DateModel.
 boolean isSelectAllDatesOnToggleMode()
          Get the flag indicating if it should select all dates first instead of toggling all dates selection while clicking on the DayOfWeek label or WeekOfYear label.
 boolean isSelectDateOnSameMonth()
          Get the flag indicating if only the dates on the same month would be selected while clicking on the DayOfWeek label or WeekOfYear label.
 boolean isShowMonthMenu()
          Gets the flag indicating if the month popup menu will show up when the customer click on the month label.
 boolean isShowNextButton()
          Checks if next button is visible.
 boolean isShowNextMonthDays()
           
 boolean isShowNextYearButton()
          Checks if next year button is visible.
 boolean isShowNoneButton()
          Checks if none button is visible.
 boolean isShowOKButton()
          Checks if OK button is visible.
 boolean isShowPreviousButton()
          Checks if previous button is visible.
 boolean isShowPreviousMonthDays()
           
 boolean isShowPreviousYearButton()
          Checks if previous year button is visible.
protected  boolean isShowShortWeekLabels()
           
 boolean isShowTodayButton()
          Checks if today button is visible.
 boolean isShowWeekNumbers()
          Checks if the week of year panel is visible.
 boolean isShowYearButtons()
          Get the flag indicating if DateChooserPanel will buttons for next/previous year selection.
 boolean isShowYearSpinner()
          Get the flag indicating if the year spinner will show up when the customer click on the year label.
protected  boolean isSingleSelectionMode()
           
 boolean isTimeDisplayed()
           
protected  boolean isToday(Calendar calendar)
           
 boolean isTodayHighlighted()
           
 boolean isToggleMode()
          Get the flag indicating that if the selection is in toggle mode without pressing the CTRL key while selecting the date labels.
 boolean isViewOnly()
          If the DateChooserPanel is view-only.
 void mouseClicked(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void mouseWheelMoved(MouseWheelEvent e)
           
protected  void nextDay()
           
protected  void nextDisplayMonth()
           
protected  void nextDisplayYear()
           
protected  void nextMonth()
           
protected  void nextWeek()
           
protected  void nextYear()
           
 void paint(Graphics g)
           
protected  void prevDay()
           
protected  void prevDisplayMonth()
           
protected  void prevDisplayYear()
           
protected  void prevMonth()
           
protected  void prevWeek()
           
protected  void prevYear()
           
protected  void registerKeyStrokes()
           
protected  void removeModeListener()
           
 void setAlwaysShowShortWeekLabels(boolean alwaysShowShortWeekLabels)
           
protected  void setButtonPanel(ButtonPanel panel)
           
protected  void setButtonsBorder(Border border)
           
 void setCalendarViewer(CalendarViewer calendarViewer)
           
 void setDateModel(DateModel dateModel)
          Sets the DateModel.
 boolean setDisplayedMonth(int year, int month)
          This method will set the year and month this panel will display.
 boolean setDisplayedMonth(int year, int month, boolean force)
           
protected  void setDisplayedTime(Calendar calendar)
          Sets the displayed time to time spinner.
 void setDisplayIndex(int displayIndex)
           
 void setEnabled(boolean enabled)
           
 void setFirstDayOfWeek(int firstDayOfWeek)
          Sets the first day of the week is; e.g., Sunday in US, Monday in France.
 void setLocale(Locale locale)
           
protected  void setMonthLabel(JComponent component)
           
protected  void setMonthYearBackground(Color background)
           
protected  void setMonthYearBorder(Border border)
           
protected  void setMonthYearForeground(Color foreground)
           
protected  void setMonthYearPanel(JPanel panel)
           
protected  void setNextButton(AbstractButton button)
           
protected  void setNextYearButton(AbstractButton button)
           
protected  void setNoneButton(AbstractButton button)
           
protected  void setPrevButton(AbstractButton button)
           
protected  void setPrevYearButton(AbstractButton button)
           
 void setSelectAllDatesOnToggleMode(boolean selectAllDatesOnToggleMode)
          Set the flag indicating if it should select all dates first instead of toggling all dates selection while clicking on the DayOfWeek label or WeekOfYear label.
 void setSelectDateOnSameMonth(boolean selectDateOnSameMonth)
          Set the flag indicating if only the dates on the same month would be selected while clicking on the DayOfWeek label or WeekOfYear label.
 void setSelectedCalendar(Calendar selectedCalendar)
          Sets the selected calendar.
 void setSelectedDate(Date selectedDate)
          Sets the selected date.
protected  void setSelectedDay(int day)
           
 void setSelectedHour(int hour)
           
 void setSelectedMillisecond(int millisecond)
           
 void setSelectedMinute(int minute)
           
protected  void setSelectedMonth(int month)
           
 void setSelectedObject(Object selectedObject, boolean fireEvent)
          Sets the selected object and fire ItemEvent.
 void setSelectedSecond(int second)
           
protected  void setSelectedYear(int year)
           
 void setSelectionModel(DateSelectionModel selectionModel)
          Sets selection model.
 void setShowMonthMenu(boolean showMonthMenu)
          Sets the flag indicating if the month popup menu will show up when the customer click on the month label.
 void setShowNextButton(boolean showNextButton)
          Sets the next button visible.
 void setShowNextMonthDays(boolean showNextMonthDays)
          By default a DateChooserPanel will show next month dates in current monthly view but in gray color.
 void setShowNextYearButton(boolean showNextYearButton)
          Sets the next year button visible.
 void setShowNoneButton(boolean showNoneButton)
          Sets the none button visible.
 void setShowOKButton(boolean showOKButton)
          Sets the OK button visible.
 void setShowPreviousButton(boolean showPreviousButton)
          Sets the previous button visible.
 void setShowPreviousMonthDays(boolean showPreviousMonthDays)
          By default a DateChooserPanel will show previous month dates in current monthly view but in gray color.
 void setShowPreviousYearButton(boolean showPreviousYearButton)
          Sets the previous year button visible.
protected  void setShowShortWeekLabels(boolean sWeekLabels)
           
 void setShowTodayButton(boolean showTodayButton)
          Sets the today button visible.
 void setShowWeekNumbers(boolean showWeekNumbers)
          Sets the week of year panel visible.
 void setShowYearButtons(boolean showYearButtons)
          Set the flag indicating if DateChooserPanel will buttons for next/previous year selection.
 void setShowYearSpinner(boolean showYearSpinner)
          Set the flag indicating if the year spinner will show up when the customer click on the year label.
 void setTimeDisplayed(boolean timeDisplayed)
           
 void setTimeZone(TimeZone timeZone)
           
protected  void setTodayButton(AbstractButton button)
           
protected  void setTodayCalendar(Calendar cal)
           
protected  void setTodayDay(int tday)
           
 void setTodayHighlighted(boolean todayHighlighted)
           
protected  void setTodayMonth(int tmonth)
           
protected  void setTodayYear(int year)
           
 void setToggleMode(boolean toggleMode)
          Set the flag indicating that if the selection is in toggle mode without pressing the CTRL key while selecting the date labels.
 void setViewOnly(boolean viewOnly)
          Sets the view only attribute.
protected  void setYearLabel(JComponent component)
           
protected  void setYearModel(SpinnerModel model)
           
protected  void setYearSpinner(JComponent spinner)
           
protected  boolean shouldKeepCurrentSelection(MouseEvent e)
          Check if the current selection should be kept.
protected  void showPopup(MouseEvent e)
           
protected  void showYearSpinner()
           
protected  void updateButtons(ButtonPanel buttonPanel)
           
 void updateCalendar()
          Update calendar to update all UI components inside DateChooserPanel.
protected  void updateDateLabel(JComponent dateLabel, Calendar date, boolean isSelected, boolean isToday, boolean withinCurrentMonth)
          Updates the date label with the correct data value.
protected  void updateDayOfWeekLabel(JComponent dayOfWeekLabel, Calendar calendar)
           
protected  Calendar updateDisplayedTime(Date date)
          Updates the time value from the time spinner.
protected  void updateMonthLabel(JComponent monthLabel, Calendar calendar)
           
protected  void updateMonthNavigationButtons(Calendar cal)
          Enables or disables the month navigation buttons depending on the current displayed calendar.
protected  void updateTextAndMnemonic(AbstractButton button, String prefix, Locale locale)
          Updates the mnemonic for the OK or today or none button.
 void updateUI()
           
protected  void updateWeekOfYearLabel(JComponent weekOfYearLabel, Calendar calendar)
           
protected  void updateYearLabel(JComponent yearLabel, Calendar calendar)
           
 
Methods inherited from class com.jidesoft.combobox.PopupPanel
addItemListener, addItemListener, fireItemStateChanged, getActualPreferredSize, getItemListeners, getMouseListener, getMouseMotionListener, getPreferredSize, getPreviousSelectedObject, getResizableCorners, getSelectedObject, getSelectedObjects, getTitle, isResetButtonVisible, isResizable, isStretchToFit, needsButtons, removeAllListeners, removeItemListener, requestFocus, setDefaultFocusComponent, setNeedButtons, setPreferredSize, setResizable, setResizableCorners, setSelectedObject, setSelectedObject, setSelectedObject, setStretchToFit, setTitle
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VIEWONLY_PROPERTY

public static final String VIEWONLY_PROPERTY
Property of view only.

See Also:
Constant Field Values

PROPERTY_VIEWONLY

public static final String PROPERTY_VIEWONLY
See Also:
Constant Field Values

_buttonPanel

protected ButtonPanel _buttonPanel

NAVIGATION_BUTTON_HEIGHT

public static int NAVIGATION_BUTTON_HEIGHT

NAVIGATION_BUTTON_WIDTH

public static int NAVIGATION_BUTTON_WIDTH

_itemListener

public ItemListener _itemListener

PROPERTY_DISPLAY_MONTH

public static final String PROPERTY_DISPLAY_MONTH
See Also:
Constant Field Values

PROPERTY_SHOW_NONE_BUTTON

public static final String PROPERTY_SHOW_NONE_BUTTON
See Also:
Constant Field Values

PROPERTY_SHOW_OK_BUTTON

public static final String PROPERTY_SHOW_OK_BUTTON
See Also:
Constant Field Values

PROPERTY_SHOW_TODAY_BUTTON

public static final String PROPERTY_SHOW_TODAY_BUTTON
See Also:
Constant Field Values

PROPERTY_SHOW_WEEK_NUMBERS

public static final String PROPERTY_SHOW_WEEK_NUMBERS
See Also:
Constant Field Values

PROPERTY_SHOW_PREVIOUS_BUTTON

public static final String PROPERTY_SHOW_PREVIOUS_BUTTON
See Also:
Constant Field Values

PROPERTY_SHOW_NEXT_BUTTON

public static final String PROPERTY_SHOW_NEXT_BUTTON
See Also:
Constant Field Values

PROPERTY_SHOW_PREVIOUS_YEAR_BUTTON

public static final String PROPERTY_SHOW_PREVIOUS_YEAR_BUTTON
See Also:
Constant Field Values

PROPERTY_SHOW_NEXT_YEAR_BUTTON

public static final String PROPERTY_SHOW_NEXT_YEAR_BUTTON
See Also:
Constant Field Values

PROPERTY_SHOW_YEAR_BUTTONS

public static final String PROPERTY_SHOW_YEAR_BUTTONS
See Also:
Constant Field Values

PROPERTY_SHOW_PREVIOUS_MONTH_DAYS

public static final String PROPERTY_SHOW_PREVIOUS_MONTH_DAYS
See Also:
Constant Field Values

PROPERTY_SHOW_NEXT_MONTH_DAYS

public static final String PROPERTY_SHOW_NEXT_MONTH_DAYS
See Also:
Constant Field Values

PROPERTY_TODAY_HIGHLIGHTED

public static final String PROPERTY_TODAY_HIGHLIGHTED
See Also:
Constant Field Values
Constructor Detail

DateChooserPanel

public DateChooserPanel()
Creates a new DateChooserPanel with DefaultDateModel.


DateChooserPanel

public DateChooserPanel(boolean useToday)
Choose to use today button.

Parameters:
useToday - boolean

DateChooserPanel

public DateChooserPanel(boolean useToday,
                        boolean useNone)
Choose to use today or none button.

Parameters:
useToday - boolean
useNone - boolean

DateChooserPanel

public DateChooserPanel(boolean useToday,
                        boolean useNone,
                        boolean showWeeks)
Choose to use the

Parameters:
useToday - boolean
useNone - boolean
showWeeks - boolean

DateChooserPanel

public DateChooserPanel(DateModel model)
Set a model and show today, none buttons and week of year labels

Parameters:
model - DateModel

DateChooserPanel

public DateChooserPanel(DateModel model,
                        Locale locale)
Set a model and show today, none buttons and week of year labels

Parameters:
model - DateModel the DateModel
locale - the Locale

DateChooserPanel

public DateChooserPanel(DateModel model,
                        boolean useToday)
Set a model and choose to show today. Defaults to showing none button and weeks of the year button

Parameters:
model - DateModel
useToday - boolean

DateChooserPanel

public DateChooserPanel(DateModel model,
                        boolean useToday,
                        boolean useNone)
Set a DateModel and choose to see today or none. Defaults to showing weeks of the year

Parameters:
model - DateModel
useToday - boolean
useNone - boolean

DateChooserPanel

public DateChooserPanel(DateModel model,
                        boolean useToday,
                        boolean useNone,
                        boolean showWeeks)
Creates a new DateChooserPanel with a specified DateModel. Set a model and choose to see today, none, and weeks of the year.

Parameters:
model - DateModel
useToday - boolean
useNone - boolean
showWeeks - boolean

DateChooserPanel

public DateChooserPanel(DateModel model,
                        boolean useToday,
                        boolean useNone,
                        boolean showWeeks,
                        Locale locale)
Creates a new DateChooserPanel with a specified DateModel. Set a model and choose to see today, none, and weeks of the year.

Parameters:
model - DateModel
useToday - boolean
useNone - boolean
showWeeks - boolean
locale - the Locale

DateChooserPanel

public DateChooserPanel(DateModel model,
                        boolean useToday,
                        boolean useNone,
                        boolean showWeeks,
                        String timeFormat,
                        Locale locale)
Creates a new DateChooserPanel with a specified DateModel. Set a model and choose to see today, none, and weeks of the year.

Parameters:
model - DateModel
useToday - boolean
useNone - boolean
showWeeks - boolean
timeFormat - the format for time spinner
locale - the Locale
Method Detail

shouldKeepCurrentSelection

protected boolean shouldKeepCurrentSelection(MouseEvent e)
Check if the current selection should be kept.

Parameters:
e - the mouse event
Returns:
true if control is pressed. Otherwise false.
Since:
3.5.4

getDateModel

public DateModel getDateModel()
Gets the DateModel.

Returns:
DateModel.

setDateModel

public void setDateModel(DateModel dateModel)
Sets the DateModel.

Parameters:
dateModel - the new DateModel

addModelListener

protected void addModelListener()
Adds DateModelListener to DateModel.


removeModeListener

protected void removeModeListener()

dateModelChanged

public void dateModelChanged(DateModelEvent e)
Description copied from interface: DateModelListener
This notification tells listeners the something changed in date model.

Specified by:
dateModelChanged in interface DateModelListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

showYearSpinner

protected void showYearSpinner()

hideYearSpinner

protected int hideYearSpinner()

showPopup

protected void showPopup(MouseEvent e)

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

setDisplayedTime

protected void setDisplayedTime(Calendar calendar)
Sets the displayed time to time spinner.

Parameters:
calendar - the displayed time.

updateDisplayedTime

protected Calendar updateDisplayedTime(Date date)
Updates the time value from the time spinner.

Parameters:
date - the Date
Returns:
a Calendar with time value filled in.

changeSelectedCalendar

protected void changeSelectedCalendar()

nextMonth

protected void nextMonth()

nextDisplayMonth

protected void nextDisplayMonth()

isMonthOutOfRange

protected boolean isMonthOutOfRange(Calendar calendar)
Checks if the month is out of the range of the DateModel. If true, it will call beep to notify user.

Parameters:
calendar - the calendar.
Returns:
true if the calendar is out of the range. Otherwise false.

isDayOutOfRange

protected boolean isDayOutOfRange(Calendar calendar)
Checks if the day is out of the range of the DateModel. If true, it will call beep to notify user.

Parameters:
calendar - the calendar.
Returns:
true if the calendar is out of the range. Otherwise false.

isSingleSelectionMode

protected boolean isSingleSelectionMode()

prevDisplayMonth

protected void prevDisplayMonth()

prevMonth

protected void prevMonth()

nextDisplayYear

protected void nextDisplayYear()

nextYear

protected void nextYear()

prevDisplayYear

protected void prevDisplayYear()

prevYear

protected void prevYear()

nextDay

protected void nextDay()

prevDay

protected void prevDay()

nextWeek

protected void nextWeek()

prevWeek

protected void prevWeek()

getSelectedDate

public Date getSelectedDate()
Gets the selected date.

Returns:
the selected date.

getSelectedCalendar

public Calendar getSelectedCalendar()
Gets the selected calendar.

Returns:
the selected calendar

setSelectedDate

public void setSelectedDate(Date selectedDate)
Sets the selected date.

Parameters:
selectedDate - the new selected Date

setSelectedCalendar

public void setSelectedCalendar(Calendar selectedCalendar)
Sets the selected calendar.

Parameters:
selectedCalendar - the new selected Calendar

setDisplayedMonth

public boolean setDisplayedMonth(int year,
                                 int month)
This method will set the year and month this panel will display. If the date is out of the range of minDate and maxDate, this call has no effect and return false. If the displayed date is changed correctly, the return will be true.

Parameters:
year - Year to be viewed
month - Month to be viewed. It's 0 based to be compatible with Calendar. So 0 means Jan, 1 means Feb. etc. Pass in -1 if you want to keep the current month and just change the year
Returns:
true if the display date is set correctly, else return false. If the method returns false,

setDisplayedMonth

public boolean setDisplayedMonth(int year,
                                 int month,
                                 boolean force)

getDisplayedCalendar

public Calendar getDisplayedCalendar()
Get the displayed calendar for this date chooser.

Returns:
the displayed Calendar. It is usually the first day of the month that is displayed.

createDayPanel

protected Component createDayPanel()

createDayHeaderPanel

protected Component createDayHeaderPanel()

createWeekOfYearPanel

protected JComponent createWeekOfYearPanel()

createDayOfWeekLabel

protected JComponent createDayOfWeekLabel(int i)

createWeekOfYearLabel

protected JComponent createWeekOfYearLabel(int i)

createDatePanel

protected Component createDatePanel()

createDateLabel

protected JComponent createDateLabel(int i)
Creates the component that will display the date in DateChooserPanel.

Parameters:
i - the index of the date component. For example, the first one at the top left corner index is 0, the horizontally next one has index 1, and so on.
Returns:
the component that will display the date.
See Also:
updateDateLabel(javax.swing.JComponent,java.util.Calendar,boolean,boolean,boolean)

getTextField

protected JTextField getTextField(JSpinner spinner)
Return the formatted text field used by the editor, or null if the editor doesn't descend from JSpinner.DefaultEditor.

Parameters:
spinner - the spinner
Returns:
the text field

createYearLabelListener

protected MouseListener createYearLabelListener()
Create the mouse listener for the year label.

Returns:
the mouse listener.

createMonthYearPanel

protected Component createMonthYearPanel()
Create the panel contains the month and year information.

Returns:
the panel.

createButtonPanel

protected Component createButtonPanel()
Creates the the bottom button panel. The component returned from this method is actually a panel wrapping the actual button panel. The actual button panel can be retrieved using getButtonPanel. You can override this method and add extra buttons if you want.

Returns:
the bottom button panel.

createButton

protected AbstractButton createButton(String text,
                                      String mnemonic)

createTimeSpinner

protected DateSpinner createTimeSpinner()
Creates time spinner.

Returns:
time spinner

updateButtons

protected void updateButtons(ButtonPanel buttonPanel)

doLayout

public void doLayout()
Overrides:
doLayout in class Container

initCalendar

protected void initCalendar()

updateUI

public void updateUI()
Overrides:
updateUI in class JPanel

initComponents

protected void initComponents()

createMonthPanel

protected Component createMonthPanel()

setSelectedObject

public void setSelectedObject(Object selectedObject,
                              boolean fireEvent)
Description copied from class: PopupPanel
Sets the selected object and fire ItemEvent. It will still fire event even the new selected object is the same as old selected object.

Overrides:
setSelectedObject in class PopupPanel
Parameters:
selectedObject - new selected object
fireEvent - if fire the ItemEvent

updateCalendar

public void updateCalendar()
Update calendar to update all UI components inside DateChooserPanel.


updateMonthNavigationButtons

protected void updateMonthNavigationButtons(Calendar cal)
Enables or disables the month navigation buttons depending on the current displayed calendar.

Parameters:
cal - the currently displayed calendar.

convertToMidnight

public static Calendar convertToMidnight(Calendar instance)

createPanel

protected JPanel createPanel(LayoutManager layoutManager)

isViewOnly

public boolean isViewOnly()
If the DateChooserPanel is view-only.

Returns:
true if the DateChooserPanel is view-only

setViewOnly

public void setViewOnly(boolean viewOnly)
Sets the view only attribute. If the DateChooserPanel is view-only, user will not be able to change the month or year once it's set.

Parameters:
viewOnly - true or false.

setEnabled

public void setEnabled(boolean enabled)
Overrides:
setEnabled in class JComponent

checkShortenLabels

protected void checkShortenLabels()
Check if the labels with the weekday names (Sun, Mon, Tue, Wed, Thu, Fri, Sat, Sun) will fill on all the labels, if any one will not fit the 3 letters, then shorten the labels to (S,M,T,W,T,F,S)


updateDayOfWeekLabel

protected void updateDayOfWeekLabel(JComponent dayOfWeekLabel,
                                    Calendar calendar)

updateWeekOfYearLabel

protected void updateWeekOfYearLabel(JComponent weekOfYearLabel,
                                     Calendar calendar)

updateDateLabel

protected void updateDateLabel(JComponent dateLabel,
                               Calendar date,
                               boolean isSelected,
                               boolean isToday,
                               boolean withinCurrentMonth)
Updates the date label with the correct data value.

Parameters:
dateLabel - the component that is used to display the date. By default, we use a JideButton. You can override createDateLabel(int) method to create your own component for the date. If so, this parameter will be the component you created.
date - the date to be displayed on this date label.
isSelected - if the date is the selected date
isToday - if the date is the today date.
withinCurrentMonth - if the date is within the current displayed month.

updateMonthLabel

protected void updateMonthLabel(JComponent monthLabel,
                                Calendar calendar)

updateYearLabel

protected void updateYearLabel(JComponent yearLabel,
                               Calendar calendar)

createMonthLabel

protected JComponent createMonthLabel()

createYearLabel

protected JComponent createYearLabel()

getFirstDayOfWeek

public int getFirstDayOfWeek()
Gets the first day of the week is; e.g., Sunday in US, Monday in France.

Returns:
firstDayOfWeek. -1 if you never set before. If so, the default value in the locale will be used.

setFirstDayOfWeek

public void setFirstDayOfWeek(int firstDayOfWeek)
Sets the first day of the week is; e.g., Sunday in US, Monday in France. The values are defined in Calendar such as Calendar.SUNDAY, Calendar.MONDAY etc.

Parameters:
firstDayOfWeek - the first day of the week

isShowWeekNumbers

public boolean isShowWeekNumbers()
Checks if the week of year panel is visible.

Returns:
true if the week of year is visible.

setShowWeekNumbers

public void setShowWeekNumbers(boolean showWeekNumbers)
Sets the week of year panel visible.

Parameters:
showWeekNumbers - true or false.

isShowTodayButton

public boolean isShowTodayButton()
Checks if today button is visible.

Returns:
true if today button is visible.

setShowTodayButton

public void setShowTodayButton(boolean showTodayButton)
Sets the today button visible.

Parameters:
showTodayButton - true or false.

isShowNoneButton

public boolean isShowNoneButton()
Checks if none button is visible.

Returns:
true if none button is visible.

setShowNoneButton

public void setShowNoneButton(boolean showNoneButton)
Sets the none button visible.

Parameters:
showNoneButton - true or false.

isShowOKButton

public boolean isShowOKButton()
Checks if OK button is visible.

Returns:
true if OK button is visible.

setShowOKButton

public void setShowOKButton(boolean showOKButton)
Sets the OK button visible.

Parameters:
showOKButton - true or false.

isShowPreviousButton

public boolean isShowPreviousButton()
Checks if previous button is visible.

Returns:
true if previous button is visible.

setShowPreviousButton

public void setShowPreviousButton(boolean showPreviousButton)
Sets the previous button visible.

Parameters:
showPreviousButton - true or false.

isShowNextButton

public boolean isShowNextButton()
Checks if next button is visible.

Returns:
true if next button is visible.

setShowNextButton

public void setShowNextButton(boolean showNextButton)
Sets the next button visible.

Parameters:
showNextButton - true or false.

isShowPreviousYearButton

public boolean isShowPreviousYearButton()
Checks if previous year button is visible.

Returns:
true if previous year button is visible.

setShowPreviousYearButton

public void setShowPreviousYearButton(boolean showPreviousYearButton)
Sets the previous year button visible.

Parameters:
showPreviousYearButton - true or false.

isShowNextYearButton

public boolean isShowNextYearButton()
Checks if next year button is visible.

Returns:
true if next year button is visible.

setShowNextYearButton

public void setShowNextYearButton(boolean showNextYearButton)
Sets the next year button visible.

Parameters:
showNextYearButton - true or false.

isShowPreviousMonthDays

public boolean isShowPreviousMonthDays()

setShowPreviousMonthDays

public void setShowPreviousMonthDays(boolean showPreviousMonthDays)
By default a DateChooserPanel will show previous month dates in current monthly view but in gray color. This method gives you an option to hide them.

Parameters:
showPreviousMonthDays - true or false.

isShowNextMonthDays

public boolean isShowNextMonthDays()

setShowNextMonthDays

public void setShowNextMonthDays(boolean showNextMonthDays)
By default a DateChooserPanel will show next month dates in current monthly view but in gray color. This method gives you an option to hide them.

Parameters:
showNextMonthDays - true or false.

registerKeyStrokes

protected void registerKeyStrokes()

initDateFormat

protected void initDateFormat(Locale locale)

setLocale

public void setLocale(Locale locale)
Overrides:
setLocale in class Component

updateTextAndMnemonic

protected void updateTextAndMnemonic(AbstractButton button,
                                     String prefix,
                                     Locale locale)
Updates the mnemonic for the OK or today or none button.

Parameters:
button - the okButton or the todayButton or the noneButton.
prefix - the prefix. It could be "now" or "today" for the todayButton or "none" for the noneButton or "ok" for OK button.
locale - the locale

componentHidden

public void componentHidden(ComponentEvent ce)
Specified by:
componentHidden in interface ComponentListener

componentShown

public void componentShown(ComponentEvent ce)
Specified by:
componentShown in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent ce)
Specified by:
componentMoved in interface ComponentListener

componentResized

public void componentResized(ComponentEvent ce)
Specified by:
componentResized in interface ComponentListener

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface MouseWheelListener

enableMouseWheel

public void enableMouseWheel()

disableMouseWheel

public void disableMouseWheel()

getYearLabel

protected JComponent getYearLabel()

setYearLabel

protected void setYearLabel(JComponent component)

getMonthLabel

protected JComponent getMonthLabel()

setMonthLabel

protected void setMonthLabel(JComponent component)

getYearSpinner

protected JComponent getYearSpinner()

setYearSpinner

protected void setYearSpinner(JComponent spinner)

setYearModel

protected void setYearModel(SpinnerModel model)

getYearModel

protected SpinnerModel getYearModel()

setMonthYearBackground

protected void setMonthYearBackground(Color background)

getMonthYearBackground

protected Color getMonthYearBackground()

setMonthYearForeground

protected void setMonthYearForeground(Color foreground)

getMonthYearForeground

protected Color getMonthYearForeground()

setMonthYearPanel

protected void setMonthYearPanel(JPanel panel)

getMonthYearPanel

protected JPanel getMonthYearPanel()
Gets the panel that includes the month label and year label.

Returns:
the month year panel.

getTitlePanel

public JPanel getTitlePanel()
Gets the panel that includes the month year panel and the next/previous month buttons.

Returns:
the title panel.

setNextYearButton

protected void setNextYearButton(AbstractButton button)

getNextYearButton

protected AbstractButton getNextYearButton()

setPrevYearButton

protected void setPrevYearButton(AbstractButton button)

getPrevYearButton

protected AbstractButton getPrevYearButton()

setNextButton

protected void setNextButton(AbstractButton button)

getNextButton

protected AbstractButton getNextButton()

setPrevButton

protected void setPrevButton(AbstractButton button)

getPrevButton

protected AbstractButton getPrevButton()

getDayMap

protected Map<Component,Date> getDayMap()

setMonthYearBorder

protected void setMonthYearBorder(Border border)

getMonthYearBorder

protected Border getMonthYearBorder()

setButtonPanel

protected void setButtonPanel(ButtonPanel panel)

getButtonPanel

protected ButtonPanel getButtonPanel()
Gets the ButtonPanel that contains the "Today", "None" buttons.

Returns:
the ButtonPanel that contains the "Today", "None" buttons.

setTodayButton

protected void setTodayButton(AbstractButton button)

getTodayButton

protected AbstractButton getTodayButton()

setNoneButton

protected void setNoneButton(AbstractButton button)

getNoneButton

protected AbstractButton getNoneButton()

setButtonsBorder

protected void setButtonsBorder(Border border)

getButtonsBorder

protected Border getButtonsBorder()

getEmptyBorder

protected Border getEmptyBorder()

setTodayCalendar

protected void setTodayCalendar(Calendar cal)

getTodayCalendar

protected Calendar getTodayCalendar()

setTodayYear

protected void setTodayYear(int year)

getTodayYear

protected int getTodayYear()

setTodayMonth

protected void setTodayMonth(int tmonth)

getTodayMonth

protected int getTodayMonth()

setTodayDay

protected void setTodayDay(int tday)

getTodayDay

protected int getTodayDay()

setSelectedYear

protected void setSelectedYear(int year)

getSelectedYear

protected int getSelectedYear()

setSelectedMonth

protected void setSelectedMonth(int month)

getSelectedMonth

protected int getSelectedMonth()

setSelectedDay

protected void setSelectedDay(int day)

getSelectedDay

protected int getSelectedDay()

getSelectedHour

public int getSelectedHour()

setSelectedHour

public void setSelectedHour(int hour)

getSelectedMinute

public int getSelectedMinute()

setSelectedMinute

public void setSelectedMinute(int minute)

getSelectedSecond

public int getSelectedSecond()

setSelectedSecond

public void setSelectedSecond(int second)

getSelectedMillisecond

public int getSelectedMillisecond()

setSelectedMillisecond

public void setSelectedMillisecond(int millisecond)

setShowShortWeekLabels

protected void setShowShortWeekLabels(boolean sWeekLabels)

isShowShortWeekLabels

protected boolean isShowShortWeekLabels()

setTodayHighlighted

public void setTodayHighlighted(boolean todayHighlighted)

isTodayHighlighted

public boolean isTodayHighlighted()

isDateSelected

protected boolean isDateSelected(Calendar calendar)

isAlwaysShowShortWeekLabels

public boolean isAlwaysShowShortWeekLabels()

setAlwaysShowShortWeekLabels

public void setAlwaysShowShortWeekLabels(boolean alwaysShowShortWeekLabels)

isToday

protected boolean isToday(Calendar calendar)

getResourceString

protected String getResourceString(String key,
                                   Locale locale)
Gets the localized string from resource bundle of specified locale. Subclass can override it to provide its own string. Available keys are defined in date.properties.

Parameters:
key - the key of the string
locale - the locale the key of the string
Returns:
the localized string.

getMonthFormatter

public SimpleDateFormat getMonthFormatter()

getYearFormatter

public SimpleDateFormat getYearFormatter()

getWeekFormatter

public SimpleDateFormat getWeekFormatter()

getWeekOfYearFormatter

public SimpleDateFormat getWeekOfYearFormatter()

isShowYearButtons

public boolean isShowYearButtons()
Get the flag indicating if DateChooserPanel will buttons for next/previous year selection.

If the flag is true, we will show nextYearButton right to the nextMonthButton and show prevYearButton left to the prevMonthButton. Additionally, DateChooserPanel will not show the year spinner until the customer clicks on the year label.

If the flag is false, DateChooserPanel will not show the nextYearButton and prevYearButton. And, DateChooserPanel will show the year spinner automatically when the mouse enter the year label area.

The default value of this flag is true.

Returns:
the flag.

setShowYearButtons

public void setShowYearButtons(boolean showYearButtons)
Set the flag indicating if DateChooserPanel will buttons for next/previous year selection.

Parameters:
showYearButtons - the flag
See Also:
isShowYearButtons()

isShowMonthMenu

public boolean isShowMonthMenu()
Gets the flag indicating if the month popup menu will show up when the customer click on the month label.

The default value is true. However, if you like the previous/next month button and don't like this popup menu to bother your customer, you can choose to disable this flag.

Returns:
true if month menu would be displayed on click. Otherwise false.

setShowMonthMenu

public void setShowMonthMenu(boolean showMonthMenu)
Sets the flag indicating if the month popup menu will show up when the customer click on the month label.

Parameters:
showMonthMenu - the flag

isShowYearSpinner

public boolean isShowYearSpinner()
Get the flag indicating if the year spinner will show up when the customer click on the year label.

The default value is true. However, if you like the previous/next year button and don't like this spinner to bother your customer, you can choose to disable this flag.

Returns:
the flag.

setShowYearSpinner

public void setShowYearSpinner(boolean showYearSpinner)
Set the flag indicating if the year spinner will show up when the customer click on the year label.

Parameters:
showYearSpinner - the flag

isToggleMode

public boolean isToggleMode()
Get the flag indicating that if the selection is in toggle mode without pressing the CTRL key while selecting the date labels.

By default, the value is false. You can set it to true if you don't your customer to press CTRL key to enter toggle mode.

Returns:
true if it is automatically in toggle mode for mouse click event. Otherwise false.

setToggleMode

public void setToggleMode(boolean toggleMode)
Set the flag indicating that if the selection is in toggle mode without pressing the CTRL key while selecting the date labels.

Parameters:
toggleMode - the flag
See Also:
isToggleMode()

isSelectDateOnSameMonth

public boolean isSelectDateOnSameMonth()
Get the flag indicating if only the dates on the same month would be selected while clicking on the DayOfWeek label or WeekOfYear label.

By default, the value is true to select the dates on the same month only. You can set it to false to select all visible dates.

Returns:
true if only the dates on the same month could be selected. Otherwise false.

setSelectDateOnSameMonth

public void setSelectDateOnSameMonth(boolean selectDateOnSameMonth)
Set the flag indicating if only the dates on the same month would be selected while clicking on the DayOfWeek label or WeekOfYear label.

Parameters:
selectDateOnSameMonth - the flag
See Also:
isSelectDateOnSameMonth()

isSelectAllDatesOnToggleMode

public boolean isSelectAllDatesOnToggleMode()
Get the flag indicating if it should select all dates first instead of toggling all dates selection while clicking on the DayOfWeek label or WeekOfYear label.

By default, the value is true. In this scenario, imagine 2,3,4,5,6,7,8 is in the same week and 3 is already selected. If you click the week label, all dates would be selected first, then all dates would be deselected on next mouse click. If you set the value to false, In the scenario above, one mouse clickin on the week label will cause 2,4, 5,6,7,8 to be selected and 3 is deselected.

This flag will take effect only when isToggleMode() returns true.

Returns:
true if it should select all dates first. Otherwise false.
See Also:
isToggleMode()

setSelectAllDatesOnToggleMode

public void setSelectAllDatesOnToggleMode(boolean selectAllDatesOnToggleMode)
Set the flag indicating if it should select all dates first instead of toggling all dates selection while clicking on the DayOfWeek label or WeekOfYear label.

This flag will take effect only when isToggleMode() returns true.

Parameters:
selectAllDatesOnToggleMode - the flag
See Also:
isToggleMode(), isSelectAllDatesOnToggleMode()

isTimeDisplayed

public boolean isTimeDisplayed()

setTimeDisplayed

public void setTimeDisplayed(boolean timeDisplayed)

getDefaultFocusComponent

public Component getDefaultFocusComponent()
Description copied from class: PopupPanel
Gets the default focus component. The default focus component will gain focus when popup is shown.

Overrides:
getDefaultFocusComponent in class PopupPanel
Returns:
the default focus component.

getTimeFormat

public String getTimeFormat()

getSelectionModel

public DateSelectionModel getSelectionModel()
Gets selection model.

Returns:
selection model.

setSelectionModel

public void setSelectionModel(DateSelectionModel selectionModel)
Sets selection model.

Parameters:
selectionModel - new DateSelectionModel

changeSelection

public Calendar changeSelection(Date date,
                                boolean toggle,
                                boolean extend)
Changes the selected date. Depending on the value of the toggle and extend, it has different mean. See below.
 
  • toggle = true, extend = true: Selects all dates from the current anchor selection date to the date. Keep existing selection.
  • toggle = false, extend = true: Clears existing selection then selects all dates from the current anchor selection date to the date.
  • toggle = true, extend = false: If the date was selected, deselect it. Otherwise select it.
  • toggle = false, extend = false: Clears existing selection and selects the date no matter it was selected or not.

Parameters:
date - date to be selected. See description below.
toggle - true or false. See description below.
extend - true or false. See description below.
Returns:
the Calendar of the newly selected date. It will have the time value from the time spinner if time spinner is displayed.

getDisplayIndex

public int getDisplayIndex()

setDisplayIndex

public void setDisplayIndex(int displayIndex)

getCalendarViewer

public CalendarViewer getCalendarViewer()

setCalendarViewer

public void setCalendarViewer(CalendarViewer calendarViewer)

getTimeZone

public TimeZone getTimeZone()

setTimeZone

public void setTimeZone(TimeZone timeZone)

createCalendarInstance

protected Calendar createCalendarInstance()
Creates a new Calendar instance that will be used internally.

Returns:
a Calendar instance.

paint

public void paint(Graphics g)
Overrides:
paint in class JComponent

JIDE 3.5.15