Class sap.ui.commons.ColorPickerModule: sap/ui/commons/ColorPicker

extends Control

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.

Constructor Summary
new sap.ui.commons.ColorPicker(sId?, mSettings?)Constructor for a new ColorPicker.
Event Summary
change(oControlEvent)Value was changed.
liveChange(oControlEvent)Value was changed.
Events borrowed from class sap.ui.core.Control
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.
sap.ui.commons.ColorPicker.getMetadata()Returns a metadata object for class sap.ui.commons.ColorPicker.
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.
getColorString()Gets current value of property colorString.
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.
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
sap.ui.commons.ColorPicker.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.ColorPicker.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachChange(oData?, fnFunction, oListener?): sap.ui.commons.ColorPicker
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:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining
attachLiveChange(oData?, fnFunction, oListener?): sap.ui.commons.ColorPicker
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:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining
detachChange(fnFunction, oListener): sap.ui.commons.ColorPicker
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:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining
detachLiveChange(fnFunction, oListener): sap.ui.commons.ColorPicker
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:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining
fireChange(mArguments?): sap.ui.commons.ColorPicker
Fires event change to attached listeners.

Expects the following event parameters:

  • r of type intParameter containing the RED value (0-255)
  • g of type intParameter containing the GREEN value (0-255)
  • b of type intParameter containing the BLUE value (0-255)
  • h of type intParameter containing the HUE value (0-360)
  • s of type intParameter containing the SATURATION value (0-100)
  • v of type intParameter containing the VALUE value (0-100)
  • l of type intParameter containing the LIGHTNESS value (0-100)
  • hex of type stringParameter containing the Hexadecimal string (#FFFFFF)
  • alpha of type stringParameter containing the alpha value (transparency)
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining
fireLiveChange(mArguments?): sap.ui.commons.ColorPicker
Fires event liveChange to attached listeners.

Expects the following event parameters:

  • r of type intParameter containing the RED value (0-255)
  • g of type intParameter containing the GREEN value (0-255)
  • b of type intParameter containing the BLUE value (0-255)
  • h of type intParameter containing the HUE value (0-360)
  • s of type intParameter containing the SATURATION value (0-100)
  • v of type intParameter containing the VALUE value (0-100)
  • l of type intParameter containing the LIGHTNESS value (0-100)
  • hex of type stringParameter containing the Hexadecimal string (#FFFFFF)
  • alpha of type stringParameter containing the alpha value (transparency)
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining
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:
{sap.ui.commons.ColorPickerMode} Value of property mode
getRGB(): object
Deliver current RGB-values.
Returns:
{object}
setColorString(sColorString): sap.ui.commons.ColorPicker
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:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining
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:
{sap.ui.commons.ColorPickerMode}sMode New value for property mode
Since:
1.38.1
Returns:
{sap.ui.commons.ColorPicker} Reference to this in order to allow method chaining