uic.widgets.calendar
Class UICDatePicker

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 uic.widgets.calendar.UICDatePickerBase
                      extended by uic.widgets.calendar.UICDatePicker
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class UICDatePicker
extends UICDatePickerBase

A widget for selection a date with a little more intelligence than the UICCalendar. Also this widget is wrapped around a UICCalendar.

To change the month for the date picker you can use the month selector that pops up if the month button is clicked. Also to roll one month down or up you can use the '<' and '>' buttons. Another way to roll months up or down is by using the navigation of the embedded UICCalendar.
To change the year for the date picker you can use the year input field that pops up when the year button is clicked. It is also possible to roll one year down or up by using the '<<' and '>>' buttons.
You can change the week for the date picker by using the week input field that pups up when the week button is clicked.

By specifing a locale you can decide which locale should be used to display the date picker. If we should specify the Dutch locale (nl, NL) for example the date picker and it's month selector would look like this:

Since:
2.0
Author:
Stefan Rotman
See Also:
Serialized Form

Nested Class Summary
protected  class UICDatePicker.SpecialPopup
          A wrapper for the popping components.
 
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
 
Fields inherited from class uic.widgets.calendar.UICDatePickerBase
bMonth, bMonthAction, bNextMonth, bNextMonthAction, bNextYear, bNextYearAction, bPrevMonth, bPrevMonthAction, bPrevYear, bPrevYearAction, calendar, sDate, weekPanel, yearPanel
 
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
  UICDatePicker()
          Constructs a new UICDatePicker with the default locale and today as the selected date.
  UICDatePicker(Locale locale, Calendar cal)
          Constructs a new UICDatePicker with the specified locale and Calendar to use as selected date.
protected UICDatePicker(UICCalendarModel model)
          Construcs a new UICDatePicker that uses the specified model.
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds the specified listener to the ActionListener list.
 void bMonthPressedSlot()
          Called if the month button is pressed.
 void bNextMonthPressedSlot()
          Called if the next-month-button is pressed.
 void bNextYearPressedSlot()
          Called if the next-year-button is pressed.
 void bPrevMonthPressedSlot()
          Called if the previous-month-button is pressed.
 void bPrevYearPressedSlot()
          Called if the previous-year-button is pressed.
 Calendar getCalendar()
           
 int getDate()
           
 UICCalendarModel getModel()
           
 int getMonth()
           
 boolean getShowWeekNrs()
          Returns whether or not weeknrs should be shown.
 int getWeek()
           
 int getYear()
           
protected  void guiInit()
          intizlize the gui.
static void main(String[] args)
           
 void removeActionListener(ActionListener listener)
          Removes the specified listener from the ActionListener list.
protected  void resetEditComponent()
           
 void sDateEnteredSlot()
          Called if enter is inputted in the sDate textfield.
 void setCalendar(Calendar calendar)
           
 void setDate(int date)
           
 void setMonth(int month)
           
 void setShowWeekNrs(boolean showWeekNrs)
          Configure whether or not the calendar component should show weeknumbers.
 void setWeek(int week)
           
 void setYear(int year)
           
 void syncWithModelSlot()
          Called whenever the UICCalendarModel fires a PropertyChangedEvent, to make sure the UICDatePicker UI represents the Model correct.
 TranslationInterface translate()
           
 void updateNextPrevButtonsSlot()
           
 void weekInputEnteredSlot(Object newWeekValue)
           
 void yearInputEnteredSlot()
           
 
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, setEnabled, setFocusTraversalKeys, setFont, 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
 

Constructor Detail

UICDatePicker

public UICDatePicker()
Constructs a new UICDatePicker with the default locale and today as the selected date.


UICDatePicker

public UICDatePicker(Locale locale,
                     Calendar cal)
Constructs a new UICDatePicker with the specified locale and Calendar to use as selected date.

Parameters:
locale - the locale to use.
cal - the date to select.

UICDatePicker

protected UICDatePicker(UICCalendarModel model)
Construcs a new UICDatePicker that uses the specified model.

Method Detail

guiInit

protected void guiInit()
intizlize the gui.

Overrides:
guiInit in class UICDatePickerBase

syncWithModelSlot

public void syncWithModelSlot()
Called whenever the UICCalendarModel fires a PropertyChangedEvent, to make sure the UICDatePicker UI represents the Model correct. The user should never have to call this.


updateNextPrevButtonsSlot

public void updateNextPrevButtonsSlot()

sDateEnteredSlot

public void sDateEnteredSlot()
Called if enter is inputted in the sDate textfield.


bPrevYearPressedSlot

public void bPrevYearPressedSlot()
Called if the previous-year-button is pressed.

Overrides:
bPrevYearPressedSlot in class UICDatePickerBase

bNextYearPressedSlot

public void bNextYearPressedSlot()
Called if the next-year-button is pressed.

Overrides:
bNextYearPressedSlot in class UICDatePickerBase

bPrevMonthPressedSlot

public void bPrevMonthPressedSlot()
Called if the previous-month-button is pressed.

Overrides:
bPrevMonthPressedSlot in class UICDatePickerBase

bNextMonthPressedSlot

public void bNextMonthPressedSlot()
Called if the next-month-button is pressed.

Overrides:
bNextMonthPressedSlot in class UICDatePickerBase

yearInputEnteredSlot

public void yearInputEnteredSlot()

bMonthPressedSlot

public void bMonthPressedSlot()
Called if the month button is pressed.

Overrides:
bMonthPressedSlot in class UICDatePickerBase

resetEditComponent

protected void resetEditComponent()

weekInputEnteredSlot

public void weekInputEnteredSlot(Object newWeekValue)

setShowWeekNrs

public void setShowWeekNrs(boolean showWeekNrs)
Configure whether or not the calendar component should show weeknumbers.

Parameters:
showWeekNrs - if true weeknumbers should be shown; if false not.

getShowWeekNrs

public boolean getShowWeekNrs()
Returns whether or not weeknrs should be shown.


translate

public TranslationInterface translate()
Overrides:
translate in class UICDatePickerBase

getModel

public UICCalendarModel getModel()

setCalendar

public void setCalendar(Calendar calendar)

getCalendar

public Calendar getCalendar()

setYear

public void setYear(int year)

getYear

public int getYear()

setMonth

public void setMonth(int month)

getMonth

public int getMonth()

setDate

public void setDate(int date)

getDate

public int getDate()

setWeek

public void setWeek(int week)

getWeek

public int getWeek()

addActionListener

public void addActionListener(ActionListener listener)
Adds the specified listener to the ActionListener list. Action listeners will be notified on date selections.

Parameters:
listener - the listener to add.

removeActionListener

public void removeActionListener(ActionListener listener)
Removes the specified listener from the ActionListener list.

Parameters:
listener - the listener to remove.

main

public static void main(String[] args)


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence