Class SuggestionProvider<T>

    • Constructor Detail

      • SuggestionProvider

        public SuggestionProvider()
    • Method Detail

      • 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
      • 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: