|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WWidget
eu.webtoolkit.jwt.WCompositeWidget
eu.webtoolkit.jwt.WDatePicker
public class WDatePicker
A date picker.
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().
Internationalization of WDatePicker is mostly handled through the
internationalization mechanism of WDate. The
'Close' button can be internationalized by overriding the default
value for the localization key Wt.DatePicker.Close.
The date picker is styled by the current CSS theme. The look can be
overridden using the Wt-datepicker and Wt-outset
CSS class; the calendar itself can be styled as documented in
WCalendar.
Example of a WDatePicker (default theme) |
Example of a WDatePicker (polished theme) |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
WDate |
getTop()
Returns the top date of the valid range. |
void |
remove()
Destructor. |
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 global)
Controls how the calendar popup is positioned. |
void |
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.WWidget |
|---|
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, isRendered, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, 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, getObjectName, setObjectName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WDatePicker(WContainerWidget parent)
This constructor creates a line edit with an icon that leads to a popup
calendar. A WDateValidator is configured for the line edit.
public WDatePicker()
Calls this((WContainerWidget)null)
public WDatePicker(WInteractWidget displayWidget,
WLineEdit forEdit,
WContainerWidget parent)
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.
public WDatePicker(WInteractWidget displayWidget,
WLineEdit forEdit)
Calls
this(displayWidget, forEdit, (WContainerWidget)null)
| Method Detail |
|---|
public void remove()
remove in class WCompositeWidgetWContainerWidget.removeWidget(WWidget widget)public void setFormat(java.lang.String format)
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'.
getFormat(),
WDate.toString()public java.lang.String getFormat()
setFormat(String format)public WCalendar getCalendar()
Returns the calendar widget.
public WLineEdit getLineEdit()
Returns the line edit which works in conjunction with this date picker.
public WInteractWidget getDisplayWidget()
Returns the widget which is displayed to activate the calendar.
public WDate getDate()
Reads the current date from the getLineEdit().
Returns null if the date could not be parsed using the
current getFormat().
setDate(WDate date),
WDate.fromString(String s),
WLineEdit.getText()public void setDate(WDate date)
Does nothing if the current date is Null.
getDate()public void setEnabled(boolean enabled)
This is the oppositie of setDisabled().
public void setDisabled(boolean disabled)
WWidgetEnables 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.
setDisabled in class WCompositeWidgetWWidget.disable(),
WWidget.enable()
public void setHidden(boolean hidden,
WAnimation animation)
setHidden in class WCompositeWidgetpublic void setBottom(WDate bottom)
public WDate getBottom()
public void setTop(WDate top)
public WDate getTop()
public Signal changed()
This signal is emitted when a new date has been entered (either through the line edit, or through the calendar popup).
public void setGlobalPopup(boolean global)
When global is true, then the popup will
position itself globally. This avoids that the popup is affected by
enclosing parents with overflow settings that clip the popup. This makes
the popup however no longer follow the popup button when this button
moves.
The default is false.
public void setPopupVisible(boolean visible)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||