Zimlet JavaScript API Reference - DwtButtonColorPicker

Class DwtButtonColorPicker


Extends DwtButton, DwtButton.

This class ntegrates DwtButton with a popup DwtColorPicker. This class is useful to present a color picker button with an integrated drop-down for choosing from a color palette. You can use addSelectionListener to register a handler that will get called when a new color is selected. Inspect "ev.detail" to retrieve the color (guaranteed to be in #RRGGBB format).

The button also features a DIV that displays the currently selected color. Upon clicking that DIV, the color will be cleared (in this event, ev.detail will be the empty string in your selection listener). Note you must call showColorDisplay() in order for this DIV to be displayed.

All constructor arguments are passed forward to the DwtButton constructor.

Defined in: DwtButtonColorPicker.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a button
Method Summary
Method Attributes Method Name and Description
 
Gets the color.
 
setColor(color)
Set the current color.
 
showColorDisplay(disableMouseOver)
Shows the color display.
<static>  
DwtButtonColorPicker.toHex(n, pad)
Utility function that converts the given integer to its hexadecimal representation.
Methods borrowed from class DwtButton:
addDropDownSelectionListener, addSelectionListener, dispose, getKeyMapName, getMenu, handleKeyAction, isToggled, popup, removeDropDownSelectionListener, removePullDownMenuOptions, removeSelectionListener, removeSelectionListeners, resetClassName, setActionTiming, setDepressedImage, setDisplayState, setDropDownHovImage, setDropDownImages, setEnabled, setEnabledImage, setHovered, setHoverImage, setImage, setMenu, setSelected, setText
Methods borrowed from class DwtLabel:
getImage, getText, isStyle, setAlign, setDisabledImage, setIconEl, setTextBackground, setTextForeground, toString
Methods borrowed from class DwtComposite:
addChild, cleanupSeparators, clear, getChild, getChildren, getNumChildren, getTabGroupMember, removeChild, removeChildren
Methods borrowed from class DwtControl:
addClassName, addControlListener, addDisposeListener, addListener, appendElement, blur, clearContent, clearHandler, condClassName, delClassName, focus, getBounds, getClassName, getContent, getCursor, getData, getDragBox, getDragSource, getDropTarget, getEnabled, getFocusElement, getH, getHtmlElement, getHTMLElId, getInsetBounds, getInsets, getLocation, getMargins, getOpacity, getOuterSize, getPosition, getScrollContainer, getScrollStyle, getSize, getTooltipBase, getToolTipContent, getVisibility, getVisible, getW, getX, getXW, getY, getYH, getZIndex, hasFocus, isAlertShown, isDisposed, isInitialized, isListenerRegistered, notifyListeners, preventContextMenu, preventSelection, removeAllListeners, removeControlListener, removeDisposeListener, removeListener, reparent, reparentHtmlElement, replaceElement, setBounds, setClassName, setContent, setCursor, setData, setDisplay, setDragBox, setDragSource, setDropTarget, setEventPropagation, setFocusElement, setHandler, setHtmlElementId, setLocation, setOpacity, setPosition, setScrollStyle, setSize, setToolTipContent, setVisibility, setVisible, setZIndex, showAlert, zShow
Class Detail
DwtButtonColorPicker(params)
Creates a button
Author: Mihai Bazon.
Parameters:
{hash} params
a hash of parameters
{DwtComposite} params.parent
the parent widget
{constant} params.style
the button style
{string} params.className
the CSS class
{constant} params.posStyle
the positioning style
{string} params.id
the ID to use for the control's HTML element
{number} params.index
the index at which to add this control among parent's children
{boolean} params.allowColorInput
if true, allow a text field to allow user to input their customized RGB value
{boolean} params.noFillLabel
if true, do not fill label
Method Detail
{string} getColor()
Gets the color.
Returns:
{string} the currently selected color

setColor(color)
Set the current color.
Parameters:
{string} color
the desired color. Pass the empty string "" to clear the selection.

showColorDisplay(disableMouseOver)
Shows the color display. Call this function to display a DIV that shows the currently selected color. This DIV also has the ability to clear the current color.
Parameters:
{boolean} disableMouseOver
if true, disable the mouse over

<static> {string} DwtButtonColorPicker.toHex(n, pad)
Utility function that converts the given integer to its hexadecimal representation.
Parameters:
{number} n
the number to convert
{number} pad Optional
the number of digits in the final number (zero-padded if required)
Returns:
{string} the hexadecimal representation

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:27 GMT-0400 (EDT)