public interface AutocompleteComponent<T>
Autocomplete component represents an input with autocomplete function.
That is when you start typing, some suggestions are offered to you, which you can choose from, to fill in the input faster.
| Modifier and Type | Method and Description |
|---|---|
boolean |
areSuggestionsAvailable()
Determines whether the suggestion list is visible, that is whether there are some suggestions rendered.
|
boolean |
autocompleteWithSuggestion(Suggestion<T> sugg)
Autocompletes the input with given suggestion
|
boolean |
autocompleteWithSuggestion(Suggestion<T> sugg,
ScrollingType scrollingType)
Autocompletes the input with suggestion determined by param
sugg, and the suggestion is chosen by the way
determined by param scrollingType |
void |
clear(ClearType... clearType)
Clears the input.
|
void |
finish()
Finishes the filling in the input, that is, fill in the input not by selecting from the suggestions list, but by direct
typing in.
|
List<Suggestion<T>> |
getAllSuggestions()
Returns all suggestions available, also these which need to be scrolled down to be visible.
|
String |
getFirstInputValue()
Returns the first input value, the values are separated according to the currently set separator, default one is space.
|
List<Suggestion<T>> |
getFirstNSuggestions(int n)
Returns first n suggestions, that is the the first n most top suggestions, if there are some available.
|
Suggestion<T> |
getFirstSuggestion()
Returns the first suggestion if available, that is, the top suggestion from the list of suggestions.
|
String |
getInputValue()
Returns the current value of input
|
List<String> |
getInputValues()
Returns the list of the input values, the values are separated according to the currently set separator, default one is
space.
|
Suggestion<T> |
getNthSuggestion(int order)
Returns the suggestion which is in order determined by param
order. |
List<Suggestion<T>> |
getSelectedSuggestions()
Returns the selected suggestions from the input, the way of suggestions separating is determined by the currently set
separator, the default one is space.
|
void |
setSeparator(String regex)
Sets the separator of the input values.
|
void |
setSuggestionParser(SuggestionParser<T> parser)
Sets the suggestion parser.
|
void |
type(String value)
Types to the autocomplete input provided value and waits for suggestions.
|
List<Suggestion<T>> |
typeAndReturn(String value)
Types to the autocomplete input the provided string and returns the suggestions if available.
|
boolean areSuggestionsAvailable()
void clear(ClearType... clearType)
Clears the input. The method of clearing can be passed as argument to determine the way the input will be cleared
clearType - IllegalArgumentException - when there is illegal number of arguements passedvoid finish()
Finishes the filling in the input, that is, fill in the input not by selecting from the suggestions list, but by direct typing in.
List<Suggestion<T>> getAllSuggestions()
IllegalStateException - if the suggestion parser was not set prior to execution of this methodList<Suggestion<T>> getSelectedSuggestions()
Returns the selected suggestions from the input, the way of suggestions separating is determined by the currently set separator, the default one is space.
Note that it does not return the values of the input which was filled in directly, not by choosing from suggestion list.
setSeparator(String)List<String> getInputValues()
setSeparator(String)String getInputValue()
String getFirstInputValue()
setSeparator(String)void setSeparator(String regex)
regex - void setSuggestionParser(SuggestionParser<T> parser)
Sets the suggestion parser. The default one is StringSuggestionParser
The suggestion parser determines how can be value of suggestion parsed and the suggestion object created
parser - List<Suggestion<T>> getFirstNSuggestions(int n)
Returns first n suggestions, that is the the first n most top suggestions, if there are some available. The suggestions are determined according to the suggestion parser, which was set prior of executing of this method.
If there are no suggestions rendered null is returned.
If the requested number of suggestions is bigger than the actual number of suggestions, then only available suggestions are returned.
IllegalStateException - if the suggestion parser was not set prior to execution of this methodSuggestion<T> getFirstSuggestion()
IllegalStateException - if the suggestion parser was not set prior to execution of this methodSuggestion<T> getNthSuggestion(int order)
order. If there is no so many suggestions, then
null is returned. Note that the suggestions are ordered from the top of the suggestion list and the ordering begins from
1.order - order or null if there is not such a
suggestionIllegalStateException - if the suggestion parser was not set prior to execution of this methodvoid type(String value)
Types to the autocomplete input provided value and waits for suggestions. If there are no suggestions available nothing happen.
The wait timeout is determined by GUI_WAIT
value - List<Suggestion<T>> typeAndReturn(String value)
Types to the autocomplete input the provided string and returns the suggestions if available.
That is it types the whole value of the param string to the input on which the autocomplete function is
bound and returns all available suggestions. If there are no suggestions, null is returned.
value - the characters which are about to write to the autocomplete inputIllegalStateException - if the suggestion parser was not set prior to execution of this methodboolean autocompleteWithSuggestion(Suggestion<T> sugg)
Autocompletes the input with given suggestion
That is it chooses the suggestion from the list of available suggestions. If that particular suggestion is not available, or there are no suggestions at all, then it is just ignored, and false is returned.
sugg - the suggestion, it will be autocompleted withIllegalArgumentException - when suggestion is nullboolean autocompleteWithSuggestion(Suggestion<T> sugg, ScrollingType scrollingType)
Autocompletes the input with suggestion determined by param sugg, and the suggestion is chosen by the way
determined by param scrollingType
That is, it chooses the suggestion from the list of available suggestions. If that particular suggestion is not available, or there are no suggestions at all, then it is just ignored, and false is returned.
sugg - the suggestion, it will be autocompleted withscrollingType - the scrolling type of the suggestion selectionIllegalArgumentException - if sugg or scrollingType is nullCopyright © 2013 JBoss by Red Hat. All Rights Reserved.