pivot.wtk
Class CalendarButton

java.lang.Object
  extended by pivot.wtk.Component
      extended by pivot.wtk.Button
          extended by pivot.wtk.CalendarButton
All Implemented Interfaces:
ConstrainedVisual, Visual

public class CalendarButton
extends Button

A component that allows a user to select a calendar date. The calendar is hidden until the user pushes the button.

Author:
tvolkert, gbrown

Nested Class Summary
 
Nested classes/interfaces inherited from class pivot.wtk.Button
Button.DataRenderer, Button.Group, Button.GroupListener, Button.State
 
Nested classes/interfaces inherited from class pivot.wtk.Component
Component.Attributes, Component.ComponentDictionary, Component.DecoratorSequence, Component.StyleDictionary
 
Field Summary
static java.lang.String COUNTRY_KEY
           
static java.lang.String LANGUAGE_KEY
           
static java.lang.String VARIANT_KEY
           
 
Constructor Summary
CalendarButton()
           
CalendarButton(java.lang.Object buttonData)
           
 
Method Summary
 ListenerList<CalendarButtonListener> getCalendarButtonListeners()
          Returns the calendar button listener list.
 ListenerList<CalendarButtonSelectionListener> getCalendarButtonSelectionListeners()
          Returns the calendar button selection listener list.
 java.util.Locale getLocale()
          Returns the locale used to present calendar data.
 CalendarDate getSelectedDate()
          Returns the currently selected date.
 java.lang.String getSelectedDateKey()
          Gets the data binding key that is set on this calendar button.
 void load(Dictionary<java.lang.String,?> context)
          Loads the selected date from the specified bind context using this date picker button's bind key, if one is set.
 void setLocale(Dictionary<java.lang.String,?> locale)
          Sets the locale used to present calendar data.
 void setLocale(java.util.Locale locale)
          Sets the locale used to present calendar data.
 void setLocale(java.lang.String locale)
          Sets the locale used to present calendar data.
 void setSelectedDate(CalendarDate selectedDate)
          Sets the selected date.
 void setSelectedDate(java.lang.String selectedDate)
          Sets the selected date to the date represented by the specified date string.
 void setSelectedDateKey(java.lang.String selectedDateKey)
          Sets this calendar button's data binding key.
 void setToggleButton(boolean toggleButton)
          Sets the button's toggle state.
 void store(Dictionary<java.lang.String,?> context)
          Stores the selected date into the specified bind context using this date picker button's bind key, if one is set.
 
Methods inherited from class pivot.wtk.Button
getAction, getButtonData, getButtonListeners, getButtonPressListeners, getButtonStateListeners, getDataRenderer, getGroup, getGroup, getSelectedKey, getState, getStateKey, isSelected, isToggleButton, isTriState, press, setAction, setAction, setButtonData, setDataRenderer, setEnabled, setGroup, setGroup, setSelected, setSelectedKey, setState, setState, setStateKey, setTriState
 
Methods inherited from class pivot.wtk.Component
clearFocus, clearFocus, finalize, getAttributes, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentDragDropListeners, getComponentKeyListeners, getComponentLayoutListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponents, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getHandle, getHeight, getLocation, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installSkin, invalidate, isBlocked, isDisplayable, isEnabled, isFocusable, isFocused, isMouseOver, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, mapPointFromAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttributes, setCursor, setCursor, setDisplayable, setDragSource, setDropTarget, setFocused, setLocation, setLocation, setParent, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyles, setStyles, setStyles, setTooltipText, setUserData, setVisible, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LANGUAGE_KEY

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

COUNTRY_KEY

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

VARIANT_KEY

public static final java.lang.String VARIANT_KEY
See Also:
Constant Field Values
Constructor Detail

CalendarButton

public CalendarButton()

CalendarButton

public CalendarButton(java.lang.Object buttonData)
Method Detail

setToggleButton

public void setToggleButton(boolean toggleButton)
Description copied from class: Button
Sets the button's toggle state.

Overrides:
setToggleButton in class Button
Throws:
java.lang.UnsupportedOperationException - This method is not supported by CalendarButton.

getSelectedDate

public CalendarDate getSelectedDate()
Returns the currently selected date.

Returns:
The currently selected date, or null if nothing is selected.

setSelectedDate

public void setSelectedDate(CalendarDate selectedDate)
Sets the selected date.

Parameters:
selectedDate - The date to select, or null to clear the selection.

setSelectedDate

public final void setSelectedDate(java.lang.String selectedDate)
Sets the selected date to the date represented by the specified date string. The date string must be in the ISO 8601 "calendar date" format, which is [YYYY]-[MM]-[DD].

Parameters:
selectedDate - A string in the form of [YYYY]-[MM]-[DD] (e.g. 2008-07-23)

getSelectedDateKey

public java.lang.String getSelectedDateKey()
Gets the data binding key that is set on this calendar button.


setSelectedDateKey

public void setSelectedDateKey(java.lang.String selectedDateKey)
Sets this calendar button's data binding key.


getLocale

public java.util.Locale getLocale()
Returns the locale used to present calendar data.


setLocale

public void setLocale(java.util.Locale locale)
Sets the locale used to present calendar data.

Parameters:
locale -

setLocale

public void setLocale(Dictionary<java.lang.String,?> locale)
Sets the locale used to present calendar data.

Parameters:
locale - An dictionary containing values for language, country, and variant. Country and variant are optional but the must adhere to the following rules:
  • If variant is specified, language and country are required;
  • Otherwise, if country is specified, language is required;
  • Otherwise, language is required.

setLocale

public void setLocale(java.lang.String locale)
Sets the locale used to present calendar data.

Parameters:
locale - A JSON map containing values for language, country, and variant.
See Also:
setLocale(Dictionary)

load

public void load(Dictionary<java.lang.String,?> context)
Loads the selected date from the specified bind context using this date picker button's bind key, if one is set.

Overrides:
load in class Button

store

public void store(Dictionary<java.lang.String,?> context)
Stores the selected date into the specified bind context using this date picker button's bind key, if one is set.

Overrides:
store in class Button

getCalendarButtonListeners

public ListenerList<CalendarButtonListener> getCalendarButtonListeners()
Returns the calendar button listener list.


getCalendarButtonSelectionListeners

public ListenerList<CalendarButtonSelectionListener> getCalendarButtonSelectionListeners()
Returns the calendar button selection listener list.