Class WDatePicker
public class WDatePicker extends WCompositeWidget
A date picker shows a line edit and an icon which when clicked popups a WCalendar
for
editing the date. Any date entered in the line edit is reflected in the calendar, and vice-versa.
Each of these widgets may be accessed individually (getLineEdit()
, getCalendar()
, and getDisplayWidget()
) and there is a constructor that allows you to
specify an existing line edit and display widget.
The date format used by default is "dd/MM/yyyy"
and can be changed
using setFormat()
. At any time, the date set may be
read using getDate()
, or can be changed using setDate()
.
i18n
Internationalization of WDatePicker
is mostly handled through the internationalization
mechanism of WDate
.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Constructor Summary
Constructors Constructor Description WDatePicker()
Create a new date picker.WDatePicker(WContainerWidget parent)
Create a new date picker.WDatePicker(WInteractWidget displayWidget, WLineEdit forEdit)
Create a new date picker for existing line edit and with custom display widget.WDatePicker(WInteractWidget displayWidget, WLineEdit forEdit, WContainerWidget parent)
Create a new date picker for existing line edit and with custom display widget.WDatePicker(WLineEdit forEdit)
Create a new date picker for a line edit.WDatePicker(WLineEdit forEdit, WContainerWidget parent)
Create a new date picker for a line edit. -
Method Summary
Modifier and Type Method Description Signal
changed()
Signal emitted when the value has changed.WDate
getBottom()
Returns the bottom date of the valid range.WCalendar
getCalendar()
The calendar widget.WDate
getDate()
The current date.WInteractWidget
getDisplayWidget()
The display widget.java.lang.String
getFormat()
Returns the format.WLineEdit
getLineEdit()
The line edit.WPopupWidget
getPopupWidget()
The popup widget.WDate
getTop()
Returns the top date of the valid range.Signal
popupClosed()
A signal which indicates that the popup has been closed.void
remove()
Destructor.protected void
render(java.util.EnumSet<RenderFlag> flags)
Renders the widget.void
setBottom(WDate bottom)
Sets the bottom of the valid date range.void
setDate(WDate date)
Sets the current date.void
setDisabled(boolean disabled)
Sets whether the widget is disabled.void
setEnabled(boolean enabled)
Sets whether the widget is enabled.void
setFormat(java.lang.String format)
Sets the format used for parsing or writing the date in the line edit.void
setGlobalPopup(boolean anon1)
Deprecated.since 3.3.0, this does nothingvoid
setHidden(boolean hidden, WAnimation animation)
Hide/unhide the widget.void
setPopupVisible(boolean visible)
Shows or hides the popup.void
setTop(WDate top)
Sets the top of the valid date range.Methods inherited from class eu.webtoolkit.jwt.WCompositeWidget
addStyleClass, boxBorder, boxPadding, callJavaScriptMember, doJavaScript, enableAjax, find, findById, getAttributeValue, getBaseZIndex, getClearSides, getDecorationStyle, getFloatSide, getHeight, getId, getImplementation, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getObjectName, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getTakeImplementation, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, isCanReceiveFocus, isDisabled, isEnabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, load, propagateSetEnabled, propagateSetVisible, refresh, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setFloatSide, setFocus, setHiddenKeepsGeometry, setId, setImplementation, setInline, setJavaScriptMember, setLineHeight, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setPopup, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isLayoutSizeAware, isRendered, layoutSizeChanged, needsRerender, positionAt, positionAt, removeChild, removeStyleClass, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, setFormData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WDatePicker
Create a new date picker.This constructor creates a line edit with an icon that leads to a popup calendar. A
WDateValidator
is configured for the line edit. -
WDatePicker
public WDatePicker()Create a new date picker. -
WDatePicker
Create a new date picker for a line edit.This constructor creates an icon that leads to a popup calendar.
The
forEdit
argument is the lineEdit that works in conjunction with the date picker. This widget does not become part of the date picker, and may be located anywhere else. -
WDatePicker
Create a new date picker for a line edit. -
WDatePicker
Create a new date picker for existing line edit and with custom display widget.The
displayWidget
is a button or image which much be clicked to open the date picker. This widget will become owned by the picker.The
forEdit
argument is the lineEdit that works in conjunction with the date picker. This widget does not become part of the date picker, and may be located anywhere else. -
WDatePicker
Create a new date picker for existing line edit and with custom display widget.
-
-
Method Details
-
remove
public void remove()Destructor.- Overrides:
remove
in classWCompositeWidget
- See Also:
WContainerWidget.removeWidget(WWidget widget)
-
setFormat
public void setFormat(java.lang.String format)Sets the format used for parsing or writing the date in the line edit.Sets the format used for representing the date in the line edit. If the line edit has a
WDateValidator
configured for it, then also there the format is updated.The default format is
'dd/MM/yyyy'
.- See Also:
getFormat()
,WDate.toString()
-
getFormat
public java.lang.String getFormat()Returns the format.- See Also:
setFormat(String format)
-
getCalendar
The calendar widget.Returns the calendar widget.
-
getLineEdit
The line edit.Returns the line edit which works in conjunction with this date picker.
-
getDisplayWidget
The display widget.Returns the icon which activates the popup.
-
getPopupWidget
The popup widget.Returns the popup widget that contains the calendar.
-
getDate
The current date.Reads the current date from the
getLineEdit()
.Returns
null
if the date could not be parsed using the currentgetFormat()
.
- See Also:
setDate(WDate date)
,WLineEdit.getText()
-
setDate
Sets the current date.Does nothing if the current date is
Null
.- See Also:
getDate()
-
setEnabled
public void setEnabled(boolean enabled)Sets whether the widget is enabled.This is the oppositie of
setDisabled()
. -
setDisabled
public void setDisabled(boolean disabled)Description copied from class:WWidget
Sets whether the widget is disabled.Enables or disables the widget (including all its descendant widgets). setDisabled(false) will enable this widget and all descendant widgets that are not disabled. A widget is only enabled if it and all its ancestors in the widget tree are disabled.
Typically, a disabled form widget will not allow changing the value, and disabled widgets will not react to mouse click events.
- Overrides:
setDisabled
in classWCompositeWidget
- See Also:
WWidget.disable()
,WWidget.enable()
-
setHidden
Hide/unhide the widget.- Overrides:
setHidden
in classWCompositeWidget
-
setBottom
Sets the bottom of the valid date range. -
getBottom
Returns the bottom date of the valid range. -
setTop
Sets the top of the valid date range. -
getTop
Returns the top date of the valid range. -
changed
Signal emitted when the value has changed.This signal is emitted when a new date has been entered (either through the line edit, or through the calendar popup).
-
setGlobalPopup
public void setGlobalPopup(boolean anon1)Deprecated.since 3.3.0, this does nothingControls how the calendar popup is positioned. -
setPopupVisible
public void setPopupVisible(boolean visible)Shows or hides the popup. -
popupClosed
A signal which indicates that the popup has been closed.The signal is only fired when the popup has been closed by the user.
-
render
Description copied from class:WWidget
Renders the widget.This function renders the widget (or an update for the widget), after this has been scheduled using
scheduleRender()
.The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.
- Overrides:
render
in classWCompositeWidget
-