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.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.HasValue
HasValue.ValueChangeEvent<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Subscriptionprotected static final intFields inherited from class io.jmix.ui.component.impl.AbstractValueComponent
internalValue, uiTestIdsSupport, valueBindingFields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValidator(Validator<? super V> validator) Adds a validator instance to the component.protected voidattachValueChangeListener(T component) protected StringgetDatatypeConversionErrorMsg(Datatype<V> datatype) protected Stringprotected com.vaadin.server.ErrorMessagebooleanbooleanbooleanisValid()voidremoveValidator(Validator<V> validator) Removes a validator instance from the component.voidsetEditable(boolean editable) protected voidsetEditableToComponent(boolean editable) voidINTERNAL.
ComponentContainer.add(Component)is normally used for adding components to a parent and the used method will call this method implicitly.voidsetRequired(boolean required) Sets whether the component must contain a non-null value.voidsetRequiredMessage(String msg) Sets a message that will be displayed to user if the field is required but has null value.protected voidsetupComponentErrorProvider(boolean required, T component) protected voidtriggerValidators(V value) voidvalidate()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, valueBindingConnectedMethods 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, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Editable
isEditableWithParentMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledMethods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabledMethods inherited from interface io.jmix.ui.component.HasValidator
addValidatorsMethods inherited from interface io.jmix.ui.component.HasValue
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValueMethods inherited from interface io.jmix.ui.component.data.HasValueSource
getValueSource, setValueSourceMethods 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:
isRequiredin interfaceRequirable- Returns:
- whether the component must contain a non-null value
-
setRequired
public void setRequired(boolean required) Description copied from interface:RequirableSets whether the component must contain a non-null value.- Specified by:
setRequiredin interfaceRequirable- Parameters:
required- required
-
setupComponentErrorProvider
-
getErrorMessage
@Nullable protected com.vaadin.server.ErrorMessage getErrorMessage() -
setRequiredMessage
Description copied from interface:RequirableSets a message that will be displayed to user if the field is required but has null value.- Specified by:
setRequiredMessagein interfaceRequirable- Parameters:
msg- message
-
getRequiredMessage
- Specified by:
getRequiredMessagein interfaceRequirable- Returns:
- a message that will be displayed to user if the component is required but has null value
-
setParent
Description copied from interface:ComponentINTERNAL.
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:
isEditablein interfaceComponent.Editable
-
setEditable
public void setEditable(boolean editable) - Specified by:
setEditablein interfaceComponent.Editable
-
setEditableToComponent
protected void setEditableToComponent(boolean editable) -
attachValueChangeListener
-
addValidator
Description copied from interface:HasValidatorAdds a validator instance to the component. TheValidationExceptionmust be thrown by the validator if the value is not valid.- Specified by:
addValidatorin 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:HasValidatorRemoves a validator instance from the component.- Specified by:
removeValidatorin interfaceHasValidator<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>>- Parameters:
validator- a validator to remove
-
getValidators
- Specified by:
getValidatorsin interfaceHasValidator<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>>- Returns:
- unmodifiable collection of component validators.
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceValidatable
-
validate
- Specified by:
validatein interfaceValidatable- Throws:
ValidationException
-
getDefaultRequiredMessage
-
triggerValidators
- Throws:
ValidationFailedException
-
getDatatypeConversionErrorMsg
-