Package org.apache.pivot.wtk
Class CalendarButton
- java.lang.Object
-
- org.apache.pivot.wtk.Component
-
- org.apache.pivot.wtk.Button
-
- org.apache.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CalendarButton.Skin
CalendarButton skin interface.-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Button
Button.ButtonDataBindMapping, Button.DataRenderer, Button.SelectedBindMapping, Button.State, Button.StateBindMapping
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COUNTRY_KEY
static java.lang.String
LANGUAGE_KEY
static java.lang.String
VARIANT_KEY
-
Constructor Summary
Constructors Constructor Description CalendarButton()
CalendarButton(int year, int month)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears any bound values in the component.void
clearSelection()
Clears the selection.ListenerList<CalendarButtonBindingListener>
getCalendarButtonBindingListeners()
ListenerList<CalendarButtonListener>
getCalendarButtonListeners()
ListenerList<CalendarButtonSelectionListener>
getCalendarButtonSelectionListeners()
Filter<CalendarDate>
getDisabledDateFilter()
Window
getListPopup()
java.util.Locale
getLocale()
int
getMonth()
CalendarDate
getSelectedDate()
Returns the currently selected date.Calendar.SelectedDateBindMapping
getSelectedDateBindMapping()
BindType
getSelectedDateBindType()
java.lang.String
getSelectedDateKey()
int
getYear()
void
load(java.lang.Object context)
Copies bound values from the bind context to the component.void
setDisabledDateFilter(Filter<CalendarDate> disabledDateFilter)
void
setLocale(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(Dictionary<java.lang.String,?> locale)
Sets the locale used to present calendar data.void
setMonth(int month)
Sets this calendar's month.void
setSelectedDate(java.lang.String selectedDate)
Sets the selected date to the date represented by the specified date string.void
setSelectedDate(CalendarDate selectedDate)
Sets the selected date.void
setSelectedDateBindMapping(Calendar.SelectedDateBindMapping bindMapping)
void
setSelectedDateBindType(BindType selectedDateBindType)
void
setSelectedDateKey(java.lang.String selectedDateKey)
Sets this calendar button's data binding key.protected void
setSkin(Skin skin)
Sets the skin, replacing any previous skin.void
setToggleButton(boolean toggleButton)
Sets the button's toggle state.void
setYear(int year)
Sets this calendar's year.void
store(java.lang.Object context)
Copies bound values from the component to the bind context.-
Methods inherited from class org.apache.pivot.wtk.Button
getAction, getButtonBindingListeners, getButtonData, getButtonDataBindMapping, getButtonDataBindType, getButtonDataKey, getButtonGroup, getButtonListeners, getButtonPressListeners, getButtonStateListeners, getDataRenderer, getQueuedActionDelay, getSelectedBindMapping, getSelectedBindType, getSelectedKey, getState, getStateBindMapping, getStateBindType, getStateKey, isQueuedAction, isSelected, isToggleButton, isTriState, press, setAction, setAction, setButtonData, setButtonDataBindMapping, setButtonDataBindType, setButtonDataKey, setButtonGroup, setDataRenderer, setEnabled, setQueuedAction, setQueuedActionDelay, setSelected, setSelectedBindMapping, setSelectedBindType, setSelectedKey, setState, setStateBindMapping, setStateBindType, setStateKey, setTriState
-
Methods inherited from class org.apache.pivot.wtk.Component
checkSkin, clearFocus, contains, copyStyle, copyStyle, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getScreenBounds, getSize, getSkin, getStyle, getStyle, getStyleBoolean, getStyleBoolean, getStyleColor, getStyleColor, getStyleFont, getStyleFont, getStyleInt, getStyleInt, getStyles, getTextInputMethodListener, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, layout, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, offsetToScreen, paint, putStyle, putStyle, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setAutomationID, setCursor, setDragSource, setDropTarget, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setParent, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setVisible, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate
-
-
-
-
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
-
-
Method Detail
-
setSkin
protected void setSkin(Skin skin)
Description copied from class:Component
Sets the skin, replacing any previous skin.
-
getListPopup
public Window getListPopup()
- Returns:
- the popup window associated with this components skin
-
setToggleButton
@UnsupportedOperation public void setToggleButton(boolean toggleButton)
Description copied from class:Button
Sets the button's toggle state.- Overrides:
setToggleButton
in classButton
- Parameters:
toggleButton
- Whether or not this should be a toggle button.- Throws:
java.lang.UnsupportedOperationException
- This method is not supported by CalendarButton.
-
getYear
public int getYear()
- Returns:
- The year to which this calendar button is currently set.
-
setYear
public void setYear(int year)
Sets this calendar's year.- Parameters:
year
- The new current year for this calendar button.
-
getMonth
public int getMonth()
- Returns:
- The month to which this calendar button is currently set.
-
setMonth
public void setMonth(int month)
Sets this calendar's month.- Parameters:
month
- The new month value to set this calendar button to.
-
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, ornull
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 theISO 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)- Throws:
java.lang.IllegalArgumentException
- if the selected data value isnull
.
-
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
- The new locale used to format/present the data.- Throws:
java.lang.IllegalArgumentException
- if the given locale isnull
.
-
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.
- Throws:
java.lang.IllegalArgumentException
- if the given locale dictionary isnull
.
-
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.- Throws:
java.lang.IllegalArgumentException
- if the locale string isnull
or if there is a problem parsing the string.- See Also:
setLocale(Dictionary)
-
getDisabledDateFilter
public Filter<CalendarDate> getDisabledDateFilter()
-
setDisabledDateFilter
public void setDisabledDateFilter(Filter<CalendarDate> disabledDateFilter)
-
getSelectedDateKey
public java.lang.String getSelectedDateKey()
- Returns:
- 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.- Parameters:
selectedDateKey
- The new binding key for the calendar's selected date.
-
getSelectedDateBindType
public BindType getSelectedDateBindType()
-
setSelectedDateBindType
public void setSelectedDateBindType(BindType selectedDateBindType)
-
getSelectedDateBindMapping
public Calendar.SelectedDateBindMapping getSelectedDateBindMapping()
-
setSelectedDateBindMapping
public void setSelectedDateBindMapping(Calendar.SelectedDateBindMapping bindMapping)
-
load
public void load(java.lang.Object context)
Description copied from class:Component
Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.
-
store
public void store(java.lang.Object context)
Description copied from class:Component
Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.
-
clear
public void clear()
Description copied from class:Component
Clears any bound values in the component. This functionality must be provided by the subclass; the base implementation is a no-op.
-
clearSelection
public void clearSelection()
Clears the selection.
-
getCalendarButtonListeners
public ListenerList<CalendarButtonListener> getCalendarButtonListeners()
- Returns:
- The calendar button listener list.
-
getCalendarButtonSelectionListeners
public ListenerList<CalendarButtonSelectionListener> getCalendarButtonSelectionListeners()
- Returns:
- The calendar button selection listener list.
-
getCalendarButtonBindingListeners
public ListenerList<CalendarButtonBindingListener> getCalendarButtonBindingListeners()
- Returns:
- The calendar button binding listener list.
-
-