public class AutocompleteTextField
extends com.vaadin.ui.TextField
TextField
with autocomplete (aka word completion) functionality.
Uses a modified version of autoComplete originally developed by Simon Steinberger
autoComplete
is released under the MIT License.
com.vaadin.ui.AbstractTextField.TextChangeEventImpl, com.vaadin.ui.AbstractTextField.TextChangeEventMode
com.vaadin.ui.AbstractField.FocusShortcut, com.vaadin.ui.AbstractField.ReadOnlyStatusChangeEvent
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
com.vaadin.server.Sizeable.Unit
com.vaadin.ui.Field.ValueChangeEvent
com.vaadin.data.Buffered.SourceException
com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyException, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.Transactional<T>, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer
Constructor and Description |
---|
AutocompleteTextField()
Constructs an empty
AutocompleteTextField with no caption and
autocomplete (aka word completion) functionality. |
AutocompleteTextField(com.vaadin.data.Property<?> dataSource)
Constructs a new
AutocompleteTextField that's bound to the
specified Property , has no caption and autocomplete (aka word
completion) functionality. |
AutocompleteTextField(String caption)
Constructs an empty
AutocompleteTextField with given caption and
autocomplete (aka word completion) functionality. |
AutocompleteTextField(String caption,
com.vaadin.data.Property<?> dataSource)
Constructs a new
AutocompleteTextField that's bound to the
specified Property , has the given caption String and
autocomplete (aka word completion) functionality. |
AutocompleteTextField(String caption,
String value)
Constructs a new
AutocompleteTextField with the given caption,
initial text contents and autocomplete (aka word completion)
functionality. |
Modifier and Type | Method and Description |
---|---|
void |
addMenuStyleName(String styleName)
Adds one or more style names to the dropdown menu container.
|
int |
getDelay()
Gets the delay in milliseconds between when a keystroke occurs and when a
search is performed.
|
AutocompleteTextFieldExtension |
getExtension()
Gets the
AutocompleteTextFieldExtension of this
TextField . |
String |
getMenuStyleName()
Gets all user-defined CSS style names of the dropdown menu container.
|
int |
getMinChars()
Gets the minimum number of characters (>=1) a user must type before a
search is performed.
|
ScrollBehavior |
getScrollBehavior()
Gets the
ScrollBehavior that is used when the user scrolls the
page while the suggestion box is open. |
int |
getSuggestionLimit()
Gets the maximum number of suggestions that are allowed.
|
AutocompleteSuggestionProvider |
getSuggestionProvider()
Gets the active
AutocompleteSuggestionProvider . |
boolean |
isCache()
Checks if performed searches should be cached.
|
boolean |
isItemAsHtml()
Checks whether items are rendered as HTML.
|
void |
removeMenuStyleName(String styleName)
Removes one or more style names from the dropdown menu container.
|
void |
setCache(boolean cache)
Sets if performed searches should be cached.
|
void |
setDelay(int delay)
Sets the delay in milliseconds between when a keystroke occurs and when a
search is performed.
|
void |
setItemAsHtml(boolean itemAsHtml)
Sets whether the items are rendered as HTML.
|
void |
setMinChars(int minChars)
Sets the minimum number of characters (>=1) a user must type before a
search is performed.
|
void |
setScrollBehavior(ScrollBehavior scrollBehavior)
Sets the
ScrollBehavior that is used when the user scrolls the
page while the suggestion box is open. |
void |
setSuggestionLimit(int suggestionLimit)
Sets the maximum number of suggestions that are allowed.
|
void |
setSuggestionProvider(AutocompleteSuggestionProvider suggestionProvider)
Sets the active
AutocompleteSuggestionProvider . |
addBlurListener, addFocusListener, addListener, addListener, addListener, addTextChangeListener, beforeClientResponse, changeVariables, getColumns, getCursorPosition, getCustomAttributes, getInputPrompt, getMaxLength, getNullRepresentation, getState, getState, getTextChangeEventMode, getTextChangeTimeout, getType, isEmpty, isNullSettingAllowed, paintContent, removeBlurListener, removeFocusListener, removeListener, removeListener, removeListener, removeTextChangeListener, selectAll, setColumns, setCursorPosition, setInputPrompt, setInternalValue, setMaxLength, setNullRepresentation, setNullSettingAllowed, setSelectionRange, setTextChangeEventMode, setTextChangeTimeout, setValue
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, attach, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, getValue, isBuffered, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, shouldHideErrors, toString, validate, validate, valueChange
addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isVisible, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthUndefined
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
public AutocompleteTextField()
AutocompleteTextField
with no caption and
autocomplete (aka word completion) functionality.public AutocompleteTextField(String caption)
AutocompleteTextField
with given caption and
autocomplete (aka word completion) functionality.caption
- The caption String
for the editor.public AutocompleteTextField(com.vaadin.data.Property<?> dataSource)
AutocompleteTextField
that's bound to the
specified Property
, has no caption and autocomplete (aka word
completion) functionality.dataSource
- The Property
to be edited with this editor.public AutocompleteTextField(String caption, com.vaadin.data.Property<?> dataSource)
AutocompleteTextField
that's bound to the
specified Property
, has the given caption String
and
autocomplete (aka word completion) functionality.caption
- The caption String
for the editor.dataSource
- The Property
to be edited with this editor.public AutocompleteTextField(String caption, String value)
AutocompleteTextField
with the given caption,
initial text contents and autocomplete (aka word completion)
functionality. The editor constructed this way will not be bound to a
Property
unless
Property.Viewer.setPropertyDataSource(Property)
is called to bind it.caption
- The caption String
for the editor.value
- The initial text content of the editor.public AutocompleteTextFieldExtension getExtension()
AutocompleteTextFieldExtension
of this
TextField
.AutocompleteTextFieldExtension
of this
TextField
.public AutocompleteSuggestionProvider getSuggestionProvider()
AutocompleteSuggestionProvider
.AutocompleteSuggestionProvider
.public void setSuggestionProvider(AutocompleteSuggestionProvider suggestionProvider)
AutocompleteSuggestionProvider
.suggestionProvider
- The active
AutocompleteSuggestionProvider
.public int getSuggestionLimit()
If the active AutocompleteSuggestionProvider
returns more
suggestions than allowed, the excess suggestions will be ignored!
If limit <= 0
the suggestions won't be limited.
public void setSuggestionLimit(int suggestionLimit)
If the active AutocompleteSuggestionProvider
returns more
suggestions than allowed, the excess suggestions will be ignored!
If limit <= 0 the suggestions won't be limited.
suggestionLimit
- Maximum number of suggestions.public boolean isItemAsHtml()
The default is false, i.e. to render that caption as plain text.
public void setItemAsHtml(boolean itemAsHtml)
If set to true, the items are rendered in the browser as HTML and the developer is responsible for ensuring no harmful HTML is used. If set to false, the caption is rendered in the browser as plain text.
The default is false, i.e. to render that caption as plain text.
itemAsHtml
- true if the items are rendered as HTML, false if
rendered as plain text.public int getMinChars()
public void setMinChars(int minChars)
minChars
- Minimum number of characters.public int getDelay()
public void setDelay(int delay)
delay
- Search delay in milliseconds.public boolean isCache()
public void setCache(boolean cache)
cache
- Cache performed searches.public String getMenuStyleName()
public void addMenuStyleName(String styleName)
styleName
- The new style to be added to the dropdown menu
container.public void removeMenuStyleName(String styleName)
styleName
- The style name or style names to be removed.public ScrollBehavior getScrollBehavior()
ScrollBehavior
that is used when the user scrolls the
page while the suggestion box is open.ScrollBehavior
.public void setScrollBehavior(ScrollBehavior scrollBehavior)
ScrollBehavior
that is used when the user scrolls the
page while the suggestion box is open.scrollBehavior
- The ScrollBehavior
.Copyright © 2016 Max Schuster. All Rights Reserved.