T - field value type@Tag(value="vaadin-custom-field") @HtmlImport(value="frontend://bower_components/vaadin-custom-field/src/vaadin-custom-field.html") public abstract class CustomField<T> extends com.vaadin.flow.component.AbstractField<CustomField<T>,T> implements com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.Focusable<CustomField>
HasValue whose UI content can be constructed by the user, enabling
the creation of e.g. form fields by composing Vaadin components.
Customization of both the visual presentation and the logic of the field is
possible.
Subclasses must implement generateModelValue() and AbstractFieldsetPresentationValue(Object).
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>| Constructor and Description |
|---|
CustomField()
Default constructor.
|
CustomField(T defaultValue)
Constructs a new custom field.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
generateModelValue()
This method should return the value of the field, based on value of the internal fields.
|
String |
getErrorMessage() |
String |
getLabel()
Gets the label for the field.
|
boolean |
isInvalid()
This property is set to true when the control value is invalid.
|
void |
setErrorMessage(String errorMessage) |
void |
setInvalid(boolean invalid)
This property is set to true when the control value is invalid.
|
void |
setLabel(String label)
Sets the label for the field.
|
protected abstract void |
setPresentationValue(T newPresentationValue)
This method should be implemented to set the value of the fields contained
in this custom field according to the value of the parameter.
|
protected void |
updateValue()
Regenerates the value and updates the model.
|
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, add, addComponentAsFirst, addComponentAtIndex, remove, removeAllgetHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFulladdFocusShortcut, blur, focus, getTabIndex, setTabIndexpublic CustomField()
public CustomField(T defaultValue)
defaultValue - The initial value for the field. Will also be used by AbstractField.getEmptyValue().AbstractField.AbstractField(Object)protected abstract T generateModelValue()
protected abstract void setPresentationValue(T newPresentationValue)
setPresentationValue in class com.vaadin.flow.component.AbstractField<CustomField<T>,T>newPresentationValue - The new presentation value.protected void updateValue()
@Synchronize(property="invalid",
value="invalid-changed")
public boolean isInvalid()
This property is set to true when the control value is invalid.
This property is synchronized automatically from client side when a 'invalid-changed' event happens.
isInvalid in interface com.vaadin.flow.component.HasValidationinvalid property from the webcomponentpublic void setInvalid(boolean invalid)
This property is set to true when the control value is invalid.
setInvalid in interface com.vaadin.flow.component.HasValidationinvalid - the boolean value to setpublic void setErrorMessage(String errorMessage)
setErrorMessage in interface com.vaadin.flow.component.HasValidationpublic String getErrorMessage()
getErrorMessage in interface com.vaadin.flow.component.HasValidationpublic String getLabel()
label property from the webcomponentpublic void setLabel(String label)
label - value for the label property in the webcomponentCopyright © 2018–2019 Vaadin Ltd. All rights reserved.