Class ColorPicker

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasCloseClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMaximizeClickHandlers, HasMinimizeClickHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRestoreClickHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, HasColorChangedHandlers, HasColorSelectedHandlers, HasMembersChangedHandlers

public class ColorPicker extends Window implements HasColorChangedHandlers, HasColorSelectedHandlers
The ColorPicker widget allows the user to select a color from anywhere in the color spectrum. It also supports selecting the alpha (opacity) value of the color. The picker supports a simple mode - which allows for one-click selection from a standard palette of colors - and a complex mode which allow the user to define any conceivable color. It is possible for the user to switch from simple mode to complex by interacting with the widget. In general, the widget provides very similar functionality to the color picker dialogs found in graphics packages and other desktop software.
  • Constructor Details

    • ColorPicker

      public ColorPicker()
    • ColorPicker

      public ColorPicker(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static ColorPicker getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class Window
    • setAllowComplexMode

      public ColorPicker setAllowComplexMode(Boolean allowComplexMode) throws IllegalStateException
      Should the "complex" mode be allowed for this ColorPicker? If false, no "More" button is shown on the simple picker
      Parameters:
      allowComplexMode - New allowComplexMode value. Default value is true
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getAllowComplexMode

      public Boolean getAllowComplexMode()
      Should the "complex" mode be allowed for this ColorPicker? If false, no "More" button is shown on the simple picker
      Returns:
      Current allowComplexMode value. Default value is true
    • setAutoCenterOnShow

      public ColorPicker setAutoCenterOnShow(Boolean autoCenterOnShow) throws IllegalStateException
      If autoPosition is false, this property controls whether to automatically center the colorPicker every time it is redisplayed with the show() method.
      Parameters:
      autoCenterOnShow - New autoCenterOnShow value. Default value is true
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getAutoCenterOnShow

      public Boolean getAutoCenterOnShow()
      If autoPosition is false, this property controls whether to automatically center the colorPicker every time it is redisplayed with the show() method.
      Returns:
      Current autoCenterOnShow value. Default value is true
      See Also:
    • setAutoHide

      public ColorPicker setAutoHide(Boolean autoHide) throws IllegalStateException
      When this property is set to true, the ColorPicker will automatically hide when a color has been selected using the swatch picker, even in "complex" mode. By default it will only hide the ColorPicker in "simple" defaultPickMode.

      Set this property to false to disable the ColorPicker from automatically hiding, this can be especially useful when for instance embedding this component inside another component.

      Parameters:
      autoHide - New autoHide value. Default value is null
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getAutoHide

      public Boolean getAutoHide()
      When this property is set to true, the ColorPicker will automatically hide when a color has been selected using the swatch picker, even in "complex" mode. By default it will only hide the ColorPicker in "simple" defaultPickMode.

      Set this property to false to disable the ColorPicker from automatically hiding, this can be especially useful when for instance embedding this component inside another component.

      Returns:
      Current autoHide value. Default value is null
      See Also:
    • setAutoPosition

      public ColorPicker setAutoPosition(Boolean autoPosition) throws IllegalStateException
      If true, causes the ColorPicker to appear near where the mouse was last clicked. If false, the ColorPicker is centered on first show; depending on the value of autoCenterOnShow, it either reappears wherever it was last shown after hide/show(), or centered regardless of where it was last shown.
      Parameters:
      autoPosition - New autoPosition value. Default value is true
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getAutoPosition

      public Boolean getAutoPosition()
      If true, causes the ColorPicker to appear near where the mouse was last clicked. If false, the ColorPicker is centered on first show; depending on the value of autoCenterOnShow, it either reappears wherever it was last shown after hide/show(), or centered regardless of where it was last shown.
      Returns:
      Current autoPosition value. Default value is true
      See Also:
    • setBasicColorLabel

      public ColorPicker setBasicColorLabel(String basicColorLabel) throws IllegalStateException
      The label shown above the basic color blocks.
      Parameters:
      basicColorLabel - New basicColorLabel value. Default value is "Basic Colors:"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getBasicColorLabel

      public String getBasicColorLabel()
      The label shown above the basic color blocks.
      Returns:
      Current basicColorLabel value. Default value is "Basic Colors:"
      See Also:
    • setBlueFieldPrompt

      public ColorPicker setBlueFieldPrompt(String blueFieldPrompt) throws IllegalStateException
      The text to show when the mouse hovers over the 'Blue' field in the complex chooser.
      Parameters:
      blueFieldPrompt - New blueFieldPrompt value. Default value is "The Blue component of the selected color"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getBlueFieldPrompt

      public String getBlueFieldPrompt()
      The text to show when the mouse hovers over the 'Blue' field in the complex chooser.
      Returns:
      Current blueFieldPrompt value. Default value is "The Blue component of the selected color"
      See Also:
    • setBlueFieldTitle

      public ColorPicker setBlueFieldTitle(String blueFieldTitle) throws IllegalStateException
      The title for the 'Blue' field in the complex chooser.
      Parameters:
      blueFieldTitle - New blueFieldTitle value. Default value is "Blue"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getBlueFieldTitle

      public String getBlueFieldTitle()
      The title for the 'Blue' field in the complex chooser.
      Returns:
      Current blueFieldTitle value. Default value is "Blue"
      See Also:
    • getCancelButton

      public IButton getCancelButton() throws IllegalStateException
      Cancel button for the ColorPicker

      This component is an AutoChild named "cancelButton". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current cancelButton value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setCancelButtonTitle

      public ColorPicker setCancelButtonTitle(String cancelButtonTitle) throws IllegalStateException
      The title for the 'Cancel' button.
      Parameters:
      cancelButtonTitle - New cancelButtonTitle value. Default value is "Cancel"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getCancelButtonTitle

      public String getCancelButtonTitle()
      The title for the 'Cancel' button.
      Returns:
      Current cancelButtonTitle value. Default value is "Cancel"
      See Also:
    • setColorArray

      public ColorPicker setColorArray(String[] colorArray) throws IllegalStateException
      Array of 40 HTML color strings, used to render the basic color selection boxes.
      Parameters:
      colorArray - New colorArray value. Default value is [...]
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getColorArray

      public String[] getColorArray()
      Array of 40 HTML color strings, used to render the basic color selection boxes.
      Returns:
      Current colorArray value. Default value is [...]
    • setColorButtonBaseStyle

      public ColorPicker setColorButtonBaseStyle(String colorButtonBaseStyle) throws IllegalStateException
      Base CSS style applied to the basic color boxes
      Parameters:
      colorButtonBaseStyle - New colorButtonBaseStyle value. Default value is "ColorChooserCell"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getColorButtonBaseStyle

      public String getColorButtonBaseStyle()
      Base CSS style applied to the basic color boxes
      Returns:
      Current colorButtonBaseStyle value. Default value is "ColorChooserCell"
      See Also:
    • setColorButtonSize

      public ColorPicker setColorButtonSize(int colorButtonSize) throws IllegalStateException
      Width and height of the basic color boxes (they are always square, and they are all the same size).
      Parameters:
      colorButtonSize - New colorButtonSize value. Default value is 20
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getColorButtonSize

      public int getColorButtonSize()
      Width and height of the basic color boxes (they are always square, and they are all the same size).
      Returns:
      Current colorButtonSize value. Default value is 20
    • setCrosshairImageURL

      public ColorPicker setCrosshairImageURL(String crosshairImageURL) throws IllegalStateException
      The location of the crosshair image file
      Parameters:
      crosshairImageURL - New crosshairImageURL value. Default value is "[SKIN]ColorPicker/crosshair.png"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getCrosshairImageURL

      public String getCrosshairImageURL()
      The location of the crosshair image file
      Returns:
      Current crosshairImageURL value. Default value is "[SKIN]ColorPicker/crosshair.png"
      See Also:
    • setDefaultColor

      public ColorPicker setDefaultColor(String defaultColor) throws IllegalStateException
      The default color. This is the color that is selected when the picker first loads
      Parameters:
      defaultColor - New defaultColor value. Default value is #808080
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getDefaultColor

      public String getDefaultColor()
      The default color. This is the color that is selected when the picker first loads
      Returns:
      Current defaultColor value. Default value is #808080
    • setDefaultOpacity

      public ColorPicker setDefaultOpacity(int defaultOpacity) throws IllegalStateException
      The initial opacity value for the component, as a percentage value between 0 and 100
      Parameters:
      defaultOpacity - New defaultOpacity value. Default value is 100
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getDefaultOpacity

      public int getDefaultOpacity()
      The initial opacity value for the component, as a percentage value between 0 and 100
      Returns:
      Current defaultOpacity value. Default value is 100
    • setDefaultPickMode

      public ColorPicker setDefaultPickMode(ColorPickerMode defaultPickMode) throws IllegalStateException
      The ColorPicker can operate in either a "simple" mode (where it displays just the 40 basic colors and allows the user to click one), or a "complex" mode (where the user can specify a color from anywhere in the spectrum, with an optional alpha element). The defaultPickMode attribute specifies which of these two modes is in force when the picker first loads.

      If this method is called after the component has been drawn/initialized: Changes the pick mode of this ColorPicker to pickMode.

      Note: It is not allowed to set the pick mode to ColorPickerMode.COMPLEX if allowComplexMode is false.

      Parameters:
      defaultPickMode - the new pick mode. Default value is "simple"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getDefaultPickMode

      public ColorPickerMode getDefaultPickMode()
      The ColorPicker can operate in either a "simple" mode (where it displays just the 40 basic colors and allows the user to click one), or a "complex" mode (where the user can specify a color from anywhere in the spectrum, with an optional alpha element). The defaultPickMode attribute specifies which of these two modes is in force when the picker first loads.
      Returns:
      Current defaultPickMode value. Default value is "simple"
      See Also:
    • setGreenFieldPrompt

      public ColorPicker setGreenFieldPrompt(String greenFieldPrompt) throws IllegalStateException
      The text to show when the mouse hovers over the 'Green' field in the complex chooser.
      Parameters:
      greenFieldPrompt - New greenFieldPrompt value. Default value is "The Green component of the selected color"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getGreenFieldPrompt

      public String getGreenFieldPrompt()
      The text to show when the mouse hovers over the 'Green' field in the complex chooser.
      Returns:
      Current greenFieldPrompt value. Default value is "The Green component of the selected color"
      See Also:
    • setGreenFieldTitle

      public ColorPicker setGreenFieldTitle(String greenFieldTitle) throws IllegalStateException
      The title for the 'Green' field in the complex chooser.
      Parameters:
      greenFieldTitle - New greenFieldTitle value. Default value is "Green"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getGreenFieldTitle

      public String getGreenFieldTitle()
      The title for the 'Green' field in the complex chooser.
      Returns:
      Current greenFieldTitle value. Default value is "Green"
      See Also:
    • setHtmlFieldPrompt

      public ColorPicker setHtmlFieldPrompt(String htmlFieldPrompt) throws IllegalStateException
      The text to show when the mouse hovers over the 'HTML' field in the complex chooser.
      Parameters:
      htmlFieldPrompt - New htmlFieldPrompt value. Default value is "The selected color''s HTML coding"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getHtmlFieldPrompt

      public String getHtmlFieldPrompt()
      The text to show when the mouse hovers over the 'HTML' field in the complex chooser.
      Returns:
      Current htmlFieldPrompt value. Default value is "The selected color''s HTML coding"
      See Also:
    • setHtmlFieldTitle

      public ColorPicker setHtmlFieldTitle(String htmlFieldTitle) throws IllegalStateException
      The title for the 'HTML' field in the complex chooser.
      Parameters:
      htmlFieldTitle - New htmlFieldTitle value. Default value is "HTML"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getHtmlFieldTitle

      public String getHtmlFieldTitle()
      The title for the 'HTML' field in the complex chooser.
      Returns:
      Current htmlFieldTitle value. Default value is "HTML"
      See Also:
    • setHueFieldPrompt

      public ColorPicker setHueFieldPrompt(String hueFieldPrompt) throws IllegalStateException
      The text to show when the mouse hovers over the 'Hue' field in the complex chooser.
      Parameters:
      hueFieldPrompt - New hueFieldPrompt value. Default value is "The Hue (base tone) of the selected color"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getHueFieldPrompt

      public String getHueFieldPrompt()
      The text to show when the mouse hovers over the 'Hue' field in the complex chooser.
      Returns:
      Current hueFieldPrompt value. Default value is "The Hue (base tone) of the selected color"
      See Also:
    • setHueFieldTitle

      public ColorPicker setHueFieldTitle(String hueFieldTitle) throws IllegalStateException
      The title for the 'Hue' field in the complex chooser.
      Parameters:
      hueFieldTitle - New hueFieldTitle value. Default value is "Hue"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getHueFieldTitle

      public String getHueFieldTitle()
      The title for the 'Hue' field in the complex chooser.
      Returns:
      Current hueFieldTitle value. Default value is "Hue"
      See Also:
    • setLessButtonTitle

      public ColorPicker setLessButtonTitle(String lessButtonTitle) throws IllegalStateException
      The title for the button that switches to a less complex view.
      Parameters:
      lessButtonTitle - New lessButtonTitle value. Default value is "<< Less"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getLessButtonTitle

      public String getLessButtonTitle()
      The title for the button that switches to a less complex view.
      Returns:
      Current lessButtonTitle value. Default value is "<< Less"
      See Also:
    • setLumFieldPrompt

      public ColorPicker setLumFieldPrompt(String lumFieldPrompt) throws IllegalStateException
      The text to show when the mouse hovers over the 'Luminosity' field in the complex chooser.
      Parameters:
      lumFieldPrompt - New lumFieldPrompt value. Default value is "The Luminosity (brightness) of the selected color"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getLumFieldPrompt

      public String getLumFieldPrompt()
      The text to show when the mouse hovers over the 'Luminosity' field in the complex chooser.
      Returns:
      Current lumFieldPrompt value. Default value is "The Luminosity (brightness) of the selected color"
      See Also:
    • setLumFieldTitle

      public ColorPicker setLumFieldTitle(String lumFieldTitle) throws IllegalStateException
      The title for the 'Luminosity' field in the complex chooser.
      Parameters:
      lumFieldTitle - New lumFieldTitle value. Default value is "Lum"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getLumFieldTitle

      public String getLumFieldTitle()
      The title for the 'Luminosity' field in the complex chooser.
      Returns:
      Current lumFieldTitle value. Default value is "Lum"
      See Also:
    • setLumWidth

      public ColorPicker setLumWidth(int lumWidth) throws IllegalStateException
      Width of the Luminosity bar
      Parameters:
      lumWidth - New lumWidth value. Default value is 15
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getLumWidth

      public int getLumWidth()
      Width of the Luminosity bar
      Returns:
      Current lumWidth value. Default value is 15
    • getModeToggleButton

      public IButton getModeToggleButton() throws IllegalStateException
      "More"/"Less" button for the ColorPicker

      This component is an AutoChild named "modeToggleButton". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current modeToggleButton value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setMoreButtonTitle

      public ColorPicker setMoreButtonTitle(String moreButtonTitle) throws IllegalStateException
      The title for the button that switches to a more complex view.
      Parameters:
      moreButtonTitle - New moreButtonTitle value. Default value is "More >>"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getMoreButtonTitle

      public String getMoreButtonTitle()
      The title for the button that switches to a more complex view.
      Returns:
      Current moreButtonTitle value. Default value is "More >>"
      See Also:
    • getOkButton

      public IButton getOkButton() throws IllegalStateException
      "OK" button for the ColorPicker

      This component is an AutoChild named "okButton". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current okButton value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setOkButtonTitle

      public ColorPicker setOkButtonTitle(String okButtonTitle) throws IllegalStateException
      The title for the 'OK' button.
      Parameters:
      okButtonTitle - New okButtonTitle value. Default value is "OK"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getOkButtonTitle

      public String getOkButtonTitle()
      The title for the 'OK' button.
      Returns:
      Current okButtonTitle value. Default value is "OK"
      See Also:
    • setOpacitySliderLabel

      public ColorPicker setOpacitySliderLabel(String opacitySliderLabel) throws IllegalStateException
      The label shown next to the opacity slider. Ignored if supportsTransparency is false.
      Parameters:
      opacitySliderLabel - New opacitySliderLabel value. Default value is "Opacity:"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getOpacitySliderLabel

      public String getOpacitySliderLabel()
      The label shown next to the opacity slider. Ignored if supportsTransparency is false.
      Returns:
      Current opacitySliderLabel value. Default value is "Opacity:"
      See Also:
    • setOpacityText

      public ColorPicker setOpacityText(String opacityText) throws IllegalStateException
      The text to show underneath the selected color box, so that it can be seen through semi-transparent colors. If you do not want such text, set this value to blank. This value is irrelevant if supportsTransparency is false.
      Parameters:
      opacityText - New opacityText value. Default value is "Lorem ipsum"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getOpacityText

      public String getOpacityText()
      The text to show underneath the selected color box, so that it can be seen through semi-transparent colors. If you do not want such text, set this value to blank. This value is irrelevant if supportsTransparency is false.
      Returns:
      Current opacityText value. Default value is "Lorem ipsum"
      See Also:
    • setRedFieldPrompt

      public ColorPicker setRedFieldPrompt(String redFieldPrompt) throws IllegalStateException
      The text to show when the mouse hovers over the 'Red' field in the complex chooser.
      Parameters:
      redFieldPrompt - New redFieldPrompt value. Default value is "The Red component of the selected color"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getRedFieldPrompt

      public String getRedFieldPrompt()
      The text to show when the mouse hovers over the 'Red' field in the complex chooser.
      Returns:
      Current redFieldPrompt value. Default value is "The Red component of the selected color"
      See Also:
    • setRedFieldTitle

      public ColorPicker setRedFieldTitle(String redFieldTitle) throws IllegalStateException
      The title for the 'Red' field in the complex chooser.
      Parameters:
      redFieldTitle - New redFieldTitle value. Default value is "Red"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getRedFieldTitle

      public String getRedFieldTitle()
      The title for the 'Red' field in the complex chooser.
      Returns:
      Current redFieldTitle value. Default value is "Red"
      See Also:
    • setSatFieldPrompt

      public ColorPicker setSatFieldPrompt(String satFieldPrompt) throws IllegalStateException
      The text to show when the mouse hovers over the 'Saturation' field in the complex chooser.
      Parameters:
      satFieldPrompt - New satFieldPrompt value. Default value is "The Saturation (color purity) of the selected color"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getSatFieldPrompt

      public String getSatFieldPrompt()
      The text to show when the mouse hovers over the 'Saturation' field in the complex chooser.
      Returns:
      Current satFieldPrompt value. Default value is "The Saturation (color purity) of the selected color"
      See Also:
    • setSatFieldTitle

      public ColorPicker setSatFieldTitle(String satFieldTitle) throws IllegalStateException
      The title for the 'Sat' field in the complex chooser.
      Parameters:
      satFieldTitle - New satFieldTitle value. Default value is "Sat"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getSatFieldTitle

      public String getSatFieldTitle()
      The title for the 'Sat' field in the complex chooser.
      Returns:
      Current satFieldTitle value. Default value is "Sat"
      See Also:
    • setSelectedColorLabel

      public ColorPicker setSelectedColorLabel(String selectedColorLabel) throws IllegalStateException
      The label shown next to the selected color box.
      Parameters:
      selectedColorLabel - New selectedColorLabel value. Default value is "Selected Color:"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getSelectedColorLabel

      public String getSelectedColorLabel()
      The label shown next to the selected color box.
      Returns:
      Current selectedColorLabel value. Default value is "Selected Color:"
      See Also:
    • setShowCancelButton

      public ColorPicker setShowCancelButton(Boolean showCancelButton) throws IllegalStateException
      Should the Cancel button be visible. Set to false to hide the Cancel button.

      Note : This is an advanced setting

      Parameters:
      showCancelButton - New showCancelButton value. Default value is true
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getShowCancelButton

      public Boolean getShowCancelButton()
      Should the Cancel button be visible. Set to false to hide the Cancel button.
      Returns:
      Current showCancelButton value. Default value is true
    • setShowModeToggleButton

      public ColorPicker setShowModeToggleButton(Boolean showModeToggleButton) throws IllegalStateException
      Should the Mode Toggle button be visible. Set to false to hide the Mode Toggle button.

      Note : This is an advanced setting

      Parameters:
      showModeToggleButton - New showModeToggleButton value. Default value is true
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getShowModeToggleButton

      public Boolean getShowModeToggleButton()
      Should the Mode Toggle button be visible. Set to false to hide the Mode Toggle button.
      Returns:
      Current showModeToggleButton value. Default value is true
    • setShowOkButton

      public ColorPicker setShowOkButton(Boolean showOkButton) throws IllegalStateException
      Should the OK button be visible. Set to false to hide the OK button.

      Note : This is an advanced setting

      Parameters:
      showOkButton - New showOkButton value. Default value is true
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getShowOkButton

      public Boolean getShowOkButton()
      Should the OK button be visible. Set to false to hide the OK button.
      Returns:
      Current showOkButton value. Default value is true
    • setSupportsTransparency

      public ColorPicker setSupportsTransparency(Boolean supportsTransparency) throws IllegalStateException
      Determines whether to show the opacity slider. This allows the user to select colors with an alpha element (ie, semi-transparent colors). If this attribute is set to false, no opacity slider is shown, and all colors are completely opaque.

      If this method is called after the component has been drawn/initialized: Set the supportsTransparency flag.
      Parameters:
      supportsTransparency - Set to true to enable transparency/opacity. Default value is true
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getSupportsTransparency

      public Boolean getSupportsTransparency()
      Determines whether to show the opacity slider. This allows the user to select colors with an alpha element (ie, semi-transparent colors). If this attribute is set to false, no opacity slider is shown, and all colors are completely opaque.
      Returns:
      Current supportsTransparency value. Default value is true
    • setSwatchHeight

      public ColorPicker setSwatchHeight(int swatchHeight) throws IllegalStateException
      Displayed height of the color swatch image. The default height is approximately that used by the Windows® XP color picking window
      Parameters:
      swatchHeight - New swatchHeight value. Default value is 170
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getSwatchHeight

      public int getSwatchHeight()
      Displayed height of the color swatch image. The default height is approximately that used by the Windows® XP color picking window
      Returns:
      Current swatchHeight value. Default value is 170
    • setSwatchImageURL

      public ColorPicker setSwatchImageURL(String swatchImageURL) throws IllegalStateException
      The location of the color swatch image file
      Parameters:
      swatchImageURL - New swatchImageURL value. Default value is "[SKIN]ColorPicker/spectrum.png"
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
      See Also:
    • getSwatchImageURL

      public String getSwatchImageURL()
      The location of the color swatch image file
      Returns:
      Current swatchImageURL value. Default value is "[SKIN]ColorPicker/spectrum.png"
      See Also:
    • setSwatchWidth

      public ColorPicker setSwatchWidth(int swatchWidth) throws IllegalStateException
      Displayed width of the color swatch image. The default width is approximately that used by the Windows® XP color picking window
      Parameters:
      swatchWidth - New swatchWidth value. Default value is 170
      Returns:
      ColorPicker instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getSwatchWidth

      public int getSwatchWidth()
      Displayed width of the color swatch image. The default width is approximately that used by the Windows® XP color picking window
      Returns:
      Current swatchWidth value. Default value is 170
    • addColorChangedHandler

      public HandlerRegistration addColorChangedHandler(ColorChangedHandler handler)
      Add a colorChanged handler.

      Override this method to be kept informed when the ColorPicker changes in real-time (for example, if you need to update your own GUI accordingly). Then use the getXxxx() methods (for example, getBlue() or getLuminosity())to obtain current state as required.

      Specified by:
      addColorChangedHandler in interface HasColorChangedHandlers
      Parameters:
      handler - the colorChanged handler
      Returns:
      HandlerRegistration used to remove this handler
    • addColorSelectedHandler

      public HandlerRegistration addColorSelectedHandler(ColorSelectedHandler handler)
      Add a colorSelected handler.

      Override this method to be notified when the user selects a color either by clicking a basic color box in simple mode, or by clicking the OK button in complex mode. It is not intended that client code call this method. The ColorPicker may automatically hide itself after calling this method depending on ColorPicker.autoHide and ColorPicker.defaultPickMode.

      Specified by:
      addColorSelectedHandler in interface HasColorSelectedHandlers
      Parameters:
      handler - the colorSelected handler
      Returns:
      HandlerRegistration used to remove this handler
    • getBlue

      public int getBlue()
      Returns the Blue element of the currently-selected color, as an integer from 0-255
      Returns:
      blue color component
      See Also:
    • getGreen

      public int getGreen()
      Returns the Green element of the currently-selected color, as an integer from 0-255
      Returns:
      green color component
      See Also:
    • getHtmlColor

      public String getHtmlColor()
      Returns the currently-selected color, in HTML color representation form, as a string. HTML color representation is a hash sign, followed by the red, green and blue elements of the color in 2-digit hex form - for example "#F17F1D"
      Returns:
      HTML color value
      See Also:
    • getHue

      public int getHue()
      Returns the Hue of the currently-selected color, as an integer from 0-239
      Returns:
      hue value
      See Also:
    • getLuminosity

      public int getLuminosity()
      Returns the Luminosity (brightness) of the currently-selected color, as an integer from 0-240
      Returns:
      luminosity value
      See Also:
    • getRed

      public int getRed()
      Returns the Red element of the currently-selected color, as an integer from 0-255
      Returns:
      red color component
      See Also:
    • getSaturation

      public int getSaturation()
      Returns the Saturation of the currently-selected color, as an integer from 0-240
      Returns:
      saturation value
      See Also:
    • setBlue

      public void setBlue(int newValue)
      Sets the Blue element of the selected color
      Parameters:
      newValue - An integer between 0 and 255
      See Also:
    • setCurrentPickMode

      public void setCurrentPickMode(ColorPickerMode pickMode)
      Changes the pick mode of this ColorPicker to pickMode.

      Note: It is not allowed to set the pick mode to ColorPickerMode.COMPLEX if allowComplexMode is false.

      Parameters:
      pickMode - the new pick mode.
    • setGreen

      public void setGreen(int newValue)
      Sets the Green element of the selected color
      Parameters:
      newValue - An integer between 0 and 255
      See Also:
    • setHtmlColor

      public void setHtmlColor(String newValue)
      Changes the selected color to the one represented by the supplied HTML color string. Note that the method only accepts the parameter if it represents a valid color (otherwise it is simply ignored).
      Parameters:
      newValue - A string in HTML color representation format (#RRGGBB)
      See Also:
    • setHue

      public void setHue(int newValue)
      Sets the Hue of the selected color
      Parameters:
      newValue - An integer between 0 and 239
      See Also:
    • setLuminosity

      public void setLuminosity(int newValue)
      Sets the Luminosity (brightness) of the selected color
      Parameters:
      newValue - An integer between 0 and 240
      See Also:
    • setOpacity

      public void setOpacity(int newValue)
      Sets the Opacity of the selected color. Ignored if opacity is switched off.
      Parameters:
      newValue - An integer between 0 and 100
      See Also:
    • setRed

      public void setRed(int newValue)
      Sets the Red element of the selected color
      Parameters:
      newValue - An integer between 0 and 255
      See Also:
    • setSaturation

      public void setSaturation(int newValue)
      Sets the Saturation of the selected color
      Parameters:
      newValue - An integer between 0 and 240
      See Also:
    • setDefaultProperties

      public static void setDefaultProperties(ColorPicker colorPickerProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      colorPickerProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(ColorPickerLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class Window