org.xwiki.gwt.wysiwyg.client.plugin.color
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.google.gwt.user.client.ui.Composite
              extended by org.xwiki.gwt.wysiwyg.client.plugin.color.ColorPalette
All Implemented Interfaces:
com.google.gwt.event.dom.client.ClickHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasSelectionHandlers<String>, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget

public class ColorPalette
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.event.logical.shared.HasSelectionHandlers<String>, com.google.gwt.event.dom.client.ClickHandler

A set of colors from which the user can choose one by clicking.

Version:
$Id: efc3251bd86f62e11d9d5823ced67ad4037b6ff7 $

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(String[] colors, int columnCount)
          Creates a new color palette using the specified color codes to fill the color grid.
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<String> handler)
          
protected  com.google.gwt.user.client.ui.Grid getColorGrid()
           
 String getSelectedColor()
           
 void onClick(com.google.gwt.event.dom.client.ClickEvent event)
          
 void setSelectedColor(String color)
          Selects a color in the color grid by its color code.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

ColorPalette

public ColorPalette(String[] colors,
                    int columnCount)
Creates a new color palette using the specified color codes to fill the color grid.

Parameters:
colors - the array of color codes that are used to fill the color grid.
columnCount - the maximum number of columns the color grid can have.
Method Detail

addSelectionHandler

public com.google.gwt.event.shared.HandlerRegistration addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<String> handler)

Specified by:
addSelectionHandler in interface com.google.gwt.event.logical.shared.HasSelectionHandlers<String>
See Also:
HasSelectionHandlers.addSelectionHandler(SelectionHandler)

getColorGrid

protected com.google.gwt.user.client.ui.Grid getColorGrid()
Returns:
the color grid that makes up this palette

onClick

public void onClick(com.google.gwt.event.dom.client.ClickEvent event)

Specified by:
onClick in interface com.google.gwt.event.dom.client.ClickHandler
See Also:
ClickHandler.onClick(ClickEvent)

getSelectedColor

public String getSelectedColor()
Returns:
the color code for the grid cell that was last clicked, or null if no cell has been selected

setSelectedColor

public void setSelectedColor(String color)
Selects a color in the color grid by its color code.

Parameters:
color - the code of the color to be selected


Copyright © 2004–2014 XWiki. All rights reserved.