Package io.jmix.ui.component.impl
Class ColorPickerImpl
java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<T>
io.jmix.ui.component.impl.AbstractValueComponent<T,P,V>
io.jmix.ui.component.impl.AbstractField<JmixColorPickerWrapper,com.vaadin.shared.ui.colorpicker.Color,String>
io.jmix.ui.component.impl.ColorPickerImpl
- All Implemented Interfaces:
AttachNotifier
,Buffered
,ColorPicker
,Component
,Component.BelongToFrame
,Component.Editable
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasValueSource<String>
,Field<String>
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasValidator<String>
,HasValue<String>
,Requirable
,Validatable
,org.springframework.beans.factory.InitializingBean
public class ColorPickerImpl
extends AbstractField<JmixColorPickerWrapper,com.vaadin.shared.ui.colorpicker.Color,String>
implements ColorPicker, org.springframework.beans.factory.InitializingBean
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasValue
HasValue.ValueChangeEvent<V>
-
Field Summary
Fields inherited from class io.jmix.ui.component.impl.AbstractField
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITY
Fields inherited from class io.jmix.ui.component.impl.AbstractValueComponent
internalValue, uiTestIdsSupport, valueBinding
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.ColorPicker
NAME
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
commit()
Updates all changes since the previous commit to the data source.protected String
convertToModel
(com.vaadin.shared.ui.colorpicker.Color componentRawValue) protected com.vaadin.shared.ui.colorpicker.Color
convertToPresentation
(String modelValue) protected JmixColorPickerWrapper
void
discard()
Discards all changes since last commit.void
focus()
Sets focus to this componentReturns caption of the slider for blue color.Returns caption of color picker button.Returns caption of the cancel button.Returns caption of the confirm button.Returns caption of the slider for green color.Returns caption of the slider for HUE.Returns caption of the all colors in lookup.Returns caption of the blue colors in lookup.Returns caption of the green colors in lookup.Returns caption of the red colors in lookup.Returns caption of the popup window.Returns caption of the slider for red color.Returns caption of the slider for saturation.Returns caption of the swatches tab.int
Gets the tabulator index of theHasTabIndex
component.Returns caption of the slider for value.protected void
initComponent
(JmixColorPickerWrapper component) boolean
boolean
boolean
boolean
boolean
Tests if the value stored in the object has been modified since it was last updated from the data source.boolean
boolean
void
setBlueSliderCaption
(String caption) Sets caption for the slider of blue color.void
setBuffered
(boolean buffered) Sets the buffered mode.void
setButtonCaption
(String value) Sets caption for color picker button.void
setCancelButtonCaption
(String caption) Sets caption for the cancel button.protected void
setCaptions
(Messages messages) void
setConfirmButtonCaption
(String caption) Sets caption for the confirm button.void
setDefaultCaptionEnabled
(boolean defaultCaptionEnabled) Sets HEX value as button caption.void
setGreenSliderCaption
(String caption) Sets caption for the slider of green color.void
setHistoryVisible
(boolean historyVisible) Sets visibility for history panevoid
setHSVVisible
(boolean value) Sets visibility for HSV tabvoid
setHueSliderCaption
(String caption) Sets caption for the HUE slider.void
setLookupAllCaption
(String caption) Sets caption for the all colors in lookup.void
setLookupBlueCaption
(String caption) Sets caption for the blue colors in lookup.void
setLookupGreenCaption
(String caption) Sets caption for the green colors in lookup.void
setLookupRedCaption
(String caption) Sets caption for the red colors in lookup.void
setMessages
(Messages messages) void
setPopupCaption
(String popupCaption) Sets caption for the popup window.void
setRedSliderCaption
(String caption) Sets caption for the slider of red color.void
setRGBVisible
(boolean value) Sets visibility for RGB tabvoid
setSaturationSliderCaption
(String caption) Sets caption for the saturation slider.void
setSwatchesTabCaption
(String caption) Sets caption for the swatches tab.void
setSwatchesVisible
(boolean value) Sets visibility for swatches tabvoid
setTabIndex
(int tabIndex) Sets the tabulator index of theFocusable
component.void
setValueSliderCaption
(String caption) Sets caption for the value slider.Methods inherited from class io.jmix.ui.component.impl.AbstractField
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getDefaultRequiredMessage, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setEditableToComponent, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validate
Methods inherited from class io.jmix.ui.component.impl.AbstractValueComponent
addValueChangeListener, componentValueChanged, fieldValueEquals, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValue, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.Editable
isEditable, isEditableWithParent, setEditable
Methods inherited from interface io.jmix.ui.component.Component.Focusable
isFocusable, setFocusable
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
Methods inherited from interface io.jmix.ui.component.HasValidator
addValidator, addValidators, getValidators, removeValidator
Methods inherited from interface io.jmix.ui.component.HasValue
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValue
Methods inherited from interface io.jmix.ui.component.data.HasValueSource
getValueSource, setValueSource
Methods inherited from interface io.jmix.ui.component.Requirable
getRequiredMessage, isRequired, setRequired, setRequiredMessage
Methods inherited from interface io.jmix.ui.component.Validatable
isValid, isValidateOnCommit, validate
-
Field Details
-
messages
-
-
Constructor Details
-
ColorPickerImpl
public ColorPickerImpl()
-
-
Method Details
-
createComponent
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
initComponent
-
setMessages
-
setCaptions
-
setSwatchesVisible
public void setSwatchesVisible(boolean value) Description copied from interface:ColorPicker
Sets visibility for swatches tab- Specified by:
setSwatchesVisible
in interfaceColorPicker
- Parameters:
value
- tab visibility.
-
isSwatchesVisible
public boolean isSwatchesVisible()- Specified by:
isSwatchesVisible
in interfaceColorPicker
- Returns:
- true if swatches tab is visible.
-
setRGBVisible
public void setRGBVisible(boolean value) Description copied from interface:ColorPicker
Sets visibility for RGB tab- Specified by:
setRGBVisible
in interfaceColorPicker
- Parameters:
value
- tab visibility.
-
isRGBVisible
public boolean isRGBVisible()- Specified by:
isRGBVisible
in interfaceColorPicker
- Returns:
- true if RGB tab is visible.
-
setHSVVisible
public void setHSVVisible(boolean value) Description copied from interface:ColorPicker
Sets visibility for HSV tab- Specified by:
setHSVVisible
in interfaceColorPicker
- Parameters:
value
- tab visibility.
-
isHSVVisible
public boolean isHSVVisible()- Specified by:
isHSVVisible
in interfaceColorPicker
- Returns:
- true if HSV tab is visible.
-
setDefaultCaptionEnabled
public void setDefaultCaptionEnabled(boolean defaultCaptionEnabled) Description copied from interface:ColorPicker
Sets HEX value as button caption.- Specified by:
setDefaultCaptionEnabled
in interfaceColorPicker
- Parameters:
defaultCaptionEnabled
- true if HEX color is shown as button caption.
-
isDefaultCaptionEnabled
public boolean isDefaultCaptionEnabled()- Specified by:
isDefaultCaptionEnabled
in interfaceColorPicker
- Returns:
- true if caption is shown as HTML.
-
setButtonCaption
Description copied from interface:ColorPicker
Sets caption for color picker button.- Specified by:
setButtonCaption
in interfaceColorPicker
- Parameters:
value
- caption text.
-
getButtonCaption
Description copied from interface:ColorPicker
Returns caption of color picker button.- Specified by:
getButtonCaption
in interfaceColorPicker
- Returns:
- caption text.
-
convertToPresentation
@Nullable protected com.vaadin.shared.ui.colorpicker.Color convertToPresentation(@Nullable String modelValue) throws ConversionException - Overrides:
convertToPresentation
in classAbstractValueComponent<JmixColorPickerWrapper,
com.vaadin.shared.ui.colorpicker.Color, String> - Throws:
ConversionException
-
setPopupCaption
Description copied from interface:ColorPicker
Sets caption for the popup window.- Specified by:
setPopupCaption
in interfaceColorPicker
- Parameters:
popupCaption
- caption text.
-
getPopupCaption
Description copied from interface:ColorPicker
Returns caption of the popup window.- Specified by:
getPopupCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setConfirmButtonCaption
Description copied from interface:ColorPicker
Sets caption for the confirm button.- Specified by:
setConfirmButtonCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getConfirmButtonCaption
Description copied from interface:ColorPicker
Returns caption of the confirm button.- Specified by:
getConfirmButtonCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setCancelButtonCaption
Description copied from interface:ColorPicker
Sets caption for the cancel button.- Specified by:
setCancelButtonCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getCancelButtonCaption
Description copied from interface:ColorPicker
Returns caption of the cancel button.- Specified by:
getCancelButtonCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setSwatchesTabCaption
Description copied from interface:ColorPicker
Sets caption for the swatches tab.- Specified by:
setSwatchesTabCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getSwatchesTabCaption
Description copied from interface:ColorPicker
Returns caption of the swatches tab.- Specified by:
getSwatchesTabCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setLookupAllCaption
Description copied from interface:ColorPicker
Sets caption for the all colors in lookup.- Specified by:
setLookupAllCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getLookupAllCaption
Description copied from interface:ColorPicker
Returns caption of the all colors in lookup.- Specified by:
getLookupAllCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setLookupRedCaption
Description copied from interface:ColorPicker
Sets caption for the red colors in lookup.- Specified by:
setLookupRedCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getLookupRedCaption
Description copied from interface:ColorPicker
Returns caption of the red colors in lookup.- Specified by:
getLookupRedCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setLookupGreenCaption
Description copied from interface:ColorPicker
Sets caption for the green colors in lookup.- Specified by:
setLookupGreenCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getLookupGreenCaption
Description copied from interface:ColorPicker
Returns caption of the green colors in lookup.- Specified by:
getLookupGreenCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setLookupBlueCaption
Description copied from interface:ColorPicker
Sets caption for the blue colors in lookup.- Specified by:
setLookupBlueCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getLookupBlueCaption
Description copied from interface:ColorPicker
Returns caption of the blue colors in lookup.- Specified by:
getLookupBlueCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setRedSliderCaption
Description copied from interface:ColorPicker
Sets caption for the slider of red color.- Specified by:
setRedSliderCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getRedSliderCaption
Description copied from interface:ColorPicker
Returns caption of the slider for red color.- Specified by:
getRedSliderCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setGreenSliderCaption
Description copied from interface:ColorPicker
Sets caption for the slider of green color.- Specified by:
setGreenSliderCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getGreenSliderCaption
Description copied from interface:ColorPicker
Returns caption of the slider for green color.- Specified by:
getGreenSliderCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setBlueSliderCaption
Description copied from interface:ColorPicker
Sets caption for the slider of blue color.- Specified by:
setBlueSliderCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getBlueSliderCaption
Description copied from interface:ColorPicker
Returns caption of the slider for blue color.- Specified by:
getBlueSliderCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setHueSliderCaption
Description copied from interface:ColorPicker
Sets caption for the HUE slider.- Specified by:
setHueSliderCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getHueSliderCaption
Description copied from interface:ColorPicker
Returns caption of the slider for HUE.- Specified by:
getHueSliderCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setSaturationSliderCaption
Description copied from interface:ColorPicker
Sets caption for the saturation slider.- Specified by:
setSaturationSliderCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getSaturationSliderCaption
Description copied from interface:ColorPicker
Returns caption of the slider for saturation.- Specified by:
getSaturationSliderCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setValueSliderCaption
Description copied from interface:ColorPicker
Sets caption for the value slider.- Specified by:
setValueSliderCaption
in interfaceColorPicker
- Parameters:
caption
- caption text.
-
getValueSliderCaption
Description copied from interface:ColorPicker
Returns caption of the slider for value.- Specified by:
getValueSliderCaption
in interfaceColorPicker
- Returns:
- caption text.
-
setHistoryVisible
public void setHistoryVisible(boolean historyVisible) Description copied from interface:ColorPicker
Sets visibility for history pane- Specified by:
setHistoryVisible
in interfaceColorPicker
- Parameters:
historyVisible
- pane visibility.
-
isHistoryVisible
public boolean isHistoryVisible()- Specified by:
isHistoryVisible
in interfaceColorPicker
- Returns:
- true if history pane is visible.
-
focus
public void focus()Description copied from interface:Component.Focusable
Sets focus to this component- Specified by:
focus
in interfaceComponent.Focusable
-
getTabIndex
public int getTabIndex()Description copied from interface:Component.Focusable
Gets the tabulator index of theHasTabIndex
component.- Specified by:
getTabIndex
in interfaceComponent.Focusable
- Returns:
- tab index set for the
HasTabIndex
component
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:Component.Focusable
Sets the tabulator index of theFocusable
component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.- Specified by:
setTabIndex
in interfaceComponent.Focusable
- Parameters:
tabIndex
- tab index
-
commit
public void commit()Description copied from interface:Buffered
Updates all changes since the previous commit to the data source.- Specified by:
commit
in interfaceBuffered
- Overrides:
commit
in classAbstractValueComponent<JmixColorPickerWrapper,
com.vaadin.shared.ui.colorpicker.Color, String>
-
discard
public void discard()Description copied from interface:Buffered
Discards all changes since last commit. The object updates its value from the data source.- Specified by:
discard
in interfaceBuffered
- Overrides:
discard
in classAbstractValueComponent<JmixColorPickerWrapper,
com.vaadin.shared.ui.colorpicker.Color, String>
-
isBuffered
public boolean isBuffered()- Specified by:
isBuffered
in interfaceBuffered
- Overrides:
isBuffered
in classAbstractValueComponent<JmixColorPickerWrapper,
com.vaadin.shared.ui.colorpicker.Color, String> - Returns:
true
if buffered mode is on,false
otherwise
-
setBuffered
public void setBuffered(boolean buffered) Description copied from interface:Buffered
Sets the buffered mode.When in buffered mode, an internal buffer will be used to store changes until
Buffered.commit()
is called. CallingBuffered.discard()
will revert the internal buffer to the value of the data source.When in non-buffered mode both read and write operations will be done directly on the data source. In this mode the
Buffered.commit()
andBuffered.discard()
methods serve no purpose.- Specified by:
setBuffered
in interfaceBuffered
- Overrides:
setBuffered
in classAbstractValueComponent<JmixColorPickerWrapper,
com.vaadin.shared.ui.colorpicker.Color, String> - Parameters:
buffered
-true
if buffered mode should be turned on,false
otherwise
-
isModified
public boolean isModified()Description copied from interface:Buffered
Tests if the value stored in the object has been modified since it was last updated from the data source.- Specified by:
isModified
in interfaceBuffered
- Overrides:
isModified
in classAbstractValueComponent<JmixColorPickerWrapper,
com.vaadin.shared.ui.colorpicker.Color, String> - Returns:
true
if the value in the object has been modified since the last data source update,false
if not.
-