org.rapla.components.calendar
Class RaplaCalendar

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 org.rapla.components.calendar.RaplaComboBox
                      extended by org.rapla.components.calendar.RaplaCalendar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public final class RaplaCalendar
extends RaplaComboBox

This is another ComboBox-like calendar component. It is localizable and it uses swing-components.

The combobox editor is a DateField. If the ComboBox-Button is pressed, a CalendarMenu will drop down.

Author:
Christopher Kohlhaas
See Also:
CalendarMenu, DateField, 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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  CalendarMenu m_calendarMenu
           
protected  DateField m_dateField
           
protected  org.rapla.components.calendar.DateModel m_model
           
 
Fields inherited from class org.rapla.components.calendar.RaplaComboBox
jLabel, m_editorComponent, m_popupButton
 
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
RaplaCalendar()
          Create a new Calendar with the default locale.
RaplaCalendar(Locale locale)
          Create a new Calendar with the specified locale and the default timeZone.
RaplaCalendar(Locale locale, boolean isDropDown)
          Deprecated. replaced with #RaplaCalendar(Locale,TimeZone,boolean)
RaplaCalendar(Locale locale, TimeZone timeZone)
          Create a new Calendar with the specified locale and timezone.
RaplaCalendar(Locale locale, TimeZone timeZone, boolean isDropDown)
          Create a new Calendar with the specified locale and timezone.
 
Method Summary
 void addDateChangeListener(DateChangeListener listener)
          registers new DateChangeListener for this component.
protected  void fireDateChange(Date date)
          A DateChangeEvent will be fired to every registered DateChangeListener when the a different date is selected.
 Date getDate()
          Parse the returned date with a calendar-object set to the correct time-zone to get the date,month and year.
 DateChangeListener[] getDateChangeListeners()
           
 int getDay()
           
 int getMonth()
           
 JComponent getPopupComponent()
          the component that should apear in the popup menu
 TimeZone getTimeZone()
           
 int getYear()
           
 void removeDateChangeListener(DateChangeListener listener)
          removes a listener from this component.
 void select(int day, int month, int year)
          selects the specified day, month and year.
 void setDate(Date date)
          Selects the date relative to the given timezone.
 void setDateRenderer(DateRenderer dateRenderer)
          sets the DateRenderer for the calendar
 void setFont(Font font)
           
 void setHighlightWeekend(boolean bHighlight)
          Deprecated. use setDateRenderer(new WeekendHighlightRenderer()) instead.
 void setTimeZone(TimeZone timeZone)
           
 void setWeekdaysVisibleInDateField(boolean bVisible)
          you can choose, if weekdays should be displayed in the right corner of the DateField.
protected  void showPopup()
           
protected  void validateEditor()
           
 
Methods inherited from class org.rapla.components.calendar.RaplaComboBox
closePopup, getLabel, setEnabled
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, 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, doLayout, 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, 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

m_dateField

protected DateField m_dateField

m_calendarMenu

protected CalendarMenu m_calendarMenu

m_model

protected org.rapla.components.calendar.DateModel m_model
Constructor Detail

RaplaCalendar

public RaplaCalendar()
Create a new Calendar with the default locale. The calendarmenu will be accessible via a drop-down-box


RaplaCalendar

public RaplaCalendar(Locale locale)
Create a new Calendar with the specified locale and the default timeZone. The calendarmenu will be accessible via a drop-down-box


RaplaCalendar

public RaplaCalendar(Locale locale,
                     boolean isDropDown)
Deprecated. replaced with #RaplaCalendar(Locale,TimeZone,boolean)


RaplaCalendar

public RaplaCalendar(Locale locale,
                     TimeZone timeZone)
Create a new Calendar with the specified locale and timezone. The calendarmenu will be accessible via a drop-down-box


RaplaCalendar

public RaplaCalendar(Locale locale,
                     TimeZone timeZone,
                     boolean isDropDown)
Create a new Calendar with the specified locale and timezone. The isDropDown flag specifies if the calendarmenu should be accessible via a drop-down-box. Alternatively you can get the calendarmenu with getPopupComponent().

Method Detail

setTimeZone

public void setTimeZone(TimeZone timeZone)

getTimeZone

public TimeZone getTimeZone()

getPopupComponent

public JComponent getPopupComponent()
Description copied from class: RaplaComboBox
the component that should apear in the popup menu

Specified by:
getPopupComponent in class RaplaComboBox

setFont

public void setFont(Font font)
Overrides:
setFont in class RaplaComboBox

setDate

public void setDate(Date date)
Selects the date relative to the given timezone. The hour,minute,second and millisecond values will be ignored.


getDate

public Date getDate()
Parse the returned date with a calendar-object set to the correct time-zone to get the date,month and year. The hour,minute,second and millisecond values should be ignored.

Returns:
the selected date
See Also:
getYear(), getMonth(), getDay()

select

public void select(int day,
                   int month,
                   int year)
selects the specified day, month and year.

See Also:
setDate(Date date)

setHighlightWeekend

public void setHighlightWeekend(boolean bHighlight)
Deprecated. use setDateRenderer(new WeekendHighlightRenderer()) instead.

you can choose, if you want to highlight the weekends. Default is true. If flag is set to true a new WeekendHighlightRenderer will be installed. If flag is set to false the DateRenderer will be uninstalled.


setDateRenderer

public void setDateRenderer(DateRenderer dateRenderer)
sets the DateRenderer for the calendar


setWeekdaysVisibleInDateField

public void setWeekdaysVisibleInDateField(boolean bVisible)
you can choose, if weekdays should be displayed in the right corner of the DateField. Default is true. This method simply calls setWeekdaysVisble on the DateField Component. If a DateRender is installed the weekday will be rendered with the DateRenderer. This includes a tooltip that shows up on the DateRenderer.

See Also:
DateField

getYear

public int getYear()
Returns:
the selected year (relative to the given TimeZone)
See Also:
getDate(), getMonth(), getDay()

getMonth

public int getMonth()
Returns:
the selected month (relative to the given TimeZone)
See Also:
getDate(), getYear(), getDay()

getDay

public int getDay()
Returns:
the selected day (relative to the given TimeZone)
See Also:
getDate(), getYear(), getMonth()

addDateChangeListener

public void addDateChangeListener(DateChangeListener listener)
registers new DateChangeListener for this component. A DateChangeEvent will be fired to every registered DateChangeListener when the a different date is selected.

See Also:
DateChangeListener, DateChangeEvent

removeDateChangeListener

public void removeDateChangeListener(DateChangeListener listener)
removes a listener from this component.


getDateChangeListeners

public DateChangeListener[] getDateChangeListeners()

fireDateChange

protected void fireDateChange(Date date)
A DateChangeEvent will be fired to every registered DateChangeListener when the a different date is selected.


showPopup

protected void showPopup()
Overrides:
showPopup in class RaplaComboBox

validateEditor

protected void validateEditor()


Copyright © 2000-2006 Rapla Team. All Rights Reseserved.