Package io.jmix.ui.component.impl
Class AbstractField<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>,P,V>
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<T,P,V>
- Type Parameters:
T
- type of underlying Vaadin componentP
- type of presentation valueV
- type of model value
- All Implemented Interfaces:
AttachNotifier
,Component
,Component.BelongToFrame
,Component.Editable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasValueSource<V>
,Field<V>
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasValidator<V>
,HasValue<V>
,Requirable
,Validatable
- Direct Known Subclasses:
AbstractSelectList
,AbstractSingleFileUploadField
,AbstractSuggestionField
,AbstractTextArea
,CheckBoxGroupImpl
,CheckBoxImpl
,ColorPickerImpl
,ComboBoxImpl
,CurrencyFieldImpl
,DatePickerImpl
,EntityLinkFieldImpl
,MaskedFieldImpl
,PasswordFieldImpl
,RadioButtonGroupImpl
,RichTextAreaImpl
,SliderImpl
,SourceCodeEditorImpl
,TextFieldImpl
,TimeFieldImpl
,TwinColumnImpl
,ValuePickerImpl
public abstract class AbstractField<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>,P,V>
extends AbstractValueComponent<T,P,V>
implements Field<V>
Base class for Vaadin 8 based input components.
-
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
Modifier and TypeFieldDescriptionprotected boolean
protected Subscription
protected static final int
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.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addValidator
(Validator<? super V> validator) Adds a validator instance to the component.protected void
attachValueChangeListener
(T component) protected String
getDatatypeConversionErrorMsg
(Datatype<V> datatype) protected String
protected com.vaadin.server.ErrorMessage
boolean
boolean
boolean
isValid()
void
removeValidator
(Validator<V> validator) Removes a validator instance from the component.void
setEditable
(boolean editable) protected void
setEditableToComponent
(boolean editable) void
INTERNAL.
ComponentContainer.add(Component)
is normally used for adding components to a parent and the used method will call this method implicitly.void
setRequired
(boolean required) Sets whether the component must contain a non-null value.void
setRequiredMessage
(String msg) Sets a message that will be displayed to user if the field is required but has null value.protected void
setupComponentErrorProvider
(boolean required, T component) protected void
triggerValidators
(V value) void
validate()
Methods inherited from class io.jmix.ui.component.impl.AbstractValueComponent
addValueChangeListener, commit, componentValueChanged, convertToModel, convertToPresentation, discard, fieldValueEquals, getValue, getValueSource, isBuffered, isModified, setBuffered, 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, 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
isEditableWithParent
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
addValidators
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.Validatable
isValidateOnCommit
-
Field Details
-
VALIDATORS_LIST_INITIAL_CAPACITY
protected static final int VALIDATORS_LIST_INITIAL_CAPACITY- See Also:
-
validators
-
editable
protected boolean editable -
parentEditableChangeListener
-
-
Constructor Details
-
AbstractField
public AbstractField()
-
-
Method Details
-
isRequired
public boolean isRequired()- Specified by:
isRequired
in interfaceRequirable
- Returns:
- whether the component must contain a non-null value
-
setRequired
public void setRequired(boolean required) Description copied from interface:Requirable
Sets whether the component must contain a non-null value.- Specified by:
setRequired
in interfaceRequirable
- Parameters:
required
- required
-
setupComponentErrorProvider
-
getErrorMessage
@Nullable protected com.vaadin.server.ErrorMessage getErrorMessage() -
setRequiredMessage
Description copied from interface:Requirable
Sets a message that will be displayed to user if the field is required but has null value.- Specified by:
setRequiredMessage
in interfaceRequirable
- Parameters:
msg
- message
-
getRequiredMessage
- Specified by:
getRequiredMessage
in interfaceRequirable
- Returns:
- a message that will be displayed to user if the component is required but has null value
-
setParent
Description copied from interface:Component
INTERNAL.
ComponentContainer.add(Component)
is normally used for adding components to a parent and the used method will call this method implicitly. -
isEditable
public boolean isEditable()- Specified by:
isEditable
in interfaceComponent.Editable
-
setEditable
public void setEditable(boolean editable) - Specified by:
setEditable
in interfaceComponent.Editable
-
setEditableToComponent
protected void setEditableToComponent(boolean editable) -
attachValueChangeListener
-
addValidator
Description copied from interface:HasValidator
Adds a validator instance to the component. TheValidationException
must be thrown by the validator if the value is not valid.- Specified by:
addValidator
in interfaceHasValidator<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>>
- Parameters:
validator
- a validator to add- See Also:
-
removeValidator
Description copied from interface:HasValidator
Removes a validator instance from the component.- Specified by:
removeValidator
in interfaceHasValidator<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>>
- Parameters:
validator
- a validator to remove
-
getValidators
- Specified by:
getValidators
in interfaceHasValidator<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>>
- Returns:
- unmodifiable collection of component validators.
-
isValid
public boolean isValid()- Specified by:
isValid
in interfaceValidatable
-
validate
- Specified by:
validate
in interfaceValidatable
- Throws:
ValidationException
-
getDefaultRequiredMessage
-
triggerValidators
- Throws:
ValidationFailedException
-
getDatatypeConversionErrorMsg
-