T - The type of the SuggestBox valuepublic class LocalSuggestBoxStore<T> extends Object implements SuggestBoxStore<T>
SuggestBoxStore that provides Suggestion from a local ListSuggestBoxStore.MissingEntryProvider<T>, SuggestBoxStore.MissingSuggestProvider<T>, SuggestBoxStore.SuggestionFilter<T>, SuggestBoxStore.SuggestionsHandler<T>| Constructor and Description |
|---|
LocalSuggestBoxStore()
Creates a store initialized with an empty List
|
LocalSuggestBoxStore(List<SuggestItem<T>> suggestions)
Creates a store initialized with a List of Suggestions
|
| Modifier and Type | Method and Description |
|---|---|
LocalSuggestBoxStore<T> |
addSuggestion(SuggestItem<T> suggestion)
Adds a suggestion the suggestions List
|
LocalSuggestBoxStore<T> |
addSuggestions(List<SuggestItem<T>> suggestions)
Adds a List of suggestions to the store suggestions
|
static <T> LocalSuggestBoxStore<T> |
create()
Creates a store initialized with an empty List
|
static <T> LocalSuggestBoxStore<T> |
create(List<SuggestItem<T>> suggestions)
Creates a store initialized with a List of suggestions
|
void |
filter(String searchValue,
SuggestBoxStore.SuggestionsHandler<T> suggestionsHandler)
Takes the current typed text in the SuggestBox and provide a List of matching suggestion
|
boolean |
filterItem(String searchValue,
SuggestItem<T> suggestItem)
Defines how to check a single SuggestItem against the search text, default to SuggestItem
lowercase display text contains the search text
|
void |
find(T searchValue,
Consumer<SuggestItem<T>> handler)
Takes a value of T and find the matching SuggestItem for this value, this is used when we
directly set the value to the SuggestBox to check if it is actually still matching an existing
suggestion
|
SuggestBoxStore.MissingEntryProvider<T> |
getMessingEntryProvider() |
SuggestBoxStore.MissingSuggestProvider<T> |
getMessingSuggestionProvider() |
SuggestBoxStore.SuggestionFilter<T> |
getSuggestionFilter() |
List<SuggestItem<T>> |
getSuggestions() |
LocalSuggestBoxStore<T> |
setMissingEntryProvider(SuggestBoxStore.MissingEntryProvider<T> missingEntryProvider)
Sets the missing entry provider to be used by this store
|
LocalSuggestBoxStore<T> |
setMissingHandlers(SuggestBoxStore.MissingSuggestProvider<T> missingSuggestProvider,
SuggestBoxStore.MissingEntryProvider<T> missingEntryProvider)
A shortcut method to set bot the MissingSuggestProvider and MissingEntryProvider
|
LocalSuggestBoxStore<T> |
setMissingValueProvider(SuggestBoxStore.MissingSuggestProvider<T> missingValueProvider)
sets the missing suggestion provider for this store
|
LocalSuggestBoxStore<T> |
setSuggestionFilter(SuggestBoxStore.SuggestionFilter<T> suggestionFilter)
Set the logic of matching a SuggestItem with the search text
|
LocalSuggestBoxStore<T> |
setSuggestions(List<SuggestItem<T>> suggestions)
replace the store suggestions with the provided List
|
public LocalSuggestBoxStore()
public LocalSuggestBoxStore(List<SuggestItem<T>> suggestions)
suggestions - List of SuggestItempublic static <T> LocalSuggestBoxStore<T> create()
T - the type of the SuggestBox valuepublic static <T> LocalSuggestBoxStore<T> create(List<SuggestItem<T>> suggestions)
T - the type of the SuggestBox valuesuggestions - List of SuggestItempublic LocalSuggestBoxStore<T> addSuggestion(SuggestItem<T> suggestion)
suggestion - SuggestItempublic LocalSuggestBoxStore<T> addSuggestions(List<SuggestItem<T>> suggestions)
suggestions - List of SuggestItempublic LocalSuggestBoxStore<T> setSuggestions(List<SuggestItem<T>> suggestions)
suggestions - List of new SuggestItempublic List<SuggestItem<T>> getSuggestions()
SuggestItem in this storepublic void filter(String searchValue, SuggestBoxStore.SuggestionsHandler<T> suggestionsHandler)
filter in interface SuggestBoxStore<T>searchValue - String text in the SuggestBoxsuggestionsHandler - SuggestBoxStore.SuggestionsHandlerpublic void find(T searchValue, Consumer<SuggestItem<T>> handler)
find in interface SuggestBoxStore<T>searchValue - Thandler - Consumer of SuggestItempublic boolean filterItem(String searchValue, SuggestItem<T> suggestItem)
filterItem in interface SuggestBoxStore<T>searchValue - StringsuggestItem - SuggestItemSuggestItem match the search textpublic SuggestBoxStore.SuggestionFilter<T> getSuggestionFilter()
SuggestionFilter used by this storepublic LocalSuggestBoxStore<T> setSuggestionFilter(SuggestBoxStore.SuggestionFilter<T> suggestionFilter)
suggestionFilter - SuggestionFilterpublic LocalSuggestBoxStore<T> setMissingValueProvider(SuggestBoxStore.MissingSuggestProvider<T> missingValueProvider)
missingValueProvider - MissingSuggestProviderpublic LocalSuggestBoxStore<T> setMissingEntryProvider(SuggestBoxStore.MissingEntryProvider<T> missingEntryProvider)
missingEntryProvider - MissingEntryProviderpublic SuggestBoxStore.MissingSuggestProvider<T> getMessingSuggestionProvider()
getMessingSuggestionProvider in interface SuggestBoxStore<T>SuggestBoxStore.MissingSuggestProvider to handle missing suggestions for a value this is
default to Optional.empty()public SuggestBoxStore.MissingEntryProvider<T> getMessingEntryProvider()
getMessingEntryProvider in interface SuggestBoxStore<T>SuggestBoxStore.MissingEntryProvider to handle missing suggestions for a text typed in the
SuggestBox this is default to Optional.empty()public LocalSuggestBoxStore<T> setMissingHandlers(SuggestBoxStore.MissingSuggestProvider<T> missingSuggestProvider, SuggestBoxStore.MissingEntryProvider<T> missingEntryProvider)
missingSuggestProvider - MissingSuggestProvidermissingEntryProvider - MissingEntryProviderCopyright © 2019–2022 Dominokit. All rights reserved.