Class ColorPickerPreview
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.AbstractComponentContainer
-
- com.vaadin.ui.AbstractLayout
-
- com.vaadin.ui.CssLayout
-
- com.vaadin.ui.components.colorpicker.ColorPickerPreview
-
- All Implemented Interfaces:
HasValue<Color>,ContextClickEvent.ContextClickNotifier,LayoutEvents.LayoutClickNotifier,MethodEventSource,ClientConnector,Sizeable,Connector,Component,ComponentContainer,HasComponents,HasComponents.ComponentAttachDetachNotifier,Layout,Serializable,Iterable<Component>
public class ColorPickerPreview extends CssLayout implements HasValue<Color>
A component that represents color selection preview within a color picker.- Since:
- 7.0.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.data.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<V>
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Layout
Layout.AlignmentHandler, Layout.MarginHandler, Layout.SpacingHandler
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.CssLayout
components
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Constructor Summary
Constructors Constructor Description ColorPickerPreview(Color color)Instantiates a new color picker preview.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegistrationaddValueChangeListener(HasValue.ValueChangeListener<Color> listener)Adds a value change listener.protected StringgetCss(Component c)Returns styles to be applied to given component.protected StringgetUserErrorText(String value)Get the client error message text for color input parsing error.ColorgetValue()Returns the current value of this object.booleanisReadOnly()Returns the read-only status from the state of thisAbstractComponent.booleanisRequiredIndicatorVisible()Checks whether the required indicator is visible or not.voidsetReadOnly(boolean readOnly)Sets the read-only status in the state of thisAbstractComponent.voidsetRequiredIndicatorVisible(boolean visible)Sets the visibility of the required indicator.voidsetValue(Color color)Sets the value of this object.-
Methods inherited from class com.vaadin.ui.CssLayout
addComponent, addComponent, addComponentAsFirst, addLayoutClickListener, beforeClientResponse, getComponent, getComponentCount, getComponentIndex, getState, getState, iterator, readDesign, removeComponent, removeLayoutClickListener, replaceComponent, writeDesign
-
Methods inherited from class com.vaadin.ui.AbstractLayout
readMargin, writeMargin
-
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addComponentAttachListener, addComponentDetachListener, addComponents, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, moveComponentsFrom, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, setHeight, setWidth
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthFull, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, 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, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible
-
Methods inherited from interface com.vaadin.ui.ComponentContainer
addComponents, getComponentIterator, moveComponentsFrom, removeAllComponents
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier
addComponentAttachListener, addComponentDetachListener, removeComponentAttachListener, removeComponentDetachListener
-
Methods inherited from interface com.vaadin.data.HasValue
clear, getDefaultValidator, getEmptyValue, getOptionalValue, isEmpty
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
-
-
-
-
Constructor Detail
-
ColorPickerPreview
public ColorPickerPreview(Color color)
Instantiates a new color picker preview.
-
-
Method Detail
-
setValue
public void setValue(Color color)
Sets the value of this object. If the new value is not equal togetValue(), fires aHasValue.ValueChangeEvent. ThrowsNullPointerExceptionif the value is null.- Specified by:
setValuein interfaceHasValue<Color>- Parameters:
color- the new value, notnull- Throws:
NullPointerException- ifcolorisnull
-
getValue
public Color getValue()
Description copied from interface:HasValueReturns the current value of this object.Implementation note: the implementing class should document whether null values may be returned or not.
-
addValueChangeListener
public Registration addValueChangeListener(HasValue.ValueChangeListener<Color> listener)
Description copied from interface:HasValueAdds a value change listener. The listener is called when the value of thisHasValueis changed either by the user or programmatically.- Specified by:
addValueChangeListenerin interfaceHasValue<Color>- Parameters:
listener- the value change listener, not null- Returns:
- a registration for the listener
-
getCss
protected String getCss(Component c)
Description copied from class:CssLayoutReturns styles to be applied to given component. Override this method to inject custom style rules to components.Note that styles are injected over previous styles before actual child rendering. Previous styles are not cleared, but overridden.
Note that one most often achieves better code style, by separating styling to theme (with custom theme and
AbstractComponent.addStyleName(String). With own custom styles it is also very easy to break browser compatibility.
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean visible)
Description copied from class:AbstractComponentSets the visibility of the required indicator. NOTE: Does not apply for all components!.If the component supports the required indicator (state extends
AbstractFieldState), then expose this method andAbstractComponent.isRequiredIndicatorVisible()aspublicin the component and call this method.This method will throw a
IllegalStateExceptionif the component state (returned byAbstractComponent.getState()) does not inheritAbstractFieldState.- Specified by:
setRequiredIndicatorVisiblein interfaceHasValue<Color>- Overrides:
setRequiredIndicatorVisiblein classAbstractComponent- Parameters:
visible-trueto make the required indicator visible,falseif not
-
isRequiredIndicatorVisible
public boolean isRequiredIndicatorVisible()
Description copied from class:AbstractComponentChecks whether the required indicator is visible or not. NOTE: Does not apply for all components!.This method will throw a
IllegalStateExceptionif the component state (returned byAbstractComponent.getState()) does not inheritAbstractFieldState.- Specified by:
isRequiredIndicatorVisiblein interfaceHasValue<Color>- Overrides:
isRequiredIndicatorVisiblein classAbstractComponent- Returns:
trueif visible,falseif not- See Also:
AbstractComponent.setRequiredIndicatorVisible(boolean)
-
setReadOnly
public void setReadOnly(boolean readOnly)
Description copied from class:AbstractComponentSets the read-only status in the state of thisAbstractComponent. This method should be made public inComponentsthat implementHasValue.- Specified by:
setReadOnlyin interfaceHasValue<Color>- Overrides:
setReadOnlyin classAbstractComponent- Parameters:
readOnly- a boolean value specifying whether the component is put read-only mode or not
-
isReadOnly
public boolean isReadOnly()
Description copied from class:AbstractComponentReturns the read-only status from the state of thisAbstractComponent. This method should be made public inComponentsthat implementHasValue.- Specified by:
isReadOnlyin interfaceHasValue<Color>- Overrides:
isReadOnlyin classAbstractComponent- Returns:
trueif state has read-only on;falseif not- See Also:
AbstractComponent.setReadOnly(boolean)
-
-