org.tbee.swing
Class JCalendarPicker

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.tbee.swing.JCalendarPicker
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JCalendarPicker
extends javax.swing.JComponent

Author:
user
See Also:
Serialized Form

Nested Class Summary
static class JCalendarPicker.Mode
           
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String CALENDAR_PROPERTY_ID
           
static java.lang.String CALENDARS_PROPERTY_ID
           
static java.lang.String DISPLAYEDCALENDAR_PROPERTY_ID
           
protected  java.util.Calendar iCalendar
           
protected  java.util.List<java.util.Calendar> iCalendars
           
protected  javax.swing.JToggleButton[] iDateJToggleButton
           
protected  javax.swing.JLabel[] iDaynameJLabels
           
protected  java.util.Calendar iDisplayedCalendar
           
protected  java.util.Locale iLocale
           
protected  JCalendarPicker.Mode iMode
           
protected  java.util.concurrent.atomic.AtomicInteger iModifying
           
protected  JSpinner iMonthJSpinner
           
protected  javax.swing.SpinnerListModel iMonthSpinnerModel
           
protected  java.util.Calendar iReferenceCalendar
           
protected  java.awt.Color iWeekendLabelColor
           
protected  javax.swing.JLabel[] iWeeknumberJLabels
           
protected  JSpinner iYearJSpinner
           
protected  org.tbee.swing.JCalendarPicker.YearSpinnerModel iYearSpinnerModel
           
static java.lang.String LOCALE_PROPERTY_ID
           
static java.lang.String MODE_PROPERTY_ID
           
static java.lang.String REFERENCECALENDAR_PROPERTY_ID
           
static java.lang.String WEEKENDLABELCOLOR_PROPERTY_ID
           
 
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
JCalendarPicker()
           
 
Method Summary
 void addCalendar(java.util.Calendar value)
           
protected  void constructGUI()
           
protected  javax.swing.JPanel constructGUIMonth()
           
protected  javax.swing.JPanel constructGUIPicker()
           
protected  javax.swing.JPanel constructGUIYear()
           
protected  int determineDaysInMonth()
          determine the number of days in the month
protected  int determineFirstOfMonthDayOfWeek()
          determine on which day of week idx the first of the months is
 java.util.Calendar getCalendar()
          Calendar: the last selected
 java.util.List<java.util.Calendar> getCalendars()
          Calendars: all selected calendars (depends on the selection mode)
 java.util.Calendar getDisplayedCalendar()
          ReferenceCalendar: determines how the component looks like e.g.
 java.util.Locale getLocale()
          Locale: determines the language of the labels
 JCalendarPicker.Mode getMode()
          Mode: single, range or multiple
protected  java.util.List<java.lang.String> getMonthNames()
           
 java.util.Calendar getReferenceCalendar()
          ReferenceCalendar: determines how the component looks like e.g.
 java.awt.Color getWeekendLabelColor()
          WeekendLabelColor: single, range or multiple
protected  java.util.List<java.lang.Integer> getWeekLabels()
          Get a list with the weeklabels
 boolean isModifying()
           
 boolean isSelected(java.util.Calendar calendar)
          determine if a date is selected
protected  boolean isToday(java.util.Calendar calendar)
          determine if a date is today
protected  boolean isWeekday(int idx, int weekdaynr)
          check if a certain weekday name is a certain day-of-the-week
protected  boolean isWeekdayWeekend(int idx)
          check if a certain weekday name is a certain day-of-the-week
protected  void refreshCalendar()
           
protected  void refreshLabels()
           
 void refreshSelection()
           
 void removeCalendar(java.util.Calendar value)
           
 void setCalendar(java.util.Calendar value)
           
 void setCalendars(java.util.List<java.util.Calendar> value)
           
 void setDisplayedCalendar(java.util.Calendar value)
           
 void setLocale(java.util.Locale value)
           
 void setMode(JCalendarPicker.Mode value)
           
 void setReferenceCalendar(java.util.Calendar value)
           
 void setWeekendLabelColor(java.awt.Color value)
           
 JCalendarPicker withCalendar(java.util.Calendar value)
           
 JCalendarPicker withCalendars(java.util.List<java.util.Calendar> value)
           
 JCalendarPicker withLocale(java.util.Locale value)
           
 JCalendarPicker withMode(JCalendarPicker.Mode value)
           
 JCalendarPicker withReferenceCalendar(java.util.Calendar value)
           
 JCalendarPicker withWeekendLabelColor(java.awt.Color value)
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, 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, 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

iCalendar

protected volatile java.util.Calendar iCalendar

CALENDAR_PROPERTY_ID

public static final java.lang.String CALENDAR_PROPERTY_ID
See Also:
Constant Field Values

iCalendars

protected volatile java.util.List<java.util.Calendar> iCalendars

CALENDARS_PROPERTY_ID

public static final java.lang.String CALENDARS_PROPERTY_ID
See Also:
Constant Field Values

iReferenceCalendar

protected volatile java.util.Calendar iReferenceCalendar

REFERENCECALENDAR_PROPERTY_ID

public static final java.lang.String REFERENCECALENDAR_PROPERTY_ID
See Also:
Constant Field Values

iLocale

protected volatile java.util.Locale iLocale

LOCALE_PROPERTY_ID

public static final java.lang.String LOCALE_PROPERTY_ID
See Also:
Constant Field Values

iMode

protected volatile JCalendarPicker.Mode iMode

MODE_PROPERTY_ID

public static final java.lang.String MODE_PROPERTY_ID
See Also:
Constant Field Values

iWeekendLabelColor

protected volatile java.awt.Color iWeekendLabelColor

WEEKENDLABELCOLOR_PROPERTY_ID

public static final java.lang.String WEEKENDLABELCOLOR_PROPERTY_ID
See Also:
Constant Field Values

iDisplayedCalendar

protected volatile java.util.Calendar iDisplayedCalendar

DISPLAYEDCALENDAR_PROPERTY_ID

public static final java.lang.String DISPLAYEDCALENDAR_PROPERTY_ID
See Also:
Constant Field Values

iModifying

protected volatile java.util.concurrent.atomic.AtomicInteger iModifying

iYearJSpinner

protected JSpinner iYearJSpinner

iYearSpinnerModel

protected org.tbee.swing.JCalendarPicker.YearSpinnerModel iYearSpinnerModel

iMonthJSpinner

protected JSpinner iMonthJSpinner

iMonthSpinnerModel

protected javax.swing.SpinnerListModel iMonthSpinnerModel

iDaynameJLabels

protected javax.swing.JLabel[] iDaynameJLabels

iWeeknumberJLabels

protected javax.swing.JLabel[] iWeeknumberJLabels

iDateJToggleButton

protected javax.swing.JToggleButton[] iDateJToggleButton
Constructor Detail

JCalendarPicker

public JCalendarPicker()
Method Detail

getCalendar

public java.util.Calendar getCalendar()
Calendar: the last selected


setCalendar

public void setCalendar(java.util.Calendar value)

withCalendar

public JCalendarPicker withCalendar(java.util.Calendar value)

getCalendars

public java.util.List<java.util.Calendar> getCalendars()
Calendars: all selected calendars (depends on the selection mode)


setCalendars

public void setCalendars(java.util.List<java.util.Calendar> value)

withCalendars

public JCalendarPicker withCalendars(java.util.List<java.util.Calendar> value)

addCalendar

public void addCalendar(java.util.Calendar value)

removeCalendar

public void removeCalendar(java.util.Calendar value)

getReferenceCalendar

public java.util.Calendar getReferenceCalendar()
ReferenceCalendar: determines how the component looks like e.g. first day of week


setReferenceCalendar

public void setReferenceCalendar(java.util.Calendar value)

withReferenceCalendar

public JCalendarPicker withReferenceCalendar(java.util.Calendar value)

getLocale

public java.util.Locale getLocale()
Locale: determines the language of the labels

Overrides:
getLocale in class java.awt.Component

setLocale

public void setLocale(java.util.Locale value)
Overrides:
setLocale in class java.awt.Component

withLocale

public JCalendarPicker withLocale(java.util.Locale value)

getMode

public JCalendarPicker.Mode getMode()
Mode: single, range or multiple


setMode

public void setMode(JCalendarPicker.Mode value)

withMode

public JCalendarPicker withMode(JCalendarPicker.Mode value)

isSelected

public boolean isSelected(java.util.Calendar calendar)
determine if a date is selected


isModifying

public boolean isModifying()
Returns:

getWeekendLabelColor

public java.awt.Color getWeekendLabelColor()
WeekendLabelColor: single, range or multiple


setWeekendLabelColor

public void setWeekendLabelColor(java.awt.Color value)

withWeekendLabelColor

public JCalendarPicker withWeekendLabelColor(java.awt.Color value)

getDisplayedCalendar

public java.util.Calendar getDisplayedCalendar()
ReferenceCalendar: determines how the component looks like e.g. first day of week


setDisplayedCalendar

public void setDisplayedCalendar(java.util.Calendar value)

constructGUI

protected void constructGUI()

constructGUIYear

protected javax.swing.JPanel constructGUIYear()
Returns:

constructGUIMonth

protected javax.swing.JPanel constructGUIMonth()
Returns:

constructGUIPicker

protected javax.swing.JPanel constructGUIPicker()
Returns:

refreshLabels

protected void refreshLabels()

refreshCalendar

protected void refreshCalendar()

refreshSelection

public void refreshSelection()

getMonthNames

protected java.util.List<java.lang.String> getMonthNames()
Returns:

getWeekLabels

protected java.util.List<java.lang.Integer> getWeekLabels()
Get a list with the weeklabels


isWeekday

protected boolean isWeekday(int idx,
                            int weekdaynr)
check if a certain weekday name is a certain day-of-the-week


isWeekdayWeekend

protected boolean isWeekdayWeekend(int idx)
check if a certain weekday name is a certain day-of-the-week


determineFirstOfMonthDayOfWeek

protected int determineFirstOfMonthDayOfWeek()
determine on which day of week idx the first of the months is


determineDaysInMonth

protected int determineDaysInMonth()
determine the number of days in the month


isToday

protected boolean isToday(java.util.Calendar calendar)
determine if a date is today



Copyright © 2010 KnowledgePlaza. All Rights Reserved.