JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.calendar
Class JCDateChooser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.klg.jclass.util.calendar.CalendarContainer
                                |
                                +--com.klg.jclass.util.calendar.JCDateChooser
All Implemented Interfaces:
Accessible, ActionListener, CalendarComponent, ContainerListener, EventListener, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
DateTimeEditor.DateChooser, JCDateTimeValidator.DateChooser

public class JCDateChooser
extends CalendarContainer
implements Serializable

Date chooser component. Displays a calendar and allows the user to select a date.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  com.klg.jclass.util.calendar.BoundsValidator boundsValidator
           
protected  int chooserType
           
protected  int componentSpacing
           
protected  com.klg.jclass.util.calendar.CalendarComponent day
           
protected  String[] days
           
static int DUAL_SPIN
          Valid value for ChooserType.
protected  com.klg.jclass.util.calendar.CalendarComponent month
           
protected  String[] months
           
static int QUICK_SELECT
          Valid value for ChooserType.
static int READ_ONLY
          Valid value for ChooserType.
protected  String[] shortMonths
           
static int SPIN_POPDOWN
          Valid value for ChooserType.
protected  com.klg.jclass.util.calendar.CalendarComponent year
           
 
Fields inherited from class com.klg.jclass.util.calendar.CalendarContainer
actionListeners, initialized, locale, model, specialDates, userFont
 
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
JCDateChooser()
          Constructs a default date chooser.
JCDateChooser(com.klg.jclass.util.value.JCValueModel current_date, Locale locale)
          Creates a calendar using the specified Calendar and locale.
JCDateChooser(com.klg.jclass.util.value.JCValueModel current_date, Locale locale, int chooser_type)
          Constructs a localized date chooser of a particular type, set to the given date.
JCDateChooser(com.klg.jclass.util.value.JCValueModel current_date, Locale locale, int chooser_type, String[] months, String[] shortMonths, String[] days)
          Constructs a localized date chooser of a particular type, set to the given date.
 
Method Summary
protected  boolean checkMonths(String[] months, boolean isShort)
          Checks if the passed in months array is long enough.
protected  void createComponents(int type)
          Creates the date chooser components based on the chooser type.
protected  void forceRelayout()
          Calculates the container size.
 String getAbout()
          Gets the value of the About property.
 int getChooserType()
          Gets the date chooser type.
 com.klg.jclass.util.calendar.CalendarComponent getDayComponent()
          Returns the CalendarComponent used in the day portion of the chooser.
 String[] getDays()
          Gets the days array used for day names.
 Calendar getMaximumDate()
          Returns the maximum roll date.
 Calendar getMinimumDate()
          Returns the minimum roll date.
 com.klg.jclass.util.calendar.CalendarComponent getMonthComponent()
          Returns the CalendarComponent used in the Month portion of the chooser.
 String[] getMonths()
          Gets the months array used for month names.
 String[] getShortMonths()
          Gets the months array used for month names.
 Calendar getValue()
          Returns the selected calendar.
 String getVersion()
          Gets the version.
 com.klg.jclass.util.calendar.CalendarComponent getYearComponent()
          Returns the CalendarComponent used in the year portion of the chooser.
 void setAbout(String s)
          Provided for Beans property editors - has no effect.
 void setCalendarModel(com.klg.jclass.util.value.JCValueModel model)
          Sets the current date being used by the calendar component.
 void setChooserType(int type)
          Sets the date chooser type.
 void setDays(String[] days)
          Sets the days array used for day names.
 void setEnabled(boolean enabled)
          Sets whether or not this component is enabled.
 void setMaximumDate(Calendar maxDate)
          Sets the maximum roll date.
 void setMinimumDate(Calendar minDate)
          Sets the minimum date.
 void setMonths(String[] months)
          Sets the months array used for month names.
 void setShortMonths(String[] shortMonths)
          Sets the months array used for short month names.
 void setUI(ComponentUI ui)
          Sets the UI.
 void setValue(Calendar calendar)
          Sets the selected Calendar.
 void setVersion(String s)
          Provided for Beans property editors - has no effect.
 
Methods inherited from class com.klg.jclass.util.calendar.CalendarContainer
actionPerformed, addActionListener, componentAdded, componentRemoved, getCalendarModel, getLocale, getUserFont, removeActionListener, setFont, setLocale, setSpecialDates
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

QUICK_SELECT

public static final int QUICK_SELECT
Valid value for ChooserType.

See Also:
Constant Field Values

DUAL_SPIN

public static final int DUAL_SPIN
Valid value for ChooserType.

See Also:
Constant Field Values

SPIN_POPDOWN

public static final int SPIN_POPDOWN
Valid value for ChooserType.

See Also:
Constant Field Values

READ_ONLY

public static final int READ_ONLY
Valid value for ChooserType.

See Also:
Constant Field Values

chooserType

protected int chooserType

year

protected com.klg.jclass.util.calendar.CalendarComponent year

month

protected com.klg.jclass.util.calendar.CalendarComponent month

day

protected com.klg.jclass.util.calendar.CalendarComponent day

months

protected String[] months

shortMonths

protected String[] shortMonths

days

protected String[] days

componentSpacing

protected int componentSpacing

boundsValidator

protected com.klg.jclass.util.calendar.BoundsValidator boundsValidator
Constructor Detail

JCDateChooser

public JCDateChooser()
Constructs a default date chooser. Will show the current date.


JCDateChooser

public JCDateChooser(com.klg.jclass.util.value.JCValueModel current_date,
                     Locale locale)
Creates a calendar using the specified Calendar and locale. The Calendar object must be created with the specified locale already set.

Parameters:
current_date - the Calendar object must be created with the specified locale
locale - the locale to use
See Also:
Calendar, Locale

JCDateChooser

public JCDateChooser(com.klg.jclass.util.value.JCValueModel current_date,
                     Locale locale,
                     int chooser_type)
Constructs a localized date chooser of a particular type, set to the given date.

Parameters:
current_date - the calendar value model which stores the date
locale - the locale to use
chooser_type - the type of chooser; must be one of JCDateChooser.QUICK_SELECT, JCDateChooser.DUAL_SPIN, JCDateChooser.SPIN_POPDOWN, or JCDateChooser.READ_ONLY

JCDateChooser

public JCDateChooser(com.klg.jclass.util.value.JCValueModel current_date,
                     Locale locale,
                     int chooser_type,
                     String[] months,
                     String[] shortMonths,
                     String[] days)
Constructs a localized date chooser of a particular type, set to the given date.

Parameters:
current_date - the calendar value model which stores the date
locale - the locale to use
chooser_type - the type of chooser; must be one of JCDateChooser.QUICK_SELECT, JCDateChooser.DUAL_SPIN, JCDateChooser.SPIN_POPDOWN, or JCDateChooser.READ_ONLY
months - a list of month names to use (null means use locale specific names)
shortMonths - a list of short month names to use (null means use locale specific names)
days - a list of day names to use (null means use locale specific names)
Method Detail

getChooserType

public int getChooserType()
Gets the date chooser type.

Returns:
an int representing the chooser type, one of
  • JCDateChooser.QUICK_SELECT
  • JCDateChooser.DUAL_SPIN
  • JCDateChooser.SPIN_POPDOWN
  • JCDateChooser.READ_ONLY

setChooserType

public void setChooserType(int type)
Sets the date chooser type.

Parameters:
type - the type of chooser; must be one of JCDateChooser.QUICK_SELECT, JCDateChooser.DUAL_SPIN, JCDateChooser.SPIN_POPDOWN, or JCDateChooser.READ_ONLY

forceRelayout

protected void forceRelayout()
Calculates the container size.


getVersion

public String getVersion()
Gets the version.

Returns:
the version String

setVersion

public void setVersion(String s)
Provided for Beans property editors - has no effect.

Parameters:
s - ignored

getAbout

public String getAbout()
Gets the value of the About property. The About property displays contact information for Quest Software in the Bean box.

Returns:
the about String

setAbout

public void setAbout(String s)
Provided for Beans property editors - has no effect. The About property displays contact information for Quest Software in the bean box.

Parameters:
s - ignored

getValue

public Calendar getValue()
Returns the selected calendar. From the Calendar class, the year, month, and date can be retrieved.

Returns:
the current calendar value model's value
See Also:
Calendar, setValue(java.util.Calendar)

setValue

public void setValue(Calendar calendar)
Sets the selected Calendar.
Note: The Calendar set must have the same locale as the existing Calendar, otherwise the results are undefined.

Parameters:
calendar - the new value for the current calendar value model
See Also:
Calendar, getValue()

getMinimumDate

public Calendar getMinimumDate()
Returns the minimum roll date. The calendar cannot change before the date.

Returns:
the minimum date
See Also:
Calendar, setMinimumDate(java.util.Calendar), getMaximumDate(), setMaximumDate(java.util.Calendar)

setMinimumDate

public void setMinimumDate(Calendar minDate)
Sets the minimum date. The calendar cannot change to before this date.

Parameters:
minDate - the new minimum date
See Also:
Calendar, getMinimumDate(), getMaximumDate(), setMaximumDate(java.util.Calendar)

getMaximumDate

public Calendar getMaximumDate()
Returns the maximum roll date. The calendar cannot change later than this date.

Returns:
the maximum date
See Also:
Calendar, setMinimumDate(java.util.Calendar), getMinimumDate(), setMaximumDate(java.util.Calendar)

setMaximumDate

public void setMaximumDate(Calendar maxDate)
Sets the maximum roll date. The calendar cannot change later than this date.

Parameters:
maxDate - the new maximum date
See Also:
Calendar, setMinimumDate(java.util.Calendar), getMinimumDate(), getMaximumDate()

checkMonths

protected boolean checkMonths(String[] months,
                              boolean isShort)
Checks if the passed in months array is long enough.

Parameters:
months - the months array to check
isShort - Are these short month names?
Returns:
Is the month array OK to use?

getMonths

public String[] getMonths()
Gets the months array used for month names. If the return value is null, the locale specific month names will be used.

Returns:
the current months array used for month names

setMonths

public void setMonths(String[] months)
Sets the months array used for month names. If the value is null, the locale specific month names will be used.

Parameters:
months - the new months array used for month names

getShortMonths

public String[] getShortMonths()
Gets the months array used for month names. If the return value is null, the locale specific month names will be used.

Returns:
the current months array used for month names

setShortMonths

public void setShortMonths(String[] shortMonths)
Sets the months array used for short month names. If the value is null, the locale specific short month names will be used.

Parameters:
shortMonths - the new short months array used

getDays

public String[] getDays()
Gets the days array used for day names. If the return value is null, the locale specific day names will be used.

Returns:
the current days array used for day names

setDays

public void setDays(String[] days)
Sets the days array used for day names. If the value is null, the locale specific day names will be used.

Parameters:
days - the new days array used for day names

setUI

public void setUI(ComponentUI ui)
Sets the UI.

Overrides:
setUI in class JComponent
Parameters:
ui - the new UI

setCalendarModel

public void setCalendarModel(com.klg.jclass.util.value.JCValueModel model)
Sets the current date being used by the calendar component.

Specified by:
setCalendarModel in interface CalendarComponent
Overrides:
setCalendarModel in class CalendarContainer
Parameters:
model - the new calendar value model

getDayComponent

public com.klg.jclass.util.calendar.CalendarComponent getDayComponent()
Returns the CalendarComponent used in the day portion of the chooser.

Returns:
the component which displays the day

getMonthComponent

public com.klg.jclass.util.calendar.CalendarComponent getMonthComponent()
Returns the CalendarComponent used in the Month portion of the chooser.

Returns:
the component which displays the month

getYearComponent

public com.klg.jclass.util.calendar.CalendarComponent getYearComponent()
Returns the CalendarComponent used in the year portion of the chooser.

Returns:
the component which displays the year

createComponents

protected void createComponents(int type)
Creates the date chooser components based on the chooser type. Creates a component for selecting the year, the month, and the day.

Parameters:
type - the type of chooser; must be one of JCDateChooser.QUICK_SELECT, JCDateChooser.DUAL_SPIN, JCDateChooser.SPIN_POPDOWN, or JCDateChooser.READ_ONLY

setEnabled

public void setEnabled(boolean enabled)
Sets whether or not this component is enabled. A component that is enabled may respond to user input, while a component that is not enabled cannot respond to user input. Some components may alter their visual representation when they are disabled in order to provide feedback to the user that they cannot take input.

Overrides:
setEnabled in class JComponent
Parameters:
enabled - true if this component should be enabled, false otherwise
See Also:
Component.isEnabled(), Component.isLightweight()

Copyright © 2004 Quest Software Inc..
All rights reserved.