T
- type of underlying Vaadin componentP
- type of presentation valueV
- type of model valuepublic abstract class AbstractField<T extends com.vaadin.ui.Component & com.vaadin.data.HasValue<P>,P,V> extends AbstractValueComponent<T,P,V> implements Field<V>
HasValue.ValueChangeEvent<V>
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
HasContextHelp.ContextHelpIconClickEvent
Modifier and Type | Field and Description |
---|---|
protected boolean |
editable |
protected io.jmix.core.common.event.Subscription |
parentEditableChangeListener |
protected java.util.List<Validator<V>> |
validators |
protected static int |
VALIDATORS_LIST_INITIAL_CAPACITY |
internalValue, uiTestIdsSupport, valueBinding
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
AbstractField() |
Modifier and Type | Method and Description |
---|---|
void |
addValidator(Validator<? super V> validator)
Adds a validator instance to the component.
|
protected void |
attachValueChangeListener(T component) |
protected java.lang.String |
getDatatypeConversionErrorMsg(io.jmix.core.metamodel.datatype.Datatype<V> datatype) |
protected com.vaadin.server.ErrorMessage |
getErrorMessage() |
java.lang.String |
getRequiredMessage() |
java.util.Collection<Validator<V>> |
getValidators() |
boolean |
isEditable() |
boolean |
isRequired() |
boolean |
isValid() |
void |
removeValidator(Validator<V> validator)
Removes a validator instance from the component.
|
void |
setEditable(boolean editable) |
protected void |
setEditableToComponent(boolean editable) |
void |
setParent(Component parent)
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(java.lang.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() |
addValueChangeListener, commit, componentValueChanged, convertToModel, convertToPresentation, discard, fieldValueEquals, getValue, getValueSource, isBuffered, isModified, setBuffered, setUiTestId, setUiTestIdsSupport, setValue, setValueSource, setValueToPresentation, valueBindingActivated, valueBindingConnected
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValueSource, setValueSource
addValueChangeListener, clear, getEmptyValue, getValue, isEmpty, setValue
isEditableWithParent
getFrame, setFrame
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
isValidateOnCommit
getIcon, setIcon, setIconFromSet
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
isCaptionAsHtml, setCaptionAsHtml
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
addValidators
protected static final int VALIDATORS_LIST_INITIAL_CAPACITY
protected boolean editable
protected io.jmix.core.common.event.Subscription parentEditableChangeListener
public boolean isRequired()
isRequired
in interface Requirable
public void setRequired(boolean required)
Requirable
setRequired
in interface Requirable
required
- requiredprotected void setupComponentErrorProvider(boolean required, T component)
@Nullable protected com.vaadin.server.ErrorMessage getErrorMessage()
public void setRequiredMessage(@Nullable java.lang.String msg)
Requirable
setRequiredMessage
in interface Requirable
msg
- message@Nullable public java.lang.String getRequiredMessage()
getRequiredMessage
in interface Requirable
public void setParent(@Nullable Component parent)
Component
ComponentContainer.add(Component)
is normally used for adding components
to a parent and the used method will call this method implicitly.public boolean isEditable()
isEditable
in interface Component.Editable
public void setEditable(boolean editable)
setEditable
in interface Component.Editable
protected void setEditableToComponent(boolean editable)
protected void attachValueChangeListener(T component)
public void addValidator(Validator<? super V> validator)
HasValidator
ValidationException
must be thrown by the validator
if the value is not valid.addValidator
in interface HasValidator<V>
validator
- a validator to addValidationException
public void removeValidator(Validator<V> validator)
HasValidator
removeValidator
in interface HasValidator<V>
validator
- a validator to removepublic java.util.Collection<Validator<V>> getValidators()
getValidators
in interface HasValidator<V>
public boolean isValid()
isValid
in interface Validatable
public void validate() throws ValidationException
validate
in interface Validatable
ValidationException
protected void triggerValidators(@Nullable V value) throws ValidationFailedException
ValidationFailedException
@Nullable protected java.lang.String getDatatypeConversionErrorMsg(@Nullable io.jmix.core.metamodel.datatype.Datatype<V> datatype)