com.smartgwt.client.widgets.form
Class ColorPicker
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.smartgwt.client.widgets.BaseWidget
com.smartgwt.client.widgets.Canvas
com.smartgwt.client.widgets.layout.Layout
com.smartgwt.client.widgets.layout.VLayout
com.smartgwt.client.widgets.Window
com.smartgwt.client.widgets.form.ColorPicker
- All Implemented Interfaces:
- HasAttachHandlers, HasHandlers, EventListener, IsWidget, 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, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, 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.
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). |
static void |
setDefaultProperties(ColorPicker colorPickerProperties)
Class level method to set the default properties of this class. |
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, setDefaultProperties, setDismissOnEscape, setDismissOnOutsideClick, setFooterControls, 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, getLocateMembersBy, getLocateMembersType, 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_Layout, onInit, reflow, reflow, reflowNow, removeMember, removeMembers, reorderMember, reorderMembers, setAlign, setAlign, setAnimateMembers, setAnimateMemberTime, setCanDropComponents, setDefaultLayoutAlign, setDefaultLayoutAlign, setDefaultProperties, setDefaultResizeBars, setDropLineProperties, setDropLineThickness, setEnforcePolicy, setHPolicy, setLayoutBottomMargin, setLayoutLeftMargin, setLayoutMargin, setLayoutRightMargin, setLayoutTopMargin, setLeaveScrollbarGap, setLocateMembersBy, setLocateMembersType, 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, addMovedHandler, addParentMovedHandler, addPeer, addPeer, addResizedHandler, addRightMouseDownHandler, addScrolledHandler, addShowContextMenuHandler, addStyleName, addVisibilityChangedHandler, 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, getAnimateShowEffect, getAnimateShowTime, getAnimateTime, getAppImgDir, getAriaRole, getAutoShowParent, getBackgroundColor, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorder, getBottom, getById, getCanAcceptDrop, getCanDrag, getCanDragScroll, getCanDrop, getCanDropBefore, getCanFocus, getCanHover, getCanSelectText, getCanvasItem, 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, getEdgeMarginSize, getEdgeOffset, getEdgeOpacity, getEdgeShowCenter, getEdgeSize, getExtraSpace, getFacetId, getFullDataPath, getGroupTitle, getHeight, getHeightAsString, getHoverAlign, getHoverAutoDestroy, getHoverComponent, getHoverDelay, getHoverHeight, getHoverHTML, getHoverMoveWithMouse, getHoverOpacity, getHoverStyle, getHoverVAlign, getHoverWidth, getHoverWrap, getHSnapOrigin, getHSnapOrigin, getHSnapPosition, getHSnapPosition, getHtmlPosition, getImgURL, getImgURL, getInnerContentHeight, getInnerContentWidth, getInnerHeight, getInnerWidth, getIsGroup, getLeft, getLeftAsString, getLocateChildrenBy, getLocateChildrenType, getLocatePeersBy, getLocatePeersType, getMargin, getMatchElement, getMaxHeight, getMaxWidth, getMenuConstructor, getMinHeight, getMinWidth, getMouseStillDownDelay, getMouseStillDownInitialDelay, getNextZIndex, getNoDoubleClicks, getOffsetHeight, getOffsetWidth, getOffsetX, getOffsetY, getOpacity, getPadding, getPageBottom, getPageLeft, getPageRect, getPageRight, getPageTop, getParentElement, getPercentBox, getPosition, getPrefix, getPrintHTML, getPrintHTML, getPrompt, getRect, getRedrawOnResize, getResizeBarTarget, getRight, getScrollbarSize, getScrollBottom, getScrollHeight, getScrollLeft, getScrollRight, getScrollTop, getScrollWidth, getShadowDepth, getShadowImage, getShadowOffset, getShadowSoftness, getShouldPrint, getShowCustomScrollbars, getShowDragShadow, getShowEdges, getShowHover, getShowHoverComponents, getShowResizeBar, getShowShadow, getSkinImgDir, getSnapAxis, getSnapEdge, getSnapHDirection, getSnapHGap, getSnapOffsetLeft, getSnapOffsetTop, getSnapOnDrop, getSnapResizeToGrid, getSnapTo, getSnapToGrid, getSnapVDirection, getSnapVGap, getStyleName, getTabIndex, getTooltip, getTop, getTopAsString, getUseOpacityFilter, 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, printComponents, redraw, redraw, removeChild, removeChild, resizeBy, resizeTo, resizeTo, scrollBy, scrollByPercent, scrollTo, scrollTo, scrollToBottom, scrollToLeft, scrollToPercent, scrollToRight, scrollToTop, sendToBack, setAccessKey, setAllowExternalFilters, setAnimateAcceleration, setAnimateFadeTime, setAnimateHideAcceleration, setAnimateHideTime, setAnimateMoveAcceleration, setAnimateMoveTime, setAnimateRectAcceleration, setAnimateRectTime, setAnimateResizeAcceleration, setAnimateResizeTime, setAnimateScrollAcceleration, setAnimateScrollTime, setAnimateShowAcceleration, setAnimateShowEffect, setAnimateShowTime, setAnimateTime, setAppImgDir, setAriaRole, setAutoHeight, setAutoShowParent, setAutoWidth, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBottom, setCanAcceptDrop, setCanDrag, setCanDragScroll, setCanDrop, setCanDropBefore, setCanFocus, setCanHover, setCanSelectText, setCanvasItem, setChildren, setChildrenSnapResizeToGrid, setChildrenSnapToGrid, setContents, setContextMenu, setCursor, setDataPath, setDefaultHeight, setDefaultProperties, setDefaultWidth, setDisabled, setDisabledCursor, setDoubleClickDelay, setDragAppearance, setDragIntersectStyle, setDragOpacity, setDragRepositionCursor, setDragScrollDelay, setDragStartDistance, setDragTarget, setDragType, setDropTypes, setDynamicContents, setEdgeBackgroundColor, setEdgeCenterBackgroundColor, setEdgeImage, setEdgeMarginSize, setEdgeOffset, setEdgeOpacity, setEdgeShowCenter, setEdgeSize, setExtraSpace, setFacetId, setGroupTitle, setHeight, setHeight, setHeight100, setHoverAlign, setHoverAutoDestroy, setHoverDelay, setHoverHeight, setHoverMoveWithMouse, setHoverOpacity, setHoverStyle, setHoverVAlign, setHoverWidth, setHoverWrap, setHtmlPosition, setImage, setImage, setIsGroup, setLayoutAlign, setLayoutAlign, setLeft, setLeft, setLocateChildrenBy, setLocateChildrenType, setLocatePeersBy, setLocatePeersType, setMargin, setMatchElement, setMaxHeight, setMaxWidth, setMenuConstructor, setMinHeight, setMinWidth, setMouseStillDownDelay, setMouseStillDownInitialDelay, setNeverUseFilters, setNoDoubleClicks, setOpacity, setPadding, setPageLeft, setPageTop, setParentElement, setPercentBox, setPosition, setPrefix, setPrompt, setRect, setRect, setRedrawOnResize, setResizeBarTarget, setResizeFrom, setRight, setScrollbarSize, setShadowDepth, setShadowImage, setShadowOffset, setShadowSoftness, setShouldPrint, setShowCustomScrollbars, setShowDragShadow, setShowEdges, setShowHover, setShowHoverComponents, setShowResizeBar, setShowShadow, setSkinImgDir, setSmoothFade, setSnapAxis, setSnapEdge, setSnapHDirection, setSnapHGap, setSnapOffsetLeft, setSnapOffsetTop, setSnapOnDrop, setSnapResizeToGrid, setSnapTo, setSnapToGrid, setSnapVDirection, setSnapVGap, setStyleName, setTabIndex, setTooltip, setTop, setTop, setUseOpacityFilter, setValuesManager, setVisibility, setVisible, setWidth, setWidth, setWidth100, setZIndex, shouldDragScroll, show, showClickMask, showNextTo, showNextTo, showPrintPreview, showPrintPreview, showPrintPreview, showPrintPreview, updateHover, updateHover, updateShadow, 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, getAttributeAsFloatArray, getAttributeAsInt, getAttributeAsIntArray, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getConfig, getDOM, getElement, getElement, getHandlerCount, getID, getInnerHTML, getJsObj, getOrCreateJsObj, getRef, getScClassName, hashCode, isConfigOnly, isCreated, onDestroy, onDraw, setAttribute, 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, setScClassName, toString |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, 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, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, unsinkEvents |
ColorPicker
public ColorPicker()
ColorPicker
public ColorPicker(JavaScriptObject jsObj)
getOrCreateRef
public static ColorPicker getOrCreateRef(JavaScriptObject jsObj)
create
protected JavaScriptObject create()
- Overrides:
create
in class Window
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
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- See Also:
setAutoPosition(java.lang.Boolean)
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
- See Also:
getAutoPosition()
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- See Also:
setAutoCenterOnShow(java.lang.Boolean)
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
- See Also:
getAutoCenterOnShow()
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
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
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
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
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
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
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
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
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
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
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
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.
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
- 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
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
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
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
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
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:
setBlue(int)
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:
setGreen(int)
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:
setHtmlColor(java.lang.String)
getHue
public int getHue()
- Returns the Hue of the currently-selected color, as an integer from 0-239
- Returns:
- hue value
- See Also:
setHue(int)
getLuminosity
public int getLuminosity()
- Returns the Luminosity (brightness) of the currently-selected color, as an integer from 0-240
- Returns:
- luminosity value
- See Also:
setLuminosity(int)
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:
setRed(int)
getSaturation
public int getSaturation()
- Returns the Saturation of the currently-selected color, as an integer from 0-240
- Returns:
- saturation value
- See Also:
setSaturation(int)
setBlue
public void setBlue(int newValue)
- Sets the Blue 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
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)
setHue
public void setHue(int newValue)
- Sets the Hue of the selected color
- Parameters:
newValue
- An integer between 0 and 239
setLuminosity
public void setLuminosity(int newValue)
- Sets the Luminosity (brightness) of the selected color
- Parameters:
newValue
- An integer between 0 and 240
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
setRed
public void setRed(int newValue)
- Sets the Red element of the selected color
- Parameters:
newValue
- An integer between 0 and 255
setSaturation
public void setSaturation(int newValue)
- Sets the Saturation of the selected color
- Parameters:
newValue
- An integer between 0 and 240
setDefaultProperties
public static void setDefaultProperties(ColorPicker colorPickerProperties)
- Class level method to set the default properties of this class. If set, then all subsequent instances of this
class will automatically have the default properties that were set when this method was called. 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 effect 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.
- Parameters:
colorPickerProperties
- properties that should be used as new defaults when instances of this class are created