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 Details

  • Constructor Details

    • SuggestionProvider

      public SuggestionProvider()
  • Method Details

    • showAllIfEmptyProperty

      public final BooleanProperty 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

      public void addPossibleSuggestions(T... newPossible)
      Add the given new possible suggestions to this SuggestionProvider
      Parameters:
      newPossible -
    • addPossibleSuggestions

      public void addPossibleSuggestions(Collection<T> newPossible)
      Add the given new possible suggestions to this SuggestionProvider
      Parameters:
      newPossible -
    • clearSuggestions

      public void clearSuggestions()
      Remove all current possible suggestions
    • call

      Specified by:
      call in interface Callback<AutoCompletionBinding.ISuggestionRequest,Collection<T>>
    • getComparator

      protected abstract Comparator<T> getComparator()
      Get the comparator to order the suggestions
      Returns:
    • isMatch

      protected abstract boolean isMatch(T suggestion, AutoCompletionBinding.ISuggestionRequest request)
      Check the given possible suggestion is a match (is a valid suggestion)
      Parameters:
      suggestion -
      request -
      Returns:
    • create

      public static <T> SuggestionProvider<T> create(Collection<T> possibleSuggestions)
      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 string
      possibleSuggestions - All possible suggestions
      Returns: