public class AutoSuggestFormElementConfiguration extends ElementConfigurationMap<AutoSuggestFormElementConfiguration>
AutoSuggestFormElementBuilder based on
typeahead.js.
Optimized to represent the different Typeahead configuration options,
may hold multiple datasets where a dataset representation is optimized for a Bloodhound datasource.| Modifier and Type | Class and Description |
|---|---|
static class |
AutoSuggestFormElementConfiguration.DataSet
Represents a single dataset.
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
static String |
ATTR_DATASETS
Attribute that holds the collection of dataset definitions.
|
static String |
DEFAULT_DATASET
Name of the default data set.
|
static String |
DEFAULT_ENDPOINT |
| Constructor and Description |
|---|
AutoSuggestFormElementConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
AutoSuggestFormElementConfiguration |
addDataSet(@NonNull AutoSuggestFormElementConfiguration.DataSet dataSet)
Add a dataset to the collection, if there is another dataset with that name already, it will be removed first.
|
static AutoSuggestFormElementConfiguration.DataSet |
createDataSet() |
String |
getEndpoint() |
AutoSuggestFormElementConfiguration |
highlight(boolean highlight)
Highlight the matching input text in the suggestions.
|
AutoSuggestFormElementConfiguration |
minLength(int minLength)
Minimum length the input value should have before fetching suggestiong.
|
AutoSuggestFormElementConfiguration |
removeDataSet(String dataSetName)
Remove the dataset with the given name if it is present.
|
void |
setEndpoint(@NonNull String endpoint)
Sets the remote url endpoint where to fetch suggestions.
|
AutoSuggestFormElementConfiguration |
showHint(boolean showHint)
Should the textbox show a hint for auto-completion.
|
AutoSuggestFormElementConfiguration |
translate(Function<String,String> linkBuilder)
Create a new instance of this configuration, where the links have been translated by the specified builder.
|
static AutoSuggestFormElementConfiguration |
withDataSet(Consumer<AutoSuggestFormElementConfiguration.DataSet> consumer)
Create a new configuration with a default dataset.
|
AutoSuggestFormElementConfiguration |
withDataSet(String dataSetName,
Consumer<AutoSuggestFormElementConfiguration.DataSet> consumer)
Configure the dataset with the given name, if it is not yet present, it will be added first.
|
setAttributeclear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic static final String ATTR_DATASETS
public static final String DEFAULT_DATASET
public static final String DEFAULT_ENDPOINT
public void setEndpoint(@NonNull
@NonNull String endpoint)
DEFAULT_ENDPOINT.
The parameter {value} will be replaced with the actual input text.endpoint - urlpublic String getEndpoint()
public AutoSuggestFormElementConfiguration showHint(boolean showHint)
showHint - to showpublic AutoSuggestFormElementConfiguration highlight(boolean highlight)
highlight - matchpublic AutoSuggestFormElementConfiguration minLength(int minLength)
minLength - input should havepublic AutoSuggestFormElementConfiguration withDataSet(String dataSetName, Consumer<AutoSuggestFormElementConfiguration.DataSet> consumer)
dataSetName - name of the datasetconsumer - to configure the datasetpublic AutoSuggestFormElementConfiguration removeDataSet(String dataSetName)
dataSetName - name of the dataset to removepublic AutoSuggestFormElementConfiguration addDataSet(@NonNull @NonNull AutoSuggestFormElementConfiguration.DataSet dataSet)
dataSet - to add to the collectionpublic AutoSuggestFormElementConfiguration translate(Function<String,String> linkBuilder)
linkBuilder - to usepublic static AutoSuggestFormElementConfiguration withDataSet(Consumer<AutoSuggestFormElementConfiguration.DataSet> consumer)
consumer - to customize the datasetpublic static AutoSuggestFormElementConfiguration.DataSet createDataSet()
Copyright © 2020. All rights reserved.