com.smartgwt.client.widgets.form
Class ColorPicker

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.smartgwt.client.widgets.BaseWidget
              extended by com.smartgwt.client.widgets.Canvas
                  extended by com.smartgwt.client.widgets.layout.Layout
                      extended by com.smartgwt.client.widgets.layout.VLayout
                          extended by com.smartgwt.client.widgets.Window
                              extended by com.smartgwt.client.widgets.form.ColorPicker
All Implemented Interfaces:
HasHandlers, EventListener, 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, HasResizedHandlers, HasRestoreClickHandlers, HasRightMouseDownHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasColorSelectedHandlers

public class ColorPicker
extends Window
implements 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.smartgwt.client.widgets.BaseWidget
config, configOnly, id, isElementSet, scClassName
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
ColorPicker()
           
ColorPicker(JavaScriptObject jsObj)
           
 
Method Summary
 HandlerRegistration addColorSelectedHandler(ColorSelectedHandler handler)
          Add a colorSelected handler.
 void colorChanged()
          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).
protected  JavaScriptObject create()
           
 Boolean getAllowComplexMode()
          Should the "complex" mode be allowed for this ColorPicker? If false, no "More" button is shown on the simple picker
 Boolean getAutoCenterOnShow()
          If autoPosition is false, this property controls whether to automatically center the colorPicker every time it is reshown with the show() method.
 Boolean getAutoPosition()
          If true, causes the ColorPicker to appear near where the mouse was last clicked.
 String getBasicColorLabel()
          The label shown above the basic color blocks.
 int getBlue()
          Returns the Blue element of the currently-selected color, as an integer from 0-255
 String getColorButtonBaseStyle()
          Base CSS style applied to the basic color boxes
 int getColorButtonSize()
          Width and height of the basic color boxes (they are always square, and they are all the same size).
 String getCrosshairImageURL()
          The location of the crosshair image file
 String getDefaultColor()
          The default color.
 int getDefaultOpacity()
          The initial opacity value for the component, as a percentage value between 0 and 100
 String 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).
 int getGreen()
          Returns the Green element of the currently-selected color, as an integer from 0-255
 String getHtmlColor()
          Returns the currently-selected color, in HTML color representation form, as a string.
 int getHue()
          Returns the Hue of the currently-selected color, as an integer from 0-239
 int getLuminosity()
          Returns the Luminosity (brightness) of the currently-selected color, as an integer from 0-240
 int getLumWidth()
          Width of the Luminosity bar
 String getOpacitySliderLabel()
          The label shown next to the opacity slider.
 Boolean getOpacityText()
          The text to show underneath the selected color box, so that it can be seen through semi-transparent colors.
static ColorPicker getOrCreateRef(JavaScriptObject jsObj)
           
 int getRed()
          Returns the Red element of the currently-selected color, as an integer from 0-255
 int getSaturation()
          Returns the Saturation of the currently-selected color, as an integer from 0-240
 String getSelectedColorLabel()
          The label shown next to the selected color box.
 Boolean getSupportsTransparency()
          Determines whether to show the opacity slider.
 int getSwatchHeight()
          Displayed height of the color swatch image.
 String getSwatchImageURL()
          The location of the color swatch image file
 int getSwatchWidth()
          Displayed width of the color swatch image.
 void setAllowComplexMode(Boolean allowComplexMode)
          Should the "complex" mode be allowed for this ColorPicker? If false, no "More" button is shown on the simple picker
 void setAutoCenterOnShow(Boolean autoCenterOnShow)
          If autoPosition is false, this property controls whether to automatically center the colorPicker every time it is reshown with the show() method.
 void setAutoPosition(Boolean autoPosition)
          If true, causes the ColorPicker to appear near where the mouse was last clicked.
 void setBasicColorLabel(String basicColorLabel)
          The label shown above the basic color blocks.
 void setBlue(int newValue)
          Sets the Blue element of the selected color
 void setColorButtonBaseStyle(String colorButtonBaseStyle)
          Base CSS style applied to the basic color boxes
 void setColorButtonSize(int colorButtonSize)
          Width and height of the basic color boxes (they are always square, and they are all the same size).
 void setCrosshairImageURL(String crosshairImageURL)
          The location of the crosshair image file
 void setDefaultColor(String defaultColor)
          The default color.
 void setDefaultOpacity(int defaultOpacity)
          The initial opacity value for the component, as a percentage value between 0 and 100
 void setDefaultPickMode(String defaultPickMode)
          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).
 void setGreen(int newValue)
          Sets the Green element of the selected color
 void setHtmlColor(String newValue)
          Changes the selected color to the one represented by the supplied HTML color string.
 void setHue(int newValue)
          Sets the Hue of the selected color
 void setLuminosity(int newValue)
          Sets the Luminosity (brightness) of the selected color
 void setLumWidth(int lumWidth)
          Width of the Luminosity bar
 void setOpacity(int newValue)
          Sets the Opacity of the selected color.
 void setOpacitySliderLabel(String opacitySliderLabel)
          The label shown next to the opacity slider.
 void setOpacityText(Boolean opacityText)
          The text to show underneath the selected color box, so that it can be seen through semi-transparent colors.
 void setRed(int newValue)
          Sets the Red element of the selected color
 void setSaturation(int newValue)
          Sets the Saturation of the selected color
 void setSelectedColorLabel(String selectedColorLabel)
          The label shown next to the selected color box.
 void setSupportsTransparency(Boolean supportsTransparency)
          Determines whether to show the opacity slider.
 void setSwatchHeight(int swatchHeight)
          Displayed height of the color swatch image.
 void setSwatchImageURL(String swatchImageURL)
          The location of the color swatch image file
 void setSwatchWidth(int swatchWidth)
          Displayed width of the color swatch image.
 
Methods inherited from class com.smartgwt.client.widgets.Window
addCloseClickHandler, addItem, addItem, addMaximizeClickHandler, addMember, addMember, addMinimizeClickHandler, addRestoreClickHandler, centerInPage, flash, getAnimateMinimize, getAutoCenter, getAutoSize, getBodyColor, getBodyStyle, getCanDragReposition, getCanDragResize, getCanFocusInHeaderButtons, getContentLayout, getContentsType, getDefaultMinimizeHeight, getDismissOnEscape, getDismissOnOutsideClick, getFooterHeight, getHeaderSrc, getHeaderStyle, getHiliteBodyColor, getHiliteHeaderSrc, getHiliteHeaderStyle, getIsModal, getItems, getMaximized, getMinimizeAcceleration, getMinimized, getMinimizeHeight, getMinimizeTime, getModalMaskOpacity, getModalMaskStyle, getShowBody, getShowCloseButton, getShowFooter, getShowHeader, getShowHeaderBackground, getShowHeaderIcon, getShowMaximizeButton, getShowMinimizeButton, getShowModalMask, getShowResizer, getShowStatusBar, getShowTitle, getSrc, getStatus, getTitle, maximize, minimize, preloadImages, removeItem, restore, setAnimateMinimize, setAutoCenter, setAutoSize, setBodyColor, setBodyDefaults, setBodyStyle, setCanDragReposition, setCanDragResize, setCanFocusInHeaderButtons, setContentLayout, setContentsType, setDefaultMinimizeHeight, setDismissOnEscape, setDismissOnOutsideClick, setFooterHeight, setHeaderControls, setHeaderIcon, setHeaderIcon, setHeaderIconDefaults, setHeaderIconProperties, setHeaderSrc, setHeaderStyle, setHiliteBodyColor, setHiliteHeaderSrc, setHiliteHeaderStyle, setIsModal, setKeepInParentRect, setKeepInParentRect, setMaximized, setMinimizeAcceleration, setMinimized, setMinimizeHeight, setMinimizeTime, setModalMaskOpacity, setModalMaskStyle, setShowBody, setShowCloseButton, setShowFooter, setShowHeader, setShowHeaderBackground, setShowHeaderIcon, setShowMaximizeButton, setShowMinimizeButton, setShowModalMask, setShowResizer, setShowStatusBar, setShowTitle, setSrc, setStatus, setTitle, shouldDismissOnEscape
 
Methods inherited from class com.smartgwt.client.widgets.layout.Layout
addMember, addMember, addMemberPostCreate, addMemberPostCreate, addMemberPreCreate, addMemberPreCreate, getAnimateMembers, getAnimateMemberTime, getCanDropComponents, getDefaultResizeBars, getDropComponent, getDropLineThickness, getDropPosition, getEnforcePolicy, getHPolicy, getLayoutBottomMargin, getLayoutLeftMargin, getLayoutMargin, getLayoutRightMargin, getLayoutTopMargin, getLeaveScrollbarGap, getManagePercentBreadth, getMember, getMember, getMemberDefaultBreadth, getMemberNumber, getMemberNumber, getMemberOffset, getMemberOverlap, getMembers, getMembersMargin, getMinMemberSize, getOverflow, getPaddingAsLayoutMargin, getResizeBarClass, getResizeBarSize, getReverseOrder, getShowDragPlaceHolder, getStackZIndex, getVertical, getVPolicy, hasMember, hideDropLine, hideMember, hideMember, membersChanged, onInit, reflow, reflow, reflowNow, removeMember, removeMembers, reorderMember, reorderMembers, setAlign, setAlign, setAnimateMembers, setAnimateMemberTime, setCanDropComponents, setDefaultLayoutAlign, setDefaultLayoutAlign, setDefaultResizeBars, setDropLineProperties, setDropLineThickness, setEnforcePolicy, setHPolicy, setLayoutBottomMargin, setLayoutLeftMargin, setLayoutMargin, setLayoutRightMargin, setLayoutTopMargin, setLeaveScrollbarGap, setManagePercentBreadth, setMemberOverlap, setMembers, setMembersMargin, setMinMemberSize, setOverflow, setPaddingAsLayoutMargin, setPlaceHolderDefaults, setPlaceHolderProperties, setResizeBarClass, setResizeBarSize, setReverseOrder, setShowDragPlaceHolder, setStackZIndex, setVertical, setVisibleMember, setVPolicy, showMember, showMember
 
Methods inherited from class com.smartgwt.client.widgets.Canvas
addChild, addChild, addChild, addClickHandler, addDoubleClickHandler, addDragMoveHandler, addDragRepositionMoveHandler, addDragRepositionStartHandler, addDragRepositionStopHandler, addDragResizeMoveHandler, addDragResizeStartHandler, addDragResizeStopHandler, addDragStartHandler, addDragStopHandler, addDropHandler, addDropMoveHandler, addDropOutHandler, addDropOverHandler, addFocusChangedHandler, addHoverHandler, addHoverHiddenHandler, addKeyDownHandler, addKeyPressHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseStillDownHandler, addMouseUpHandler, addMouseWheelHandler, addPeer, addPeer, addResizedHandler, addRightMouseDownHandler, addScrolledHandler, addShowContextMenuHandler, addStyleName, adjustForContent, animateFade, animateFade, animateFade, animateHide, animateHide, animateHide, animateMove, animateMove, animateMove, animateMove, animateRect, animateRect, animateRect, animateResize, animateResize, animateResize, animateScroll, animateScroll, animateScroll, animateShow, animateShow, animateShow, blur, bringToFront, clear, clickMaskUp, clickMaskUp, contains, contains, containsEvent, containsFocus, containsPoint, containsPoint, convertToCanvasArray, disable, enable, focus, getAbsoluteLeft, getAbsoluteTop, getAccessKey, getAnimateAcceleration, getAnimateFadeTime, getAnimateHideAcceleration, getAnimateHideTime, getAnimateMoveAcceleration, getAnimateMoveTime, getAnimateRectAcceleration, getAnimateRectTime, getAnimateResizeAcceleration, getAnimateResizeTime, getAnimateScrollAcceleration, getAnimateScrollTime, getAnimateShowAcceleration, getAnimateShowTime, getAnimateTime, getAppImgDir, getAutoShowParent, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorder, getBottom, getById, getCanAcceptDrop, getCanDrag, getCanDragScroll, getCanDrop, getCanDropBefore, getCanFocus, getCanHover, getCanSelectText, getChildren, getChildrenSnapResizeToGrid, getChildrenSnapToGrid, getContents, getContextMenu, getCursor, getDataPath, getDefaultHeight, getDefaultWidth, getDestroyed, getDestroying, getDisabled, getDisabledCursor, getDoubleClickDelay, getDragAppearance, getDragIntersectStyle, getDragOpacity, getDragRepositionCursor, getDragScrollDelay, getDragStartDistance, getDragTarget, getDragType, getDynamicContents, getEdgeBackgroundColor, getEdgeCenterBackgroundColor, getEdgeImage, getEdgeOffset, getEdgeOpacity, getEdgeShowCenter, getEdgeSize, getExtraSpace, getFullDataPath, getGroupTitle, getHeight, getHeightAsString, getHoverAlign, getHoverDelay, getHoverHeight, getHoverHTML, getHoverMoveWithMouse, getHoverOpacity, getHoverStyle, getHoverVAlign, getHoverWidth, getHoverWrap, getHSnapOrigin, getHSnapOrigin, getHSnapPosition, getHSnapPosition, getHtmlPosition, getImgURL, getImgURL, getInnerContentHeight, getInnerContentWidth, getInnerHeight, getInnerWidth, getIsGroup, getLeft, getLeftAsString, getMargin, getMatchElement, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getMouseStillDownDelay, getMouseStillDownInitialDelay, getNextZIndex, getNoDoubleClicks, getOffsetHeight, getOffsetWidth, getOffsetX, getOffsetY, getOpacity, getPadding, getPageBottom, getPageLeft, getPageRect, getPageRight, getPageTop, getParentElement, getPercentBox, getPosition, getPrefix, getPrompt, getRect, getRedrawOnResize, getResizeBarTarget, getRight, getScrollbarSize, getScrollBottom, getScrollHeight, getScrollLeft, getScrollRight, getScrollTop, getScrollWidth, getShadowDepth, getShadowImage, getShadowOffset, getShadowSoftness, getShowCustomScrollbars, getShowDragShadow, getShowEdges, getShowHover, getShowResizeBar, getShowShadow, getSkinImgDir, getSnapAxis, getSnapEdge, getSnapHDirection, getSnapHGap, getSnapOffsetLeft, getSnapOffsetTop, getSnapOnDrop, getSnapResizeToGrid, getSnapTo, getSnapToGrid, getSnapVDirection, getSnapVGap, getStyleName, getTabIndex, getTooltip, getTop, getTopAsString, getValuesManager, getViewportHeight, getViewportWidth, getVisibility, getVisibleHeight, getVisibleWidth, getVSnapOrigin, getVSnapOrigin, getVSnapPosition, getVSnapPosition, getWidth, getWidthAsString, getZIndex, handleHover, hide, hideClickMask, hideClickMask, hideContextMenu, imgHTML, imgHTML, imgHTML, intersects, isDirty, isDisabled, isDrawn, isVisible, keyUp, layoutChildren, linkHTML, linkHTML, markForDestroy, markForRedraw, markForRedraw, moveAbove, moveBelow, moveBy, moveTo, parentResized, redraw, redraw, removeChild, removeChild, resizeBy, resizeTo, resizeTo, scrollBy, scrollByPercent, scrollTo, scrollTo, scrollToBottom, scrollToLeft, scrollToPercent, scrollToRight, scrollToTop, sendToBack, setAccessKey, setAnimateAcceleration, setAnimateFadeTime, setAnimateHideAcceleration, setAnimateHideTime, setAnimateMoveAcceleration, setAnimateMoveTime, setAnimateRectAcceleration, setAnimateRectTime, setAnimateResizeAcceleration, setAnimateResizeTime, setAnimateScrollAcceleration, setAnimateScrollTime, setAnimateShowAcceleration, setAnimateShowTime, setAnimateTime, setAppImgDir, setAutoHeight, setAutoShowParent, setAutoWidth, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBottom, setCanAcceptDrop, setCanDrag, setCanDragScroll, setCanDrop, setCanDropBefore, setCanFocus, setCanHover, setCanSelectText, setChildren, setChildrenSnapResizeToGrid, setChildrenSnapToGrid, setContents, setContextMenu, setCursor, setDataPath, setDefaultHeight, setDefaultWidth, setDisabled, setDisabledCursor, setDoubleClickDelay, setDragAppearance, setDragIntersectStyle, setDragOpacity, setDragRepositionCursor, setDragScrollDelay, setDragStartDistance, setDragTarget, setDragType, setDropTypes, setDynamicContents, setEdgeBackgroundColor, setEdgeCenterBackgroundColor, setEdgeImage, setEdgeMarginSize, setEdgeOffset, setEdgeOpacity, setEdgeShowCenter, setEdgeSize, setExtraSpace, setGroupTitle, setHeight, setHeight, setHeight100, setHoverAlign, setHoverDelay, setHoverHeight, setHoverMoveWithMouse, setHoverOpacity, setHoverStyle, setHoverVAlign, setHoverWidth, setHoverWrap, setHtmlPosition, setImage, setImage, setIsGroup, setLayoutAlign, setLayoutAlign, setLeft, setLeft, setMargin, setMatchElement, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setMouseStillDownDelay, setMouseStillDownInitialDelay, setNoDoubleClicks, setOpacity, setPadding, setPageLeft, setPageTop, setParentElement, setPercentBox, setPosition, setPrefix, setPrompt, setRect, setRect, setRedrawOnResize, setResizeBarTarget, setResizeFrom, setRight, setScrollbarSize, setShadowDepth, setShadowImage, setShadowOffset, setShadowSoftness, setShowCustomScrollbars, setShowDragShadow, setShowEdges, setShowHover, setShowResizeBar, setShowShadow, setSkinImgDir, setSmoothFade, setSnapAxis, setSnapEdge, setSnapHDirection, setSnapHGap, setSnapOffsetLeft, setSnapOffsetTop, setSnapOnDrop, setSnapResizeToGrid, setSnapTo, setSnapToGrid, setSnapVDirection, setSnapVGap, setStyleName, setTabIndex, setTooltip, setTop, setTop, setValuesManager, setVisibility, setVisible, setWidth, setWidth, setWidth100, setZIndex, shouldDragScroll, show, showClickMask, showNextTo, showNextTo, showPrintPreview, updateHover, updateHover, updateShadow, visibleAtPoint, visibleAtPoint, willAcceptDrop
 
Methods inherited from class com.smartgwt.client.widgets.BaseWidget
addDrawHandler, destroy, doAddHandler, doInit, doOnRender, draw, equals, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getConfig, getDOM, getElement, getElement, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getRef, hashCode, isConfigOnly, isCreated, onDestroy, onDraw, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setDragTracker, setElement, setHtmlElement, setID, setNullProperty, setPosition, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getStyleElement, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setPixelSize, setSize, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

ColorPicker

public ColorPicker()

ColorPicker

public ColorPicker(JavaScriptObject jsObj)
Method Detail

getOrCreateRef

public static ColorPicker getOrCreateRef(JavaScriptObject jsObj)

create

protected JavaScriptObject create()
Overrides:
create in class Window

setDefaultColor

public void setDefaultColor(String defaultColor)
                     throws IllegalStateException
The default color. This is the color that is selected when the picker first loads

Parameters:
defaultColor - defaultColor Default value is #808080
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:
String

setColorButtonSize

public void 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 - colorButtonSize Default value is 20
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:
int

setColorButtonBaseStyle

public void setColorButtonBaseStyle(String colorButtonBaseStyle)
                             throws IllegalStateException
Base CSS style applied to the basic color boxes

Parameters:
colorButtonBaseStyle - colorButtonBaseStyle Default value is "ColorChooserCell"
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getColorButtonBaseStyle

public String getColorButtonBaseStyle()
Base CSS style applied to the basic color boxes

Returns:
String

setSwatchWidth

public void 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 - swatchWidth Default value is 170
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:
int

setSwatchHeight

public void 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 - swatchHeight Default value is 170
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:
int

setLumWidth

public void setLumWidth(int lumWidth)
                 throws IllegalStateException
Width of the Luminosity bar

Parameters:
lumWidth - lumWidth Default value is 15
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getLumWidth

public int getLumWidth()
Width of the Luminosity bar

Returns:
int

setSupportsTransparency

public void 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. Set the supportsTransparency flag.

Parameters:
supportsTransparency - Set to true to enable transparency/opacity. Default value is true
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:
Boolean

setOpacityText

public void setOpacityText(Boolean 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 - opacityText Default value is true
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getOpacityText

public Boolean 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:
Boolean

setSwatchImageURL

public void setSwatchImageURL(String swatchImageURL)
                       throws IllegalStateException
The location of the color swatch image file

Parameters:
swatchImageURL - swatchImageURL Default value is "[SKIN]ColorPicker/spectrum.png"
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getSwatchImageURL

public String getSwatchImageURL()
The location of the color swatch image file

Returns:
String

setCrosshairImageURL

public void setCrosshairImageURL(String crosshairImageURL)
                          throws IllegalStateException
The location of the crosshair image file

Parameters:
crosshairImageURL - crosshairImageURL Default value is "[SKIN]ColorPicker/crosshair.png"
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getCrosshairImageURL

public String getCrosshairImageURL()
The location of the crosshair image file

Returns:
String

setBasicColorLabel

public void setBasicColorLabel(String basicColorLabel)
                        throws IllegalStateException
The label shown above the basic color blocks.

Parameters:
basicColorLabel - basicColorLabel Default value is "Basic Colors:"
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getBasicColorLabel

public String getBasicColorLabel()
The label shown above the basic color blocks.

Returns:
String

setSelectedColorLabel

public void setSelectedColorLabel(String selectedColorLabel)
                           throws IllegalStateException
The label shown next to the selected color box.

Parameters:
selectedColorLabel - selectedColorLabel Default value is "Selected Color"
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getSelectedColorLabel

public String getSelectedColorLabel()
The label shown next to the selected color box.

Returns:
String

setOpacitySliderLabel

public void setOpacitySliderLabel(String opacitySliderLabel)
                           throws IllegalStateException
The label shown next to the opacity slider. Ignored if supportsTransparency is false.

Parameters:
opacitySliderLabel - opacitySliderLabel Default value is "Opacity"
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getOpacitySliderLabel

public String getOpacitySliderLabel()
The label shown next to the opacity slider. Ignored if supportsTransparency is false.

Returns:
String

setDefaultOpacity

public void setDefaultOpacity(int defaultOpacity)
                       throws IllegalStateException
The initial opacity value for the component, as a percentage value between 0 and 100

Parameters:
defaultOpacity - defaultOpacity Default value is 100
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:
int

setAutoPosition

public void 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 - autoPosition Default value is true
Throws:
IllegalStateException - this property cannot be changed after the component has been created

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:
Boolean

setAutoCenterOnShow

public void setAutoCenterOnShow(Boolean autoCenterOnShow)
                         throws IllegalStateException
If autoPosition is false, this property controls whether to automatically center the colorPicker every time it is reshown with the show() method.

Parameters:
autoCenterOnShow - autoCenterOnShow Default value is true
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getAutoCenterOnShow

public Boolean getAutoCenterOnShow()
If autoPosition is false, this property controls whether to automatically center the colorPicker every time it is reshown with the show() method.

Returns:
Boolean

setDefaultPickMode

public void setDefaultPickMode(String 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.

Parameters:
defaultPickMode - defaultPickMode Default value is "simple"
Throws:
IllegalStateException - this property cannot be changed after the component has been created

getDefaultPickMode

public String 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:
String

setAllowComplexMode

public void 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 - allowComplexMode Default value is true
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:
Boolean

getRed

public int getRed()
Returns the Red element of the currently-selected color, as an integer from 0-255

Returns:
red color component

getGreen

public int getGreen()
Returns the Green element of the currently-selected color, as an integer from 0-255

Returns:
green color component

getBlue

public int getBlue()
Returns the Blue element of the currently-selected color, as an integer from 0-255

Returns:
blue color component

getHue

public int getHue()
Returns the Hue of the currently-selected color, as an integer from 0-239

Returns:
hue value

getSaturation

public int getSaturation()
Returns the Saturation of the currently-selected color, as an integer from 0-240

Returns:
saturation value

getLuminosity

public int getLuminosity()
Returns the Luminosity (brightness) of the currently-selected color, as an integer from 0-240

Returns:
luminosity value

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

setRed

public void setRed(int newValue)
Sets the Red element of the selected color

Parameters:
newValue - An integer between 0 and 255

setGreen

public void setGreen(int newValue)
Sets the Green element of the selected color

Parameters:
newValue - An integer between 0 and 255

setBlue

public void setBlue(int newValue)
Sets the Blue element of the selected color

Parameters:
newValue - An integer between 0 and 255

setHue

public void setHue(int newValue)
Sets the Hue of the selected color

Parameters:
newValue - An integer between 0 and 239

setSaturation

public void setSaturation(int newValue)
Sets the Saturation of the selected color

Parameters:
newValue - An integer between 0 and 240

setLuminosity

public void setLuminosity(int newValue)
Sets the Luminosity (brightness) of the selected color

Parameters:
newValue - An integer between 0 and 240

setHtmlColor

public void setHtmlColor(String newValue)
Changes the selected color to the one represented by the supplied HTML color string. Note that ths 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)

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

colorChanged

public void colorChanged()
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.


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.

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