Class FTokenField
- All Implemented Interfaces:
Buffered,BufferedValidatable,Container.Editor,Container.Viewer,Property<Object>,Property.Editor,Property.ReadOnlyStatusChangeListener,Property.ReadOnlyStatusChangeNotifier,Property.ValueChangeListener,Property.ValueChangeNotifier,Property.Viewer,Field<Object>,Validatable,ClientConnector,FAbstractClientConnector,FSizeable,HasSizeable,FAbstractComponent,Focusable,HasComponents,HasFInternalValue<Object>,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.html.Div>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.html.Div>,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.html.Div>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomField<Object>,,Object>, Object> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomField<Object>,,Object>, Object> Serializable,Iterable<com.vaadin.flow.component.Component>
TokenField defaults to using Div, but virtually any layout can be used.
Can be customized in several ways by overriding certain methods. When the user select or enters a new token, the following happens:
- If the token is new (not in the container) and new tokens are not allowed
(
setNewTokensAllowed(boolean)), nothing happens - otherwise onTokenInput(Object)is called, by default it just callsaddToken(Object)which will eventually cause a call toconfigureTokenButton(Object, FButton)- finally, if the token is new, it's added to the container if
setRememberNewTokens(boolean)is on - this means previous method calls can know whether or not the token is new by examining the container.
onTokenInput(Object) and onTokenClick(Object) respectively.
In much the same way, onTokenDelete(Object) is called when the user
presses delete or backspace when the input is empty, and can be
customized.The token buttons can be styled customized by overriding
invalid @link
{@link #configureTokenButton(Object, FButton).
The content of the input (ComboBox) can be bound to a Container datasource,
and filtering can be used. Note that the TokenField can select values that
are not present in the ComboBox.
Also note that if you use setTokenCaptionPropertyId(Object) (to use
a specific property as token caption) AND allow new tokens to be input (
setNewTokensAllowed(boolean), you should probably use a custom
invalid @link
{@link NewItemHandler) ({@link
TokenField is a full-fledged field - it can be bound to a Property datasource, and supports buffering.
Note "token" and "tokenId" is often used interchangeably in the documentation
- usually the token is just a string that is the id as well. The term
Token as used in the method names is often interchangeable with the
term item seen elsewhere in the Vaadin API; e.g
setTokenCaption(Object, String) works exactly as
FComboBox.setItemCaption(Object, String), and tokenId is
the same as itemId.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.featurepack.data.Buffered
Buffered.SourceExceptionNested classes/interfaces inherited from interface com.vaadin.featurepack.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.DetachEvent, ClientConnector.DetachListenerNested classes/interfaces inherited from interface com.vaadin.featurepack.server.FAbstractClientConnector
FAbstractClientConnector.LegacyMethodEventNested classes/interfaces inherited from interface com.vaadin.featurepack.ui.FAbstractComponent
FAbstractComponent.DataKeyNested classes/interfaces inherited from interface com.vaadin.featurepack.data.ui.Field
Field.ValueChangeEventNested classes/interfaces inherited from interface com.vaadin.flow.component.Focusable
com.vaadin.flow.component.Focusable.FocusJsNested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.featurepack.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListenerNested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>Nested classes/interfaces inherited from interface com.vaadin.featurepack.data.Property
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeEvent, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LinkedHashMap<Object, FButton> Maps the tokenId (itemId) to the token buttonprotected FComboBoxThe ComboBox used for inputprotected FTokenField.InsertPositionCurrent insert positionprotected com.vaadin.flow.component.HasComponentsThe layout currently in useprotected booleanstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new TokenField.FTokenField(Layout lo, FTokenField.InsertPosition insertPosition) Create a new TokenField with the given layout, and the specified token insert position.FTokenField(com.vaadin.flow.component.HasComponents lo) Create a new TokenField with the given layout.FTokenField(String caption) Create a new TokenField with a caption.FTokenField(String caption, FTokenField.InsertPosition insertPosition) Create a new TokenField with a caption and aFTokenField.InsertPosition.FTokenField(String caption, Layout lo) Create a new TokenField with a caption and a given layout.FTokenField(String caption, Layout lo, FTokenField.InsertPosition insertPosition) Create a new TokenField with a caption, a given layout, and the specified token insert position. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a token if that token does not already exist.com.vaadin.flow.shared.RegistrationaddValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener valueChangeListener) voidclear()protected voidconfigureTokenButton(Object tokenId, FButton button) Configures the token button.voidfocus()Sets the focus to this component.Gets the Container data source currently used for the input box.Works asFComboBox.getFilteringMode().Gets the input prompt; works asHasPlaceholder.getPlaceholder().com.vaadin.flow.component.HasComponentsGets the layout currently in use.intGets the tabulator index of theFocusablecomponent.getTokenCaption(Object tokenId) Gets the caption for the given token; the caption can be based on a property, just as in a ComboBox.getTokenIcon(Object tokenId) Gets all tokenIds currently in the token container.Gets the current tokenFTokenField.InsertPosition.
The token buttons are be placed at this position, relative to the input box.Class<?> getType()Returns the type of the Property.protected com.vaadin.flow.component.ComponentCreate the content component or layout for the field.booleanChecks whether or not new tokens are allowedbooleanIf true, new tokens entered by the user are automatically added to the container.protected voidonTokenClick(Object tokenId) Called when the token button is clicked, which by default removes the token by callingremoveToken(Object).protected voidonTokenDelete(Object tokenId) Called with the last added token when the delete or backspace -key (depending on insert position) is pressed in an empty input.protected voidonTokenInput(Object tokenId) Called when the user is adding a new token via the UI; called after the newItemHandler.protected voidrememberToken(String tokenId) voidremoveToken(Object tokenId) Removes the given token.voidSets the Container data source used for the input box.voidsetFilteringMode(FilteringMode filteringMode) voidsetHeight(float height, com.vaadin.flow.component.Unit unit) Sets the height of the object.voidsetInputHeight(float height, com.vaadin.flow.component.Unit unit) voidsetInputHeight(String height) voidsetInputPrompt(String inputPrompt) Sets the input prompt; works asHasPlaceholder.setPlaceholder(String).voidvoidvoidsetInputWidth(float width, com.vaadin.flow.component.Unit unit) voidsetInputWidth(String width) protected voidsetInternalValue(Object newValue) protected voidsetLayout(com.vaadin.flow.component.HasComponents newLayout) Sets layout used for laying out the tokens and the input.voidsetNewTokensAllowed(boolean allowNewTokens) Sets whether or not tokens entered by the user that not present in the container are allowed.voidsetReadOnly(boolean readOnly) voidsetRememberNewTokens(boolean rememberNewTokens) Provided new tokens are allowed (setNewTokensAllowed(boolean)), this sets whether or not new tokens entered by the user are automatically added to the container.voidSets the size to 100% x 100%.voidClears any size settings.voidsetTabIndex(int tabIndex) Sets the tabulator index of theFocusablecomponent.voidsetTokenCaption(Object tokenId, String caption) sets the caption for the given token.voidvoidsetTokenCaptionPropertyId(Object propertyId) voidsetTokenIcon(Object tokenId, Resource icon) voidsetTokenIconPropertyId(Object propertyId) voidsetTokenInsertPosition(FTokenField.InsertPosition insertPosition) Sets the tokenFTokenField.InsertPosition.
The token buttons will be placed at this position, relative to the input box.voidsetWidth(float width, com.vaadin.flow.component.Unit unit) Sets the width of the object.Methods inherited from class com.vaadin.featurepack.ui.CustomField
attach, fireEvent, getChildren, getContent, getElement, getFInternalValue, getInternalValue, iterator, onAttach, onDetach, setFInternalValue, setFocusDelegate, setHeightUndefined, setLabelComponent, setPresentationValue, setWidthUndefined, validateMethods inherited from class com.vaadin.flow.component.AbstractCompositeField
bindValue, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, findAncestor, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, getUIOrThrow, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.featurepack.server.FAbstractClientConnector
addLegacyAttachListener, addLegacyDetachListener, addListener, addListener, detach, doConnectorOnAttach, doConnectorOnDetach, fireEvent, fireEvent, getAllChildrenIterable, getFListeners, getFlowComponent, getResource, hasListeners, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeListener, removeListener, setResourceMethods inherited from interface com.vaadin.featurepack.ui.FAbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, addStyleNames, beforeClientResponse, getCaption, getComponentError, getData, getDescription, getFErrorIndicator, getFErrorMessage, getFId, getFParent, getIcon, getIconResource, getPrimaryStyleName, getStyleName, isCaptionAsHtml, isImmediate, isResponsive, notifyParentAboutStyleChanges, removeContextClickListener, removeShortcutListener, removeStyleName, removeStyleNames, setCaption, setCaptionAsHtml, setComponentError, setData, setDescription, setDescription, setIcon, setIcon, setIconResource, setImmediate, setLocale, setPrimaryStyleName, setResponsive, setStyleName, setStyleNameMethods inherited from interface com.vaadin.featurepack.data.ui.Field
addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, commit, discard, getConvertedValue, getConverter, getFAbstractField, getPropertyDataSource, getRequiredError, getValidators, isBuffered, isEmpty, isInvalidAllowed, isInvalidCommitted, isModified, isPropertyReadOnly, isRequired, isValid, readOnlyStatusChange, removeAllValidators, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConverter, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setPropertyReadOnly, setRequired, setRequiredError, valueChangeMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focusMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidthMethods inherited from interface com.vaadin.featurepack.server.HasSizeable
getFHeight, getFWidth, getHeightUnits, getWidthUnits, setHeight, setHeightFull, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasValue
bindValue, getEmptyValue, getValue, isEmpty, setValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisibleMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
STYLE_TOKENFIELD
- See Also:
-
STYLE_TOKENTEXTFIELD
- See Also:
-
STYLE_BUTTON_EMPHAZISED
- See Also:
-
layout
protected com.vaadin.flow.component.HasComponents layoutThe layout currently in use -
insertPosition
Current insert position -
cb
The ComboBox used for input -
buttons
Maps the tokenId (itemId) to the token button -
rememberNewTokens
protected boolean rememberNewTokens
-
-
Constructor Details
-
FTokenField
Create a new TokenField with a caption and aFTokenField.InsertPosition.- Parameters:
caption- the desired captioninsertPosition- the desired insert position
-
FTokenField
Create a new TokenField with a caption.- Parameters:
caption- the desired caption
-
FTokenField
public FTokenField()Create a new TokenField. -
FTokenField
Create a new TokenField with a caption and a given layout.- Parameters:
caption- the desired captionlo- the desired layout
-
FTokenField
Create a new TokenField with a caption, a given layout, and the specified token insert position.- Parameters:
caption- the desired captionlo- the desired layoutinsertPosition- the desired token insert position
-
FTokenField
Create a new TokenField with the given layout, and the specified token insert position.- Parameters:
lo- the desired layoutinsertPosition- the desired token insert position
-
FTokenField
public FTokenField(com.vaadin.flow.component.HasComponents lo) Create a new TokenField with the given layout.- Parameters:
lo- the desired layout
-
-
Method Details
-
rememberToken
-
setInternalValue
- Overrides:
setInternalValuein classCustomField<Object>
-
onTokenInput
Called when the user is adding a new token via the UI; called after the newItemHandler. Can be used to make customize the adding process; e.g. to notify that the token was not added because it's duplicate, to ask for additional information, or to disallow addition due to some heuristics (not both A and Q).
The default is to calladdToken(Object)which will add the token if it's not a duplicate.- Parameters:
tokenId- the token id selected (or input)
-
onTokenClick
Called when the token button is clicked, which by default removes the token by callingremoveToken(Object). The behavior can be customized, e.g. present a confirmation dialog.- Parameters:
tokenId- the id of the token that was clicked
-
onTokenDelete
Called with the last added token when the delete or backspace -key (depending on insert position) is pressed in an empty input. The default is to callonTokenClick(Object)with the last added token, i.e. remove last. The behavior can be customized, e.g. present a confirmation dialog. -
addToken
Adds a token if that token does not already exist.Note that tokens are not automatically added to the token container. This means you can add tokens without adding them to the container (that might be bound to some data store), and without making them available to the user in the suggestion dropdown.
This also means that when new tokens are disallowed (setNewTokensAllowed(boolean)) you can programmatically add tokens that the user can not add him/herself.
Consider adding the token to the container before callingaddToken(Object)if you're using a custom captions based on container/item properties, or if you want the token to be available to the user as a suggestion later.- Parameters:
tokenId- the token to add
-
removeToken
Removes the given token.Note that the token is not removed from the container, so if it exists in the container, the token will still be available to the user.
- Parameters:
tokenId- the token to remove
-
configureTokenButton
Configures the token button.By default, the caption, icon, description, and style is set. Override to customize.
Note that the default click-listener is added elsewhere and can not be changed here.- Parameters:
tokenId- the token this button pertains tobutton- the button to be configured
-
getLayout
public com.vaadin.flow.component.HasComponents getLayout()Gets the layout currently in use.- Returns:
- the current layout
-
setLayout
protected void setLayout(com.vaadin.flow.component.HasComponents newLayout) Sets layout used for laying out the tokens and the input.- Parameters:
newLayout- the layout to use
-
getTokenInsertPosition
Gets the current tokenFTokenField.InsertPosition.
The token buttons are be placed at this position, relative to the input box.- Returns:
- the current token insert position
- See Also:
-
setTokenInsertPosition
Sets the tokenFTokenField.InsertPosition.
The token buttons will be placed at this position, relative to the input box.- See Also:
-
addValueChangeListener
public com.vaadin.flow.shared.Registration addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener valueChangeListener) - Specified by:
addValueChangeListenerin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomField<Object>,Object>, Object> - Overrides:
addValueChangeListenerin classcom.vaadin.flow.component.AbstractCompositeField<com.vaadin.flow.component.Component,CustomField<Object>, Object>
-
getOptionalValue
- Specified by:
getOptionalValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomField<Object>,Object>, Object>
-
clear
public void clear()- Specified by:
clearin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomField<Object>,Object>, Object>
-
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomField<Object>,Object>, Object> - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CustomField<Object>,Object>, Object>
-
setContainerDataSource
Sets the Container data source used for the input box. This works exactly asSelect.setContainerDataSource(Container).- Specified by:
setContainerDataSourcein interfaceContainer.Viewer- Parameters:
c- the token container data source- See Also:
-
getContainerDataSource
Gets the Container data source currently used for the input box. This works exactly asSelect.getContainerDataSource().- Specified by:
getContainerDataSourcein interfaceContainer.Viewer- Returns:
- the container used to tokens
- See Also:
-
setNewTokensAllowed
public void setNewTokensAllowed(boolean allowNewTokens) Sets whether or not tokens entered by the user that not present in the container are allowed. When true, the token is added, and ifsetRememberNewTokens(boolean)is true, the new token will be added to the container as well.- Parameters:
allowNewTokens- true to allow tokens that are not in the container- See Also:
-
isNewTokensAllowed
public boolean isNewTokensAllowed()Checks whether or not new tokens are allowed- Returns:
- See Also:
-
isRememberNewTokens
public boolean isRememberNewTokens()If true, new tokens entered by the user are automatically added to the container.- Returns:
- true if tokens are automatically added
-
setRememberNewTokens
public void setRememberNewTokens(boolean rememberNewTokens) Provided new tokens are allowed (setNewTokensAllowed(boolean)), this sets whether or not new tokens entered by the user are automatically added to the container.- Parameters:
rememberNewTokens- true to add new tokens automatically
-
getFilteringMode
Works asFComboBox.getFilteringMode().- See Also:
-
focus
public void focus()Description copied from interface:FocusableSets the focus to this component.- Specified by:
focusin interfaceFocusable- Specified by:
focusin interfacecom.vaadin.flow.component.Focusable<com.vaadin.flow.component.html.Div>- Overrides:
focusin classCustomField<Object>
-
getInputPrompt
Gets the input prompt; works asHasPlaceholder.getPlaceholder().- Returns:
- the current input prompt
- See Also:
-
getTokenCaption
Gets the caption for the given token; the caption can be based on a property, just as in a ComboBox. Note that the string representation of the tokenId itself is always used if the container does not contain the id.- Parameters:
tokenId- the id of the token- Returns:
- the caption
-
getTokenCaptionMode
- Returns:
- the current caption mode
- See Also:
-
getTokenCaptionPropertyId
- Returns:
- the current caption property id
- See Also:
-
getTokenIcon
- Returns:
- the icon for the given resource
- See Also:
-
getTokenIconPropertyId
- Returns:
- the current item icon property id
- See Also:
-
getTokenIds
Gets all tokenIds currently in the token container.- Returns:
- a collection of all tokenIds in the container
-
getTabIndex
public int getTabIndex()Description copied from interface:FocusableGets the tabulator index of theFocusablecomponent.- Specified by:
getTabIndexin interfaceFocusable- Specified by:
getTabIndexin interfacecom.vaadin.flow.component.Focusable<com.vaadin.flow.component.html.Div>- Overrides:
getTabIndexin classCustomField<Object>- Returns:
- tab index set for the
Focusablecomponent - See Also:
-
setHeight
public void setHeight(float height, com.vaadin.flow.component.Unit unit) Description copied from interface:FSizeableSets the height of the object. Negative number implies unspecified size (terminal is free to set the size).- Specified by:
setHeightin interfaceFSizeable- Specified by:
setHeightin interfacecom.vaadin.flow.component.HasSize- Specified by:
setHeightin interfaceHasSizeable- Overrides:
setHeightin classCustomField<Object>- Parameters:
height- the height of the object.unit- the unit used for the width.
-
setWidth
public void setWidth(float width, com.vaadin.flow.component.Unit unit) Description copied from interface:FSizeableSets the width of the object. Negative number implies unspecified size (terminal is free to set the size).- Specified by:
setWidthin interfaceFSizeable- Specified by:
setWidthin interfacecom.vaadin.flow.component.HasSize- Specified by:
setWidthin interfaceHasSizeable- Overrides:
setWidthin classCustomField<Object>- Parameters:
width- the width of the object.unit- the unit used for the width.
-
setSizeFull
public void setSizeFull()Description copied from interface:FSizeableSets the size to 100% x 100%.- Specified by:
setSizeFullin interfaceFSizeable- Specified by:
setSizeFullin interfacecom.vaadin.flow.component.HasSize- Specified by:
setSizeFullin interfaceHasSizeable- Overrides:
setSizeFullin classCustomField<Object>
-
setSizeUndefined
public void setSizeUndefined()Description copied from interface:FSizeableClears any size settings.- Specified by:
setSizeUndefinedin interfaceFSizeable- Specified by:
setSizeUndefinedin interfacecom.vaadin.flow.component.HasSize- Specified by:
setSizeUndefinedin interfaceHasSizeable- Overrides:
setSizeUndefinedin classCustomField<Object>
-
setInputHeight
-
setInputWidth
-
setInputHeight
public void setInputHeight(float height, com.vaadin.flow.component.Unit unit) -
setInputWidth
public void setInputWidth(float width, com.vaadin.flow.component.Unit unit) -
setInputSizeFull
public void setInputSizeFull() -
setInputSizeUndefined
public void setInputSizeUndefined() -
setInputPrompt
Sets the input prompt; works asHasPlaceholder.setPlaceholder(String).- See Also:
-
setTokenCaption
sets the caption for the given token.- Parameters:
tokenId- token whose caption to setcaption- the desired caption- See Also:
-
setTokenCaptionMode
- Parameters:
mode-- See Also:
-
setTokenCaptionPropertyId
- Parameters:
propertyId-- See Also:
-
setTokenIcon
- Parameters:
tokenId-icon-- See Also:
-
setTokenIconPropertyId
- Parameters:
propertyId-- See Also:
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:FocusableSets the tabulator index of theFocusablecomponent. 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.After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar.
If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page.
A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.
- Specified by:
setTabIndexin interfaceFocusable- Specified by:
setTabIndexin interfacecom.vaadin.flow.component.Focusable<com.vaadin.flow.component.html.Div>- Overrides:
setTabIndexin classCustomField<Object>- Parameters:
tabIndex- the tab order of this component. Indexes usually start from 1. Zero means that default tab order should be used. A negative value means that the field should not be included in the tabbing sequence.- See Also:
-
getType
Description copied from interface:PropertyReturns the type of the Property. The methodsgetValueandsetValuemust be compatible with this type: one must be able to safely cast the value returned fromgetValueto the given type and pass any variable assignable to this type as an argument tosetValue. -
initContent
protected com.vaadin.flow.component.Component initContent()Description copied from class:CustomFieldCreate the content component or layout for the field. Subclasses ofCustomFieldshould implement this method.Note that this method is called when the CustomField is attached to a layout or when
CustomField.getContent()is called explicitly for the first time. It is only called once for aCustomField.- Specified by:
initContentin classCustomField<Object>- Returns:
Componentrepresenting the UI of the CustomField
-