com.extjs.gxt.ui.client.widget
Class ColorPalette

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.ColorPalette
All Implemented Interfaces:
Observable, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget

public class ColorPalette
extends Component

Basic color component.

Events:
BeforeSelect : ColorPaletteEvent(colorPalette, color)
Fires before a color selected.
Select : ColorPaletteEvent(colorPalette, color)
Fires when a color is selected.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.extjs.gxt.ui.client.widget.Component
afterRender, attachables, baseStyle, disabled, disabledStyle, disableTextSelection, dummy, focusable, hidden, mask, maskMessage, maskMessageStyleName, monitorWindowResize, rendered, resizeHandler, setElementRender, stateId, swallowEvents, toolTip, windowResizeDelay, windowResizeTask
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
ColorPalette()
          Creates a new color palette.
 
Method Summary
protected  void afterRender()
          Called after the component has been rendered and is attached for the first time.
protected  ComponentEvent createComponentEvent(com.google.gwt.user.client.Event event)
           
 java.lang.String[] getColors()
          Returns the colors.
 int getColumnCount()
          Returns the column count.
 XTemplate getTemplate()
          Returns the xtemplate.
 java.lang.String getValue()
          Returns the current selected color.
 boolean isAllowReselect()
          Returns true if re-selections are allowed.
protected  void onBlur(ComponentEvent ce)
           
protected  void onClick(ComponentEvent ce)
           
 void onComponentEvent(ComponentEvent ce)
          Any events a component receives will be forwarded to this method.
protected  void onFocus(ComponentEvent ce)
           
protected  void onKeyDown(ComponentEvent ce)
           
protected  void onKeyEnter(ComponentEvent ce)
           
protected  void onKeyLeft(ComponentEvent ce)
           
protected  void onKeyRight(ComponentEvent ce)
           
protected  void onKeyUp(ComponentEvent ce)
           
protected  void onMouseOut(ComponentEvent ce)
           
protected  void onMouseOver(ComponentEvent ce)
           
protected  void onRender(com.google.gwt.user.client.Element target, int index)
          Subclasses must override and ensure setElement is called for lazy rendered components.
 void select(java.lang.String color)
          Selects the color.
 void select(java.lang.String color, boolean suppressEvent)
          Selects the color.
 void setAllowReselect(boolean allowReselect)
          True to fire a select event if the current selected value is selected again (default to false).
 void setColors(java.lang.String[] colors)
          Sets the colors for the palette.
 void setColumnCount(int columnCount)
          Sets the column count for the palette.
 void setTemplate(XTemplate template)
          Optionally, sets the xtemplate to be used to render the component.
 void setValue(java.lang.String value)
          Sets the selected color.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addAttachable, addListener, addPlugin, addStyleName, addStyleOnOver, addWidgetListener, applyState, assertAfterRender, assertPreRender, beforeRender, blur, clearState, createObservable, createStyles, disable, disableContextMenu, disableEvents, disableTextSelection, doAttachChildren, doDetachChildren, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, frame, getAriaSupport, getBaseStyle, getBorders, getContextMenu, getData, getElement, getFocusEl, getFocusSupport, getHideMode, getId, getItemId, getListeners, getModel, getObservable, getPlugins, getState, getStateId, getTabIndex, getTitle, getToolTip, getWindowResizeDelay, hasListeners, hasListeners, hide, hideToolTip, initState, isDisabledEvents, isDisableTextSelection, isEnabled, isMasked, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, mask, notifyHide, notifyShow, onAttach, onBrowserEvent, onDetach, onDetachHelper, onDisable, onEnable, onEnsureDebugId, onHide, onHideContextMenu, onLoad, onRightClick, onShow, onShowContextMenu, onWindowResize, previewEvent, recalculate, removeAllListeners, removeAttachagle, removeFromParent, removeListener, removeStyleName, removeStyleOnOver, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setAriaRole, setAriaState, setAriaSupport, setBorders, setContextMenu, setData, setEl, setElement, setElement, setEnabled, setFiresEvents, setHeight, setHideMode, setId, setIntStyleAttribute, setItemId, setModel, setMonitorWindowResize, setParent, setPixelSize, setSize, setStateful, setStateId, setStyleAttribute, setStyleName, setTabIndex, setTitle, setToolTip, setToolTip, setVisible, setWidth, setWindowResizeDelay, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unframe, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onUnload, setLayoutData
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, setElement, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColorPalette

public ColorPalette()
Creates a new color palette.

Method Detail

getColors

public java.lang.String[] getColors()
Returns the colors.

Returns:
the colors

getColumnCount

public int getColumnCount()
Returns the column count.

Returns:
the columnCount

getTemplate

public XTemplate getTemplate()
Returns the xtemplate.

Returns:
the template

getValue

public java.lang.String getValue()
Returns the current selected color.

Returns:
the value

isAllowReselect

public boolean isAllowReselect()
Returns true if re-selections are allowed.

Returns:
the true if re-selections are allowed.

onComponentEvent

public void onComponentEvent(ComponentEvent ce)
Description copied from class: Component
Any events a component receives will be forwarded to this method. Subclasses should override as needed. The Component.onBrowserEvent(com.google.gwt.user.client.Event) method should not be overridden or modified.

Overrides:
onComponentEvent in class Component
Parameters:
ce - the base event

select

public void select(java.lang.String color)
Selects the color.

Parameters:
color - the color

select

public void select(java.lang.String color,
                   boolean suppressEvent)
Selects the color.

Parameters:
color - the color
suppressEvent - true to suppress the select event

setAllowReselect

public void setAllowReselect(boolean allowReselect)
True to fire a select event if the current selected value is selected again (default to false).

Parameters:
allowReselect - true to fire select events if re-selected

setColors

public void setColors(java.lang.String[] colors)
Sets the colors for the palette.

Parameters:
colors - the colors to set

setColumnCount

public void setColumnCount(int columnCount)
Sets the column count for the palette.

Parameters:
columnCount - the columnCount to set

setTemplate

public void setTemplate(XTemplate template)
Optionally, sets the xtemplate to be used to render the component.

Parameters:
template - the xtemplate

setValue

public void setValue(java.lang.String value)
Sets the selected color.

Parameters:
value - the value to set

afterRender

protected void afterRender()
Description copied from class: Component
Called after the component has been rendered and is attached for the first time. At this time, the component will be part of the DOM which is required when retrieving location and offsets.

Overrides:
afterRender in class Component

createComponentEvent

protected ComponentEvent createComponentEvent(com.google.gwt.user.client.Event event)
Overrides:
createComponentEvent in class Component

onBlur

protected void onBlur(ComponentEvent ce)

onClick

protected void onClick(ComponentEvent ce)

onFocus

protected void onFocus(ComponentEvent ce)

onKeyDown

protected void onKeyDown(ComponentEvent ce)

onKeyEnter

protected void onKeyEnter(ComponentEvent ce)

onKeyLeft

protected void onKeyLeft(ComponentEvent ce)

onKeyRight

protected void onKeyRight(ComponentEvent ce)

onKeyUp

protected void onKeyUp(ComponentEvent ce)

onMouseOut

protected void onMouseOut(ComponentEvent ce)

onMouseOver

protected void onMouseOver(ComponentEvent ce)

onRender

protected void onRender(com.google.gwt.user.client.Element target,
                        int index)
Description copied from class: Component
Subclasses must override and ensure setElement is called for lazy rendered components.

Overrides:
onRender in class Component
Parameters:
target - the target element
index - the insert location