public abstract class AbstractColorPicker extends AbstractComponent implements Window.CloseListener, ColorSelector
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractColorPicker.Coordinates2Color
Interface for converting 2d-coordinates to a Color
|
static class |
AbstractColorPicker.PopupStyle |
Component.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.Unit| Modifier and Type | Field and Description |
|---|---|
protected Color |
color
The color.
|
protected boolean |
historyVisible |
protected boolean |
hsvVisible |
protected String |
popupCaption |
protected AbstractColorPicker.PopupStyle |
popupStyle |
protected boolean |
rgbVisible |
protected static String |
STYLENAME_AREA |
protected static String |
STYLENAME_BUTTON |
protected static String |
STYLENAME_DEFAULT |
protected boolean |
swatchesVisible |
protected boolean |
textfieldVisible |
DESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
AbstractColorPicker()
Instantiates a new color picker.
|
AbstractColorPicker(String popupCaption)
Instantiates a new color picker.
|
AbstractColorPicker(String popupCaption,
Color initialColor)
Instantiates a new color picker.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColorChangeListener(ColorChangeListener listener)
Adds a
ColorChangeListener to the component. |
protected void |
colorChanged(ColorChangeEvent event)
Fired when a color change event occurs
|
void |
fireColorChanged()
Notifies the listeners that the selected color has changed
|
Color |
getColor()
Gets the color.
|
protected Collection<String> |
getCustomAttributes()
Returns a collection of attributes that should not be handled by the
basic implementation of the
readDesign and writeDesign
methods. |
boolean |
getHistoryVisibility()
Gets the visibility of the Color History
|
boolean |
getHSVVisibility()
Gets the visibility of the HSV Tab
|
AbstractColorPicker.PopupStyle |
getPopupStyle()
Gets the style for the popup window
|
boolean |
getRGBVisibility()
Gets the visibility of the RGB Tab
|
protected ColorPickerState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
protected ColorPickerState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
boolean |
getSwatchesVisibility()
Gets the visibility of the Swatches Tab
|
boolean |
getTextfieldVisibility()
Gets the visibility of CSS color code text field
|
void |
hidePopup()
Hides a popup-window for color selection.
|
boolean |
isDefaultCaptionEnabled()
Returns true if the component shows the default caption (css-code for the
currently selected color, e.g.
|
boolean |
isHtmlContentAllowed()
Deprecated.
as of , use
AbstractComponent.isCaptionAsHtml() instead |
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Reads the component state from the given design.
|
void |
removeColorChangeListener(ColorChangeListener listener)
Removes a
ColorChangeListener from the component. |
void |
setColor(Color color)
Sets the color.
|
void |
setDefaultCaptionEnabled(boolean enabled)
Set true if the component should show a default caption (css-code for the
currently selected color, e.g.
|
protected abstract void |
setDefaultStyles()
Sets the default styles of the component
|
void |
setHistoryVisibility(boolean visible)
Sets the visibility of the Color History
|
void |
setHSVVisibility(boolean visible)
Set the visibility of the HSV Tab
|
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Deprecated.
as of , use
AbstractComponent.setCaptionAsHtml(boolean) instead |
void |
setPopupStyle(AbstractColorPicker.PopupStyle style)
The style for the popup window
|
void |
setPosition(int x,
int y)
Sets the position of the popup window
|
void |
setRGBVisibility(boolean visible)
Set the visibility of the RGB Tab
|
void |
setSwatchesVisibility(boolean visible)
Set the visibility of the Swatches Tab
|
void |
setTextfieldVisibility(boolean visible)
Sets the visibility of the CSS color code text field
|
void |
showPopup()
Shows a popup-window for color selection.
|
protected void |
showPopup(boolean open)
Shows or hides popup-window depending on the given parameter.
|
void |
windowClose(Window.CloseEvent e)
Called when the user closes a window.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
Writes the component state to the given design.
|
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setParent, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefinedaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResourceclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdprotected static final String STYLENAME_DEFAULT
protected static final String STYLENAME_BUTTON
protected static final String STYLENAME_AREA
protected AbstractColorPicker.PopupStyle popupStyle
protected Color color
protected String popupCaption
protected boolean rgbVisible
protected boolean hsvVisible
protected boolean swatchesVisible
protected boolean historyVisible
protected boolean textfieldVisible
public AbstractColorPicker()
public AbstractColorPicker(String popupCaption)
popupCaption - the caption of the popup windowpublic void setColor(Color color)
ColorSelectorsetColor in interface ColorSelectorcolor - the new colorpublic Color getColor()
ColorSelectorgetColor in interface ColorSelectorpublic void setDefaultCaptionEnabled(boolean enabled)
enabled - public boolean isDefaultCaptionEnabled()
public void setPosition(int x,
int y)
x - the x-coordinatey - the y-coordinatepublic void addColorChangeListener(ColorChangeListener listener)
HasColorChangeListenerColorChangeListener to the component.addColorChangeListener in interface HasColorChangeListenerpublic void removeColorChangeListener(ColorChangeListener listener)
HasColorChangeListenerColorChangeListener from the component.removeColorChangeListener in interface HasColorChangeListenerpublic void windowClose(Window.CloseEvent e)
Window.CloseListenerWindow.CloseEvent.getWindow() to get a reference to the
Window that was closed.windowClose in interface Window.CloseListenere - Event containingprotected void colorChanged(ColorChangeEvent event)
event - The color change eventpublic void fireColorChanged()
public void setPopupStyle(AbstractColorPicker.PopupStyle style)
style - The stylepublic AbstractColorPicker.PopupStyle getPopupStyle()
public void setRGBVisibility(boolean visible)
visible - The visibilitypublic boolean getRGBVisibility()
public void setHSVVisibility(boolean visible)
visible - The visibilitypublic boolean getHSVVisibility()
public void setSwatchesVisibility(boolean visible)
visible - The visibilitypublic boolean getSwatchesVisibility()
public void setHistoryVisibility(boolean visible)
visible - The visibilitypublic boolean getHistoryVisibility()
public void setTextfieldVisibility(boolean visible)
visible - The visibilitypublic boolean getTextfieldVisibility()
protected ColorPickerState getState()
AbstractComponentgetState in class AbstractComponentprotected ColorPickerState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class AbstractComponentmarkAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()protected abstract void setDefaultStyles()
public void showPopup()
public void hidePopup()
protected void showPopup(boolean open)
open - @Deprecated public void setHtmlContentAllowed(boolean htmlContentAllowed)
AbstractComponent.setCaptionAsHtml(boolean) insteadhtmlContentAllowed - true if caption is rendered as HTML,
false otherwise@Deprecated public boolean isHtmlContentAllowed()
AbstractComponent.isCaptionAsHtml() insteadtrue if the caption text is to be rendered as HTML,
false otherwisepublic void readDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign in interface ComponentreadDesign in class AbstractComponentdesign - The element to obtain the state fromdesignContext - The DesignContext instance used for parsing the designpublic void writeDesign(org.jsoup.nodes.Element design,
DesignContext designContext)
ComponentThe component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign in interface ComponentwriteDesign in class AbstractComponentdesign - The element to write the component state to. Any previous
attributes or child nodes are not cleared.designContext - The DesignContext instance used for writing the designprotected Collection<String> getCustomAttributes()
AbstractComponentreadDesign and writeDesign
methods. Typically these are handled in a custom way in the overridden
versions of the above methodsgetCustomAttributes in class AbstractComponentCopyright © 2017 Vaadin Ltd. All rights reserved.