Module org.controlsfx.controls
Class SuggestionProvider<T>
java.lang.Object
impl.org.controlsfx.autocompletion.SuggestionProvider<T>
- Type Parameters:
T- Type of suggestions
- All Implemented Interfaces:
Callback<AutoCompletionBinding.ISuggestionRequest,Collection<T>>
public abstract class SuggestionProvider<T>
extends Object
implements Callback<AutoCompletionBinding.ISuggestionRequest,Collection<T>>
This is a simple implementation of a generic suggestion provider callback.
The complexity of suggestion generation is O(n) where n is the number of possible suggestions.
-
Property Summary
Properties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPossibleSuggestions(Collection<T> newPossible) Add the given new possible suggestions to this SuggestionProvidervoidaddPossibleSuggestions(T... newPossible) Add the given new possible suggestions to this SuggestionProvidervoidRemove all current possible suggestionsstatic <T> SuggestionProvider<T>create(Collection<T> possibleSuggestions) Create a default suggestion provider based on the toString() method of the generic objectsstatic <T> SuggestionProvider<T>create(Callback<T, String> stringConverter, Collection<T> possibleSuggestions) Create a default suggestion provider based on the toString() method of the generic objects using the provided stringConverterprotected abstract Comparator<T>Get the comparator to order the suggestionsprotected abstract booleanisMatch(T suggestion, AutoCompletionBinding.ISuggestionRequest request) Check the given possible suggestion is a match (is a valid suggestion)final booleanGets the value of the property showAllIfEmptyPropertyfinal voidsetShowAllIfEmpty(boolean showAllIfEmpty) Sets the value of the property showAllIfEmptyPropertyfinal BooleanPropertyGets showAllIfEmptyProperty
-
Property Details
-
showAllIfEmpty
Gets showAllIfEmptyProperty- See Also:
-
-
Constructor Details
-
SuggestionProvider
public SuggestionProvider()
-
-
Method Details
-
showAllIfEmptyProperty
Gets showAllIfEmptyProperty- See Also:
-
isShowAllIfEmpty
public final boolean isShowAllIfEmpty()Gets the value of the property showAllIfEmptyProperty- Returns:
- the value of the property
-
setShowAllIfEmpty
public final void setShowAllIfEmpty(boolean showAllIfEmpty) Sets the value of the property showAllIfEmptyProperty- Parameters:
showAllIfEmpty- if true, the provider will show all suggestions if empty text given
-
addPossibleSuggestions
Add the given new possible suggestions to this SuggestionProvider- Parameters:
newPossible-
-
addPossibleSuggestions
Add the given new possible suggestions to this SuggestionProvider- Parameters:
newPossible-
-
clearSuggestions
public void clearSuggestions()Remove all current possible suggestions -
call
- Specified by:
callin interfaceCallback<AutoCompletionBinding.ISuggestionRequest,Collection<T>>
-
getComparator
Get the comparator to order the suggestions- Returns:
-
isMatch
Check the given possible suggestion is a match (is a valid suggestion)- Parameters:
suggestion-request-- Returns:
-
create
Create a default suggestion provider based on the toString() method of the generic objects- Parameters:
possibleSuggestions- All possible suggestions- Returns:
-
create
public static <T> SuggestionProvider<T> create(Callback<T, String> stringConverter, Collection<T> possibleSuggestions) Create a default suggestion provider based on the toString() method of the generic objects using the provided stringConverter- Parameters:
stringConverter- A stringConverter which converts generic T into a stringpossibleSuggestions- All possible suggestions- Returns:
-