Class WColorPicker
To act upon color value changes, connect a slot to the WFormWidget.changed()
signal.
This signal is emitted when the user changes the selected color, and subsequently closes the
color picker.
To act upon any color change, connect a slot to the colorInput()
signal. Note that this signal may fire very quickly depending on how the
browser's color picker works.
At all times, the currently selected color may be accessed with the value() method.
The widget corresponds to the HTML <input type="color">
tag. Note
that this element does not support CSS color names. When manipulating this widget with WColor
values, ensure they have valid RGB values or the color picker will reset to #000000.
WColorPicker is an inline
widget.
- See Also:
-
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_
-
Constructor Summary
ConstructorDescriptionCreates a color picker with the default color of black (#000000).WColorPicker
(WColor color) Creates a color picker with the given color value.WColorPicker
(WColor color, WContainerWidget parentContainer) Creates a color picker with the given color value.WColorPicker
(WContainerWidget parentContainer) Creates a color picker with the default color of black (#000000). -
Method Summary
Modifier and TypeMethodDescriptionEvent signal emitted when the selected color is changed.getColor()
Returns the current value of the color picker as aWColor
object.Returns the current value of the color picker as a string.void
Sets the selected color.protected void
setFormData
(WObject.FormData formData) void
setValueText
(String value) Sets the current value of the color picker as a string.Methods inherited from class eu.webtoolkit.jwt.WFormWidget
changed, enableAjax, getLabel, getPlaceholderText, getTabIndex, getValidator, isCanReceiveFocus, isReadOnly, propagateSetEnabled, refresh, remove, render, setEnabled, setHidden, setPlaceholderText, setReadOnly, setToolTip, setValidator, validate, validated, validatorChanged
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, 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, getDomChanges, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, 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, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, 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
getObjectName
-
Constructor Details
-
WColorPicker
Creates a color picker with the default color of black (#000000). -
WColorPicker
public WColorPicker()Creates a color picker with the default color of black (#000000). -
WColorPicker
Creates a color picker with the given color value. Ensure the color has valid RGB values, or the color will be reset to #000000. -
WColorPicker
Creates a color picker with the given color value. Ensure the color has valid RGB values, or the color will be reset to #000000.
-
-
Method Details
-
getColor
Returns the current value of the color picker as aWColor
object.- See Also:
-
setColor
Sets the selected color.The default value is #000000 (black).
Ensure the color has valid RGB values, or the color will be reset to #000000.
- See Also:
-
colorInput
Event signal emitted when the selected color is changed.This signal is emitted whenever the selected color has changed. Unlike the
WFormWidget.changed()
signal, this signal is fired on every change, not only when the color picker is closed.In particular, on browsers with a draggable color picker (i.e. most common browsers), this signal fires every time the position changes. Use with caution.
- See Also:
-
getValueText
Returns the current value of the color picker as a string.This is implemented as
return color().cssText();
- Specified by:
getValueText
in classWFormWidget
-
setValueText
Sets the current value of the color picker as a string. The string must be in a format from whichWColor
can determine RGB values (i.e. not a CSS color name), or the value will be set to #000000.This is implemented as
setColor(WColor(value));
- Specified by:
setValueText
in classWFormWidget
-
setFormData
- Overrides:
setFormData
in classWObject
-