This control gives the user the opportunity to choose a color. The color can be defined using HEX-, RGB- or HSV-values or a CSS colorname.
Deprecated API:Since version 1.38.
Event Summary
change(oControlEvent)Value was changed. Method Summary
sap.ui.commons.ColorPicker.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.ColorPicker with name sClassName
and enriches it with the information contained in oClassInfo
. attachChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the change
event of this sap.ui.commons.ColorPicker
. attachLiveChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the liveChange
event of this sap.ui.commons.ColorPicker
. detachChange(fnFunction, oListener)Detaches event handler fnFunction
from the change
event of this sap.ui.commons.ColorPicker
. detachLiveChange(fnFunction, oListener)Detaches event handler fnFunction
from the liveChange
event of this sap.ui.commons.ColorPicker
. fireChange(mArguments?)Fires event change
to attached listeners. fireLiveChange(mArguments?)Fires event liveChange
to attached listeners. getMode()Gets current value of property mode
. getRGB()Deliver current RGB-values. setColorString(sColorString)Sets a new value for property colorString
. setMode(sMode)Sets a new value for property mode
. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getAccessibilityInfo,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
invalidate,
isBusy,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.ui.commons.ColorPicker(sId?, mSettings?)
Constructor for a new ColorPicker.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- Events
- change : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- liveChange : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
Parameters:
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
- Deprecated:
- Since version 1.38.
Event Detail
change(oControlEvent)
Value was changed. This event is fired if the value has changed by an user action.
Parameters:
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{int} | oControlEvent.getParameters.r | Parameter containing the RED value (0-255) |
{int} | oControlEvent.getParameters.g | Parameter containing the GREEN value (0-255) |
{int} | oControlEvent.getParameters.b | Parameter containing the BLUE value (0-255) |
{int} | oControlEvent.getParameters.h | Parameter containing the HUE value (0-360) |
{int} | oControlEvent.getParameters.s | Parameter containing the SATURATION value (0-100) |
{int} | oControlEvent.getParameters.v | Parameter containing the VALUE value (0-100) |
{int} | oControlEvent.getParameters.l | Parameter containing the LIGHTNESS value (0-100) |
{string} | oControlEvent.getParameters.hex | Parameter containing the Hexadecimal string (#FFFFFF) |
{string} | oControlEvent.getParameters.alpha | Parameter containing the alpha value (transparency) |
liveChange(oControlEvent)
Value was changed. This event is fired during the mouse move. The normal change event ist only fired by mouseup.
Parameters:
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{int} | oControlEvent.getParameters.r | Parameter containing the RED value (0-255) |
{int} | oControlEvent.getParameters.g | Parameter containing the GREEN value (0-255) |
{int} | oControlEvent.getParameters.b | Parameter containing the BLUE value (0-255) |
{int} | oControlEvent.getParameters.h | Parameter containing the HUE value (0-360) |
{int} | oControlEvent.getParameters.s | Parameter containing the SATURATION value (0-100) |
{int} | oControlEvent.getParameters.v | Parameter containing the VALUE value (0-100) |
{int} | oControlEvent.getParameters.l | Parameter containing the LIGHTNESS value (0-100) |
{string} | oControlEvent.getParameters.hex | Parameter containing the Hexadecimal string (#FFFFFF) |
{string} | oControlEvent.getParameters.alpha | Parameter containing the alpha value (transparency) |
Method Detail
sap.ui.commons.ColorPicker.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.commons.ColorPicker with name
sClassName
and enriches it with the information contained in
oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.ui.commons.ColorPicker.
Returns:
Attaches event handler
fnFunction
to the
change
event of this
sap.ui.commons.ColorPicker
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.commons.ColorPicker
itself.
Value was changed. This event is fired if the value has changed by an user action.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.commons.ColorPicker itself |
Returns:
Attaches event handler
fnFunction
to the
liveChange
event of this
sap.ui.commons.ColorPicker
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.commons.ColorPicker
itself.
Value was changed. This event is fired during the mouse move. The normal change event ist only fired by mouseup.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.ui.commons.ColorPicker itself |
Returns:
Detaches event handler
fnFunction
from the
change
event of this
sap.ui.commons.ColorPicker
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
liveChange
event of this
sap.ui.commons.ColorPicker
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Fires event
change
to attached listeners.
Expects the following event parameters:
r
of type int
Parameter containing the RED value (0-255)g
of type int
Parameter containing the GREEN value (0-255)b
of type int
Parameter containing the BLUE value (0-255)h
of type int
Parameter containing the HUE value (0-360)s
of type int
Parameter containing the SATURATION value (0-100)v
of type int
Parameter containing the VALUE value (0-100)l
of type int
Parameter containing the LIGHTNESS value (0-100)hex
of type string
Parameter containing the Hexadecimal string (#FFFFFF)alpha
of type string
Parameter containing the alpha value (transparency)
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event
liveChange
to attached listeners.
Expects the following event parameters:
r
of type int
Parameter containing the RED value (0-255)g
of type int
Parameter containing the GREEN value (0-255)b
of type int
Parameter containing the BLUE value (0-255)h
of type int
Parameter containing the HUE value (0-360)s
of type int
Parameter containing the SATURATION value (0-100)v
of type int
Parameter containing the VALUE value (0-100)l
of type int
Parameter containing the LIGHTNESS value (0-100)hex
of type string
Parameter containing the Hexadecimal string (#FFFFFF)alpha
of type string
Parameter containing the alpha value (transparency)
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getColorString(): string
Gets current value of property
colorString
.
This is the import-parameter of the ColorPicker. As input-parameter, it can be a Hexadecimal string (#FFFFFF), a RGB-string rgb(255,255,255), a HSV-string hsv(360,100,100) or a CSS-colorname 'red'. As output-parameter it is a RGB-string containing the current color.
Returns:
{string} | Value of property colorString |
Gets current value of property
mode
.
Determines the mode the ColorPicker works with - Hue Saturation and Value (HSV) or Hue Saturation and Lightness (HSL)
Default value is HSV
.
- Since:
- 1.38.1
Returns:
getRGB(): object
Deliver current RGB-values.
Returns:
Sets a new value for property
colorString
.
This is the import-parameter of the ColorPicker. As input-parameter, it can be a Hexadecimal string (#FFFFFF), a RGB-string rgb(255,255,255), a HSV-string hsv(360,100,100) or a CSS-colorname 'red'. As output-parameter it is a RGB-string containing the current color.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sColorString | New value for property colorString |
Returns:
Sets a new value for property
mode
.
Determines the mode the ColorPicker works with - Hue Saturation and Value (HSV) or Hue Saturation and Lightness (HSL)
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is HSV
.
Parameters:
- Since:
- 1.38.1
Returns: