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:
ImageObserver, MenuContainer, Serializable

public class JCalendarPicker
extends JComponent

Author:
user
See Also:
Serialized Form

Nested Class Summary
static class JCalendarPicker.Mode
           
 
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
static String CALENDAR_PROPERTY_ID
           
static String CALENDARS_PROPERTY_ID
           
static String DISPLAYEDCALENDAR_PROPERTY_ID
           
protected  Calendar iCalendar
           
protected  List<Calendar> iCalendars
           
protected  JToggleButton[] iDateJToggleButton
           
protected  JLabel[] iDaynameJLabels
           
protected  Calendar iDisplayedCalendar
           
protected  Locale iLocale
           
protected  JCalendarPicker.Mode iMode
           
protected  AtomicInteger iModifying
           
protected  JSpinner iMonthJSpinner
           
protected  SpinnerListModel iMonthSpinnerModel
           
protected  Calendar iReferenceCalendar
           
protected  Color iWeekendLabelColor
           
protected  JLabel[] iWeeknumberJLabels
           
protected  JSpinner iYearJSpinner
           
protected  org.tbee.swing.JCalendarPicker.YearSpinnerModel iYearSpinnerModel
           
static String LOCALE_PROPERTY_ID
           
static String MODE_PROPERTY_ID
           
static String REFERENCECALENDAR_PROPERTY_ID
           
static 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(Calendar value)
           
protected  void constructGUI()
           
protected  JPanel constructGUIMonth()
           
protected  JPanel constructGUIPicker()
           
protected  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
 Calendar getCalendar()
          Calendar: the last selected
 List<Calendar> getCalendars()
          Calendars: all selected calendars (depends on the selection mode)
 Calendar getDisplayedCalendar()
          ReferenceCalendar: determines how the component looks like e.g.
 Locale getLocale()
          Locale: determines the language of the labels
 JCalendarPicker.Mode getMode()
          Mode: single, range or multiple
protected  List<String> getMonthNames()
           
 Calendar getReferenceCalendar()
          ReferenceCalendar: determines how the component looks like e.g.
 Color getWeekendLabelColor()
          WeekendLabelColor: single, range or multiple
protected  List<Integer> getWeekLabels()
          Get a list with the weeklabels
 boolean isModifying()
           
 boolean isSelected(Calendar calendar)
          determine if a date is selected
protected  boolean isToday(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(Calendar value)
           
 void setCalendar(Calendar value)
           
 void setCalendars(List<Calendar> value)
           
 void setDisplayedCalendar(Calendar value)
           
 void setLocale(Locale value)
           
 void setMode(JCalendarPicker.Mode value)
           
 void setReferenceCalendar(Calendar value)
           
 void setWeekendLabelColor(Color value)
           
 JCalendarPicker withCalendar(Calendar value)
           
 JCalendarPicker withCalendars(List<Calendar> value)
           
 JCalendarPicker withLocale(Locale value)
           
 JCalendarPicker withMode(JCalendarPicker.Mode value)
           
 JCalendarPicker withReferenceCalendar(Calendar value)
           
 JCalendarPicker withWeekendLabelColor(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 Calendar iCalendar

CALENDAR_PROPERTY_ID

public static final String CALENDAR_PROPERTY_ID
See Also:
Constant Field Values

iCalendars

protected volatile List<Calendar> iCalendars

CALENDARS_PROPERTY_ID

public static final String CALENDARS_PROPERTY_ID
See Also:
Constant Field Values

iReferenceCalendar

protected volatile Calendar iReferenceCalendar

REFERENCECALENDAR_PROPERTY_ID

public static final String REFERENCECALENDAR_PROPERTY_ID
See Also:
Constant Field Values

iLocale

protected volatile Locale iLocale

LOCALE_PROPERTY_ID

public static final String LOCALE_PROPERTY_ID
See Also:
Constant Field Values

iMode

protected volatile JCalendarPicker.Mode iMode

MODE_PROPERTY_ID

public static final String MODE_PROPERTY_ID
See Also:
Constant Field Values

iWeekendLabelColor

protected volatile Color iWeekendLabelColor

WEEKENDLABELCOLOR_PROPERTY_ID

public static final String WEEKENDLABELCOLOR_PROPERTY_ID
See Also:
Constant Field Values

iDisplayedCalendar

protected volatile Calendar iDisplayedCalendar

DISPLAYEDCALENDAR_PROPERTY_ID

public static final String DISPLAYEDCALENDAR_PROPERTY_ID
See Also:
Constant Field Values

iModifying

protected volatile AtomicInteger iModifying

iYearJSpinner

protected JSpinner iYearJSpinner

iYearSpinnerModel

protected org.tbee.swing.JCalendarPicker.YearSpinnerModel iYearSpinnerModel

iMonthJSpinner

protected JSpinner iMonthJSpinner

iMonthSpinnerModel

protected SpinnerListModel iMonthSpinnerModel

iDaynameJLabels

protected JLabel[] iDaynameJLabels

iWeeknumberJLabels

protected JLabel[] iWeeknumberJLabels

iDateJToggleButton

protected JToggleButton[] iDateJToggleButton
Constructor Detail

JCalendarPicker

public JCalendarPicker()
Method Detail

getCalendar

public Calendar getCalendar()
Calendar: the last selected


setCalendar

public void setCalendar(Calendar value)

withCalendar

public JCalendarPicker withCalendar(Calendar value)

getCalendars

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


setCalendars

public void setCalendars(List<Calendar> value)

withCalendars

public JCalendarPicker withCalendars(List<Calendar> value)

addCalendar

public void addCalendar(Calendar value)

removeCalendar

public void removeCalendar(Calendar value)

getReferenceCalendar

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


setReferenceCalendar

public void setReferenceCalendar(Calendar value)

withReferenceCalendar

public JCalendarPicker withReferenceCalendar(Calendar value)

getLocale

public Locale getLocale()
Locale: determines the language of the labels

Overrides:
getLocale in class Component

setLocale

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

withLocale

public JCalendarPicker withLocale(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(Calendar calendar)
determine if a date is selected


isModifying

public boolean isModifying()
Returns:

getWeekendLabelColor

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


setWeekendLabelColor

public void setWeekendLabelColor(Color value)

withWeekendLabelColor

public JCalendarPicker withWeekendLabelColor(Color value)

getDisplayedCalendar

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


setDisplayedCalendar

public void setDisplayedCalendar(Calendar value)

constructGUI

protected void constructGUI()

constructGUIYear

protected JPanel constructGUIYear()
Returns:

constructGUIMonth

protected JPanel constructGUIMonth()
Returns:

constructGUIPicker

protected JPanel constructGUIPicker()
Returns:

refreshLabels

protected void refreshLabels()

refreshCalendar

protected void refreshCalendar()

refreshSelection

public void refreshSelection()

getMonthNames

protected List<String> getMonthNames()
Returns:

getWeekLabels

protected List<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(Calendar calendar)
determine if a date is today



Copyright © 2011 KnowledgePlaza. All Rights Reserved.