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.shared.HasHandlers, com.google.gwt.user.client.EventListener

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.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
ColorPalette()
          Creates a new color palette.
 
Method Summary
 java.lang.String[] getColors()
          Returns the colors.
 XTemplate getTemplate()
          Returns the xtemplate.
 java.lang.String getValue()
          Returns the current selected color.
 boolean isAllowReselect()
          Returns true if re-selections are allowed.
 void onComponentEvent(ComponentEvent ce)
          Any events a component receives will be forwarded to this method.
 void select(java.lang.String color)
          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 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
addListener, addPlugin, addStyleName, addWidgetListener, clearState, disable, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, getBaseStyle, getBorders, getContextMenu, getData, getElement, getHideMode, getId, getItemId, getListeners, getModel, getState, getStateId, getToolTip, hasListeners, hasListeners, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isStateful, isVisible, mask, mask, mask, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeSwallow, removeToolTip, removeWidgetListener, render, render, repaint, saveState, setBorders, setContextMenu, setData, setElement, setEnabled, setHeight, setHideMode, setId, setIntStyleAttribute, setItemId, setPixelSize, setSize, setStateful, setStateId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, setWidth, setZIndex, show, sinkEvents, swallowEvent, swallowEvent, toString, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
fireEvent, getParent, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, 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

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

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

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