Class WColorPicker
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.WWidget
-
- eu.webtoolkit.jwt.WWebWidget
-
- eu.webtoolkit.jwt.WInteractWidget
-
- eu.webtoolkit.jwt.WFormWidget
-
- eu.webtoolkit.jwt.WColorPicker
-
public class WColorPicker extends WFormWidget
A widget that provides a browser-native color picker.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 withWColorvalues, ensure they have valid RGB values or the color picker will reset to #000000.WColorPicker is an
inlinewidget.- See Also:
WColor
-
-
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 WColorPicker()Creates 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventSignalcolorInput()Event signal emitted when the selected color is changed.WColorgetColor()Returns the current value of the color picker as aWColorobject.java.lang.StringgetValueText()Returns the current value of the color picker as a string.voidsetColor(WColor value)Sets the selected color.protected voidsetFormData(WObject.FormData formData)voidsetValueText(java.lang.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, getRealValidator, getTabIndex, getValidator, hasValidatorChanged, 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, 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, boxBorder, boxPadding, 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
-
WColorPicker
public WColorPicker(WContainerWidget parentContainer)
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
public WColorPicker(WColor color, WContainerWidget parentContainer)
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
public WColorPicker(WColor color)
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 Detail
-
getColor
public WColor getColor()
Returns the current value of the color picker as aWColorobject.- See Also:
setColor(WColor value)
-
setColor
public void setColor(WColor value)
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:
getColor()
-
colorInput
public EventSignal 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:
WFormWidget.changed()
-
getValueText
public java.lang.String getValueText()
Returns the current value of the color picker as a string.This is implemented as
return color().cssText();- Specified by:
getValueTextin classWFormWidget
-
setValueText
public void setValueText(java.lang.String value)
Sets the current value of the color picker as a string. The string must be in a format from whichWColorcan 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:
setValueTextin classWFormWidget
-
setFormData
protected void setFormData(WObject.FormData formData)
- Overrides:
setFormDatain classWObject
-
-