Calendar Component v5.1
www.calendarcomponent.com

com.imagine.component.calendar
Class CalendarComponent

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended bycom.imagine.component.calendar.CalendarComponent
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
CalendarComponent01, CalendarComponent02

public class CalendarComponent
extends javax.swing.JComponent

This is the calendar component you have to insert into your application.

To use this component you must get an instance of it by calling the method new CalendarComponent(java.util.Date).
In order to customize the look you must call the method getCalendarSkin() which will give you an instance of a CalendarSkin object and work with it.
To set the date you must call the method setDate() and to get the date you must call the method getDate().

See also howto.html file for further informations.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static CalendarProperty CHANGE_CURRENT_DATE_WHEN_YEAR_OR_MONTH_CHANGES
          When this property is set to true the current selected date will be automatically changed when the year or month is changed through the visual controls.
static CalendarProperty FIRST_DAY_OF_WEEK
          Defines the first day of week property.
static CalendarProperty INTER_COLUMNS_SPACING
          Defines the inter columns spacing property.
static CalendarProperty INTER_ROWS_SPACING
          Defines the inter rows spacing property.
static CalendarProperty LOCALE
          Defines the locale property.
static CalendarProperty MAX_ADVANCE_OVER_NON_SELECTABLE_DATES
          Specifies the maximum number of non selectable calendar cells to be skipped searching for a selectable cell in the current direction.
static CalendarProperty MAX_MONTHS_NAMES_LENGTH
          Defines the max months names length property.
static CalendarProperty MAX_WEEK_DAYS_NAMES_LENGTH
          Defines the max week days names length property.
static CalendarProperty SHOW_EXTRA_MONTH_DAYS
          Defines the visible status property for the extra month days.
static CalendarProperty SHOW_GRID
          Defines the grid visible status property.
static CalendarProperty SHOW_HOVER
          Defines the hover effect status property.
static CalendarProperty SHOW_STATUS_PANEL
          True if the panel containing the Today and None labels is visible.
static CalendarProperty SHOW_WEEK
          Defines the week numbers visible status property.
static CalendarProperty STATUS_PANEL_NONE_LABEL
          The label for None item on status panel.
static CalendarProperty STATUS_PANEL_TODAY_LABEL
          The label for Today item on status panel.
 
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
CalendarComponent()
          Constructor for the CalendarComponent object.
CalendarComponent(java.util.Date date)
          Constructor for the CalendarComponent object.
 
Method Summary
 void addCalendarComponentListener(CalendarComponentListener calendarComponentListener)
          Add a calendar component listener.
 void addDateListener(DateListener dateListener)
          Add a date listener.
 java.lang.Boolean getBooleanCalendarProperty(CalendarProperty calendarProperty)
          Get the value of the specified calendar property as a Boolean object.
 CalendarMetricsProvider getCalendarMetricsProvider()
          Get the calendar metrics provider object used to calculate the calendar subcomponents sizes.
 java.lang.Object getCalendarProperty(CalendarProperty calendarProperty)
          Get the value of the specified calendar property.
 CalendarRendererProvider getCalendarRendererProvider()
          Get the calendar renderer provider object used to render the calendar.
 CalendarSelectionModel getCalendarSelectionModel()
          Get the dates selection model.
 CalendarSkin getCalendarSkin()
          Get the CalendarSkin object associated.
 CalendarView getCalendarView()
          Get the calendar view object containg informations about the calendar parts.
 java.util.Date getDate()
          Get the date.
 java.lang.Integer getIntegerCalendarProperty(CalendarProperty calendarProperty)
          Get the value of the specified calendar property as an Integer object.
 java.util.Locale getLocaleCalendarProperty(CalendarProperty calendarProperty)
          Get the value of the specified calendar property as a Locale object.
 CalendarProperty[] getSupportedCalendarProperties()
          Get the list of properties suported.
 void processCalendarEvent(CalendarEvent calendarEvent)
          Send an event to the calendar component.
 boolean removeCalendarComponentListener(CalendarComponentListener calendarComponentListener)
          Remove a calendar component listener.
 boolean removeDateListener(DateListener dateListener)
          Remove a date listener.
 void setCalendarMetricsProvider(CalendarMetricsProvider calendarMetricsProvider)
          Set the calendar metrics provider object used to calculate the calendar subcomponents sizes.
 void setCalendarProperty(CalendarProperty calendarProperty, java.lang.Object value)
          Set the specified calendar property to the specified value.
 void setCalendarRendererProvider(CalendarRendererProvider calendarRendererProvider)
          Set the calendar renderer provider.
 void setCalendarSelectionModel(CalendarSelectionModel calendarSelectionModel)
          Set the dates selection model.
 void setDate(java.util.Date date)
          Set the date.
 
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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
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, getLocale, 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, setLocale, 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

FIRST_DAY_OF_WEEK

public static final CalendarProperty FIRST_DAY_OF_WEEK
Defines the first day of week property. The first day of week can have one of the following values:
java.util.calendar.SUNDAY
java.util.calendar.MONDAY
java.util.calendar.TUESDAY
java.util.calendar.WEDNESDAY
java.util.calendar.THURSDAY
java.util.calendar.FRIDAY
java.util.calendar.SATURDAY


SHOW_GRID

public static final CalendarProperty SHOW_GRID
Defines the grid visible status property.


SHOW_WEEK

public static final CalendarProperty SHOW_WEEK
Defines the week numbers visible status property.


SHOW_HOVER

public static final CalendarProperty SHOW_HOVER
Defines the hover effect status property.


SHOW_STATUS_PANEL

public static final CalendarProperty SHOW_STATUS_PANEL
True if the panel containing the Today and None labels is visible.


STATUS_PANEL_TODAY_LABEL

public static final CalendarProperty STATUS_PANEL_TODAY_LABEL
The label for Today item on status panel.


STATUS_PANEL_NONE_LABEL

public static final CalendarProperty STATUS_PANEL_NONE_LABEL
The label for None item on status panel.


SHOW_EXTRA_MONTH_DAYS

public static final CalendarProperty SHOW_EXTRA_MONTH_DAYS
Defines the visible status property for the extra month days.


MAX_WEEK_DAYS_NAMES_LENGTH

public static final CalendarProperty MAX_WEEK_DAYS_NAMES_LENGTH
Defines the max week days names length property.


MAX_MONTHS_NAMES_LENGTH

public static final CalendarProperty MAX_MONTHS_NAMES_LENGTH
Defines the max months names length property.


INTER_COLUMNS_SPACING

public static final CalendarProperty INTER_COLUMNS_SPACING
Defines the inter columns spacing property.


INTER_ROWS_SPACING

public static final CalendarProperty INTER_ROWS_SPACING
Defines the inter rows spacing property.


LOCALE

public static final CalendarProperty LOCALE
Defines the locale property.


MAX_ADVANCE_OVER_NON_SELECTABLE_DATES

public static final CalendarProperty MAX_ADVANCE_OVER_NON_SELECTABLE_DATES
Specifies the maximum number of non selectable calendar cells to be skipped searching for a selectable cell in the current direction.


CHANGE_CURRENT_DATE_WHEN_YEAR_OR_MONTH_CHANGES

public static final CalendarProperty CHANGE_CURRENT_DATE_WHEN_YEAR_OR_MONTH_CHANGES
When this property is set to true the current selected date will be automatically changed when the year or month is changed through the visual controls. The value of this property defaults to false. Please note that setting this property to true will reset the selected date every time when the year or month is changed through the visual controls. This property was created for backward compatibility with the old versions of the calendar which automatically changed the current selected date when the year or month was changed through the visual controls.

Constructor Detail

CalendarComponent

public CalendarComponent()
Constructor for the CalendarComponent object.


CalendarComponent

public CalendarComponent(java.util.Date date)
Constructor for the CalendarComponent object.

Parameters:
date - The component date.
Method Detail

getCalendarProperty

public java.lang.Object getCalendarProperty(CalendarProperty calendarProperty)
Get the value of the specified calendar property.

Parameters:
calendarProperty - The property for which the value must be returned.
Returns:
The value for the specified property.

getLocaleCalendarProperty

public java.util.Locale getLocaleCalendarProperty(CalendarProperty calendarProperty)
Get the value of the specified calendar property as a Locale object. This is an alias of the getCalendarProperty function and returns directly the type of this property without forcing the user to cast the return type to the proper type.

Parameters:
calendarProperty - The property for which the value must be returned.
Returns:
The value for the specified property.

getIntegerCalendarProperty

public java.lang.Integer getIntegerCalendarProperty(CalendarProperty calendarProperty)
Get the value of the specified calendar property as an Integer object. This is an alias of the getCalendarProperty function and returns directly the type of this property without forcing the user to cast the return type to the proper type.

Parameters:
calendarProperty - The property for which the value must be returned.
Returns:
The value for the specified property.

getBooleanCalendarProperty

public java.lang.Boolean getBooleanCalendarProperty(CalendarProperty calendarProperty)
Get the value of the specified calendar property as a Boolean object. This is an alias of the getCalendarProperty function and returns directly the type of this property without forcing the user to cast the return type to the proper type.

Parameters:
calendarProperty - The property for which the value must be returned.
Returns:
The value for the specified property.

setCalendarProperty

public void setCalendarProperty(CalendarProperty calendarProperty,
                                java.lang.Object value)
                         throws CalendarPropertyException
Set the specified calendar property to the specified value. The value must be an instance of the class type defined by the specified calendar property.

Parameters:
calendarProperty - The property to be set.
value - The value to set for the specified property.
Throws:
CalendarPropertyException

getSupportedCalendarProperties

public CalendarProperty[] getSupportedCalendarProperties()
Get the list of properties suported.

Returns:
The list of properties supported.

getDate

public java.util.Date getDate()
Get the date.

Returns:
The date.

setDate

public void setDate(java.util.Date date)
Set the date.

Parameters:
date - The date.

addDateListener

public void addDateListener(DateListener dateListener)
Add a date listener.

Parameters:
dateListener - The date listener.

removeDateListener

public boolean removeDateListener(DateListener dateListener)
Remove a date listener.

Parameters:
dateListener - The date listener to be removed.

addCalendarComponentListener

public void addCalendarComponentListener(CalendarComponentListener calendarComponentListener)
Add a calendar component listener.

Parameters:
calendarComponentListener - The calendar component listener to be added.

removeCalendarComponentListener

public boolean removeCalendarComponentListener(CalendarComponentListener calendarComponentListener)
Remove a calendar component listener.

Parameters:
calendarComponentListener - The calendar component listener to be removed.

processCalendarEvent

public void processCalendarEvent(CalendarEvent calendarEvent)
Send an event to the calendar component.

Parameters:
calendarEvent - The event sent for processing to the calendar component.

setCalendarRendererProvider

public void setCalendarRendererProvider(CalendarRendererProvider calendarRendererProvider)
Set the calendar renderer provider. All the drawing operations on the calendar are performed using the calendar renderer provider.

Parameters:
calendarRendererProvider - The calendar renderer provider to be set.

getCalendarRendererProvider

public CalendarRendererProvider getCalendarRendererProvider()
Get the calendar renderer provider object used to render the calendar. All the drawing operations on the calendar are performed by a calendar renderer provider object.

Returns:
The calendar renderer provider set.

setCalendarMetricsProvider

public void setCalendarMetricsProvider(CalendarMetricsProvider calendarMetricsProvider)
Set the calendar metrics provider object used to calculate the calendar subcomponents sizes.

Parameters:
calendarMetricsProvider - The calendar metrics provider to be set.

getCalendarMetricsProvider

public CalendarMetricsProvider getCalendarMetricsProvider()
Get the calendar metrics provider object used to calculate the calendar subcomponents sizes.

Returns:
The calendar metrics provider set.

setCalendarSelectionModel

public void setCalendarSelectionModel(CalendarSelectionModel calendarSelectionModel)
Set the dates selection model. This handles the way it is made the dates selection.

Parameters:
calendarSelectionModel - The dates selection model to be set.

getCalendarSelectionModel

public CalendarSelectionModel getCalendarSelectionModel()
Get the dates selection model. This handles the way it is made the dates selection.

Returns:
The dates selection model set.

getCalendarSkin

public CalendarSkin getCalendarSkin()
Get the CalendarSkin object associated. All the drawing operations on the calendar table cells are performed using the graphic properties (colors, fonts) defined by the CalendarSkin object.

Returns:
The CalendarSkin object associated.

getCalendarView

public CalendarView getCalendarView()
Get the calendar view object containg informations about the calendar parts.

Returns:
The calendar view object containg informations about the calendar parts.

Calendar Component v5.1
www.calendarcomponent.com