Class WTimeEdit
- java.lang.Object
-
public class WTimeEdit extends WLineEdit
A Time field editor.Styling through CSS is not applicable. A native HTML5 control can be used by means of
setNativeControl().Note: Using the native HTML5 control forces the format
HH:mmorHH:mm:ss. The user will not be aware of this, since the control offers them a view dependent on their locale.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Field Summary
-
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefault
-
Fields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS
-
-
Constructor Summary
Constructors Constructor Description WTimeEdit()Creates a new time edit.WTimeEdit(WContainerWidget parentContainer)Creates a new time edit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WTimegetBottom()Returns the lower limit of the valid time range.java.lang.StringgetFormat()Returns the format.intgetHourStep()Returns the step size for the hours.intgetMillisecondStep()Returns the step size for the milliseconds.intgetMinuteStep()Returns the step size for the minutes.intgetSecondStep()Returns the step size for the seconds.WTimegetTime()Returns the time.WTimeValidatorgetTimeValidator()Returns the validator.WTimegetTop()Returns the upper limit of the valid time range.protected java.lang.StringgetType()booleanisNativeControl()Returns whether a native HTML5 control is used.booleanisWrapAroundEnabled()Returns whether wraparound is enabled.voidload()Loads content just before the widget is used.protected voidpropagateSetEnabled(boolean enabled)Propagates that a widget was enabled or disabled through children.voidremove()Destructor.protected voidrender(java.util.EnumSet<RenderFlag> flags)Renders the widget.voidsetBottom(WTime bottom)Sets the lower limit of the valid time range.voidsetFormat(java.lang.String format)Sets the format of the Time.voidsetHidden(boolean hidden, WAnimation animation)Sets the hidden state of this widget.voidsetHourStep(int step)Sets the step size for the hours.voidsetMillisecondStep(int step)Sets the step size for the milliseconds.voidsetMinuteStep(int step)Sets the step size for the minutes.voidsetNativeControl(boolean nativeControl)Changes whether the native HTML5 control is used.voidsetSecondStep(int step)Sets the step size for the seconds.voidsetTime(WTime time)Sets the time.voidsetTop(WTime top)Sets the upper limit of the valid time range.voidsetWrapAroundEnabled(boolean enabled)Enables or disables wraparound.protected voidvalidatorChanged()-
Methods inherited from class eu.webtoolkit.jwt.WLineEdit
boxBorder, boxPadding, getAutoCompleteToken, getCursorPosition, getDisplayText, getDomChanges, getEchoMode, getInputMask, getInputMode, getMaxLength, getSelectedText, getSelectionStart, getText, getTextSize, getValueText, hasSelectedText, isAutoComplete, setAutoComplete, setAutoComplete, setEchoMode, setFormData, setInputMask, setInputMask, setInputMask, setInputMask, setInputMode, setMaxLength, setSelection, setText, setTextSize, setValueText, textInput, validate
-
Methods inherited from class eu.webtoolkit.jwt.WFormWidget
changed, enableAjax, getLabel, getPlaceholderText, getRealValidator, getTabIndex, getValidator, hasValidatorChanged, isCanReceiveFocus, isReadOnly, refresh, setEnabled, setPlaceholderText, setReadOnly, setToolTip, setValidator, validated
-
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggable
-
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, createDomElement, doJavaScript, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, hideToolTip, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, iterateChildren, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, removeScript, removeStyleClass, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setVerticalAlignment, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
-
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, 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
getObjectName
-
-
-
-
Constructor Detail
-
WTimeEdit
public WTimeEdit(WContainerWidget parentContainer)
Creates a new time edit.
-
WTimeEdit
public WTimeEdit()
Creates a new time edit.
-
-
Method Detail
-
remove
public void remove()
Description copied from class:WFormWidgetDestructor.- Overrides:
removein classWFormWidget- See Also:
WWidget.removeWidget(WWidget widget)
-
setTime
public void setTime(WTime time)
Sets the time.Does nothing if the current time is
Null.- See Also:
getTime()
-
getTime
public WTime getTime()
Returns the time.Returns an invalid time (for which
WTime.isValid()returnsfalse) if the time could not be parsed using the currentgetFormat().- See Also:
setTime(WTime time),WLineEdit.getText()
-
setFormat
public void setFormat(java.lang.String format)
Sets the format of the Time.This sets the format in the validator.
When the native HTML5 control is used, the format is limited to
HH:mm:ssorHH:mm. Changing to another format has no effect.
-
getFormat
public java.lang.String getFormat()
Returns the format.
-
setHidden
public void setHidden(boolean hidden, WAnimation animation)Description copied from class:WFormWidgetSets the hidden state of this widget.If the widget has a label, it is hidden and shown together with this widget.
- Overrides:
setHiddenin classWFormWidget
-
setNativeControl
public void setNativeControl(boolean nativeControl)
Changes whether the native HTML5 control is used.When enabled the browser's native time input (
<input type="time">) will be used if available. This should provide a better experience on mobile browsers. This option is set to false by default.Calling native control after the widget is rendered is not supported.
Setting native control to true requires both
HH:mm:ssandHH:mmto be valid formats. The format can be set by either the validator, or directly withsetFormat().Once the format is set, the step will be automatically calculated. This indicates the minimum increment in seconds or minutes that is valid input.
When setting native control to true the setters for the steps will no longer do anything.
-
isNativeControl
public boolean isNativeControl()
Returns whether a native HTML5 control is used.When active, the format of the input it limited to
HH:mmorHH:mm:ss. The step is set to60, or1respectively, specifying the granularity of the input to a minute or a second.- See Also:
setNativeControl(boolean nativeControl)
-
setBottom
public void setBottom(WTime bottom)
Sets the lower limit of the valid time range.
-
getBottom
public WTime getBottom()
Returns the lower limit of the valid time range.
-
setTop
public void setTop(WTime top)
Sets the upper limit of the valid time range.
-
getTop
public WTime getTop()
Returns the upper limit of the valid time range.
-
setHourStep
public void setHourStep(int step)
Sets the step size for the hours.It has no effect if a native HTML5 control is used.
- See Also:
setNativeControl(boolean nativeControl)
-
getHourStep
public int getHourStep()
Returns the step size for the hours.
-
setMinuteStep
public void setMinuteStep(int step)
Sets the step size for the minutes.It has no effect if a native HTML5 control is used.
- See Also:
setNativeControl(boolean nativeControl)
-
getMinuteStep
public int getMinuteStep()
Returns the step size for the minutes.
-
setSecondStep
public void setSecondStep(int step)
Sets the step size for the seconds.It has no effect if a native HTML5 control is used.
- See Also:
setNativeControl(boolean nativeControl)
-
getSecondStep
public int getSecondStep()
Returns the step size for the seconds.
-
setMillisecondStep
public void setMillisecondStep(int step)
Sets the step size for the milliseconds.It has no effect if a native HTML5 control is used.
- See Also:
setNativeControl(boolean nativeControl)
-
getMillisecondStep
public int getMillisecondStep()
Returns the step size for the milliseconds.
-
setWrapAroundEnabled
public void setWrapAroundEnabled(boolean enabled)
Enables or disables wraparound.It has no effect if a native HTML5 control is used.
Wraparound is enabled by default
-
isWrapAroundEnabled
public boolean isWrapAroundEnabled()
Returns whether wraparound is enabled.
-
load
public void load()
Description copied from class:WWidgetLoads content just before the widget is used.This function is called when a widget is inserted in the widget hierarchy. Widgets that get inserted in the widget hierarchy will be rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground (or not for a plain HTML session). This method is called when the widget is directly or indirectly inserted into the widget tree.
The default implementation simply propagates the load signal to its children. You may want to override this method to delay loading of resource-intensive contents.
During the life-time of a widget, this method may be called multiple times, so you should make sure that you do a deferred initialization only once.
- Overrides:
loadin classWInteractWidget
-
getTimeValidator
public WTimeValidator getTimeValidator()
Returns the validator.Note: Using the validator to change the format while a native control is being used will break the native control. If a native control is used, do not call WTimeValidator()::setFormat(), instead use
setFormat().- See Also:
WTimeValidator(),setFormat(String format)
-
render
protected void render(java.util.EnumSet<RenderFlag> flags)
Description copied from class:WWidgetRenders 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.
-
propagateSetEnabled
protected void propagateSetEnabled(boolean enabled)
Description copied from class:WWidgetPropagates that a widget was enabled or disabled through children.When enabling or disabling a widget, you usually also want to disable contained children. This method is called by
setDisabled()to propagate its state to all children.You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.
- Overrides:
propagateSetEnabledin classWFormWidget
-
validatorChanged
protected void validatorChanged()
- Overrides:
validatorChangedin classWFormWidget
-
-