public class JFXAutoComplete extends Object implements AutoComplete
setCaseSensitive(boolean): true if case is sensitive for the searchsearchHitsFromStart(boolean): true if the Search for hits is performed from the start of the typed text only.
For example the dictionnary word "conf" would be a hit for the text "unconfirmed" if this property was set to false,
and false if it was set to true. There would be a hit in the two cases for the text "confirmed"showPopup(boolean): true if a Popup Window presenting the possible hits should be presented. if false, the first hit
will be automatically used for the completionacceptDuplicates(boolean): true if the dictionnary accept duplicatesstartSearchOnKeyCode(javafx.scene.input.KeyCode): the keyCode to use to start the search. By default the search is started
immediately during the typing. If the keyCode is strictly greater than 0, the search will be started by typing
this keyCode with the Control key downsearchPerWord(boolean): true if the Search is performed per each wordJFXAutoComplete.SuggestedHit (also a Label) for the suggestions, with the "autoComplete-hit" styleClass if categories are not used,
and "autoComplete-hit-category" if categories are used
TextField tf = new TextField();
JFXAutoComplete autoCompleter = new JFXAutoComplete(tf);
//add the dictionary
autoCompleter.addToDictionary("hello");
autoCompleter.addToDictionary("highlight");
autoCompleter.addToDictionary("cruel world");
autoCompleter.addToDictionary("war");
autoCompleter.addToDictionary("wording");
autoCompleter.addToDictionary("world");
| Modifier and Type | Class and Description |
|---|---|
class |
JFXAutoComplete.SuggestedHit
The Label used for the Suggested Hits.
|
class |
JFXAutoComplete.SuggestionHitsListView
A panel for suggested hits.
|
| Modifier and Type | Field and Description |
|---|---|
protected javafx.scene.control.TextInputControl |
textComponent
The text component.
|
| Constructor and Description |
|---|
JFXAutoComplete(javafx.scene.control.TextInputControl textComponent)
Constructor.
|
JFXAutoComplete(javafx.scene.control.TextInputControl textComponent,
boolean showPopup)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptDuplicates(boolean acceptDuplicates)
Set if the dictionnary accept duplicates.
|
void |
addAdditionalSearchItem(String template)
Add the additional search item in the popup.
|
void |
addAdditionalSearchSuggestion(String typedText)
Add the additional search text suggestion in the popup Window.
|
boolean |
addCategory(AutoCompleteDictionary.Category category)
Add a category to the dictionary.
|
AutoCompleteDictionary.Category |
addCategory(String category)
Add a category to the dictionary.
|
void |
addCategoryToSuggestions(AutoCompleteDictionary.Category category)
Add a category to the list of suggestions in the Popup Window.
|
boolean |
addItemToSuggestions(String category,
AutoCompleteDictionary.Item item)
Add a category to the list of suggestions in the Popup Window.
|
boolean |
addToDictionary(AutoCompleteDictionary.Item item)
Add an item to the dictionary to use for the autoComplete.
|
boolean |
addToDictionary(String word)
Add a word to the dictionary to use for the autoComplete.
|
boolean |
addToDictionary(String category,
AutoCompleteDictionary.Item item)
Add an item to the dictionary to use for the autoComplete.
|
boolean |
addToDictionary(String category,
String word)
Add a word to the dictionary to use for the autoComplete.
|
protected String |
getAdditionalSearchLabel(String typedText)
Return the full-text search label to show for the corresponding item.
|
AutoCompleteDictionary |
getDictionary()
Return the dictionnary used for the Autocompletion.
|
int |
getResultsLimit()
Return the results limits.
|
javafx.scene.input.KeyCode |
getSearchOnKeyCode()
Return the KeyCode to use to start the search By default the search is started immediately during the typing.
|
String |
getText()
Return the text component text.
|
javafx.scene.control.TextInputControl |
getTextComponent()
Return the text component.
|
boolean |
hasAdditionalSearchItem()
Return true if there is an additional search item in the popup.
|
boolean |
hasDefaultCategory()
Return true if the dictionnary uses only the default category.
|
boolean |
isAcceptingDuplicates()
Return true if the dictionnary accept duplicates.
|
boolean |
isCaseSensitive()
Return true if the search is case sensitive.
|
boolean |
isSearchingHitsFromStart()
Return true if the search begins from the start of the typed text.
|
boolean |
isSearchingPerWord()
Return true if the search is performed per each typed word.
|
boolean |
isShowingPopup()
Return true if the Popup Window with the words suggestions must be presented during typing.
|
boolean |
isStartingSearchImmediately()
Return true if the search is started immediately during the typing.
|
boolean |
removeCategory(AutoCompleteDictionary.Category category)
Remove a category from the dictionary.
|
boolean |
removeCategory(String category)
Add a category to the dictionary.
|
boolean |
removeFromDictionary(AutoCompleteDictionary.Item item)
Remove an item from the dictionary to use for the autoComplete.
|
boolean |
removeFromDictionary(String word)
Remove a word from the dictionary to use for the autoComplete.
|
boolean |
removeFromDictionary(String category,
AutoCompleteDictionary.Item item)
Remove an item from the dictionary to use for the autoComplete.
|
boolean |
removeFromDictionary(String category,
String word)
Remove a word from the dictionary to use for the autoComplete.
|
void |
resetDictionary()
Reset the Dictionnary to use for the autoComplete.
|
void |
searchHitsFromStart(boolean fromStart)
Set if the search begins from the start of the typed text.
|
void |
searchPerWord(boolean searchPerWord)
Set if the search is performed per each typed word.
|
void |
setCaseSensitive(boolean caseSensitive)
Set if the search is case sensitive.
|
void |
setDictionnary(AutoCompleteDictionary dictionary)
Set the dictionnary used for the Autocompletion.
|
void |
setMaximumPopupSize(int maxWidth,
int maxHeight)
Set the maximum width and height of the Popup.
|
void |
setOnlineEngine(AutoCompleteOnlineEngine engine)
Set the search engine used for the Autocomplete without Popup.
|
void |
setPopupEngine(AutoCompleteEngine engine)
Set the search engine used for the Autocomplete with Popup.
|
void |
setResultsLimit(int limit)
Set the results limits.
|
void |
showPopup(boolean showPopup)
Set if the Popup Window with the words suggestions must be presented during typing.
|
void |
startSearchOnKeyCode(javafx.scene.input.KeyCode keyCode)
Set the KeyCode to use to start the search.
|
protected javafx.scene.control.TextInputControl textComponent
public JFXAutoComplete(javafx.scene.control.TextInputControl textComponent)
textComponent - the text Componentpublic JFXAutoComplete(javafx.scene.control.TextInputControl textComponent,
boolean showPopup)
textComponent - the text ComponentshowPopup - true if the Popup Window is presented with the suggested words during typingpublic void setMaximumPopupSize(int maxWidth,
int maxHeight)
setMaximumPopupSize in interface AutoCompletemaxWidth - the maximum width of the PopupmaxHeight - the maximum height of the Popuppublic void addAdditionalSearchItem(String template)
MessageConstructor utility class.
For example If additionalSearchText = "Containing: $1", the result for the typed text "toto" will be "Containing: toto".addAdditionalSearchItem in interface AutoCompletetemplate - the template for the additional search itempublic boolean hasAdditionalSearchItem()
hasAdditionalSearchItem in interface AutoCompletepublic boolean hasDefaultCategory()
public void acceptDuplicates(boolean acceptDuplicates)
acceptDuplicates - true if the dictionnary accept duplicatespublic boolean isAcceptingDuplicates()
public void startSearchOnKeyCode(javafx.scene.input.KeyCode keyCode)
keyCode - the KeyCode to use to start the searchpublic javafx.scene.input.KeyCode getSearchOnKeyCode()
public boolean isStartingSearchImmediately()
public void searchPerWord(boolean searchPerWord)
searchPerWord - true if the search is performed per each typed wordpublic boolean isSearchingPerWord()
public void showPopup(boolean showPopup)
showPopup - if the Popup Window with the words suggestions must be presentedpublic boolean isShowingPopup()
public void setCaseSensitive(boolean caseSensitive)
caseSensitive - if the search is case sensitivepublic boolean isCaseSensitive()
isCaseSensitive in interface AutoCompletepublic void searchHitsFromStart(boolean fromStart)
isShowingPopup() is true, then the
search will always being from start regardless of the value if this property.fromStart - if the search begins from the start of the typed textpublic boolean isSearchingHitsFromStart()
isSearchingHitsFromStart in interface AutoCompletepublic void setResultsLimit(int limit)
limit - the results limitspublic int getResultsLimit()
getResultsLimit in interface AutoCompletepublic void setPopupEngine(AutoCompleteEngine engine)
setPopupEngine in interface AutoCompleteengine - the search enginepublic void setOnlineEngine(AutoCompleteOnlineEngine engine)
setOnlineEngine in interface AutoCompleteengine - the search enginepublic final String getText()
public void addCategoryToSuggestions(AutoCompleteDictionary.Category category)
AutoCompleteEngine used for the search with a Popup Window.addCategoryToSuggestions in interface AutoCompletecategory - the categorysetPopupEngine(org.mdiutil.text.autocomplete.AutoCompleteEngine)public boolean addItemToSuggestions(String category, AutoCompleteDictionary.Item item)
AutoCompleteEngine used for the search with a Popup Window.addItemToSuggestions in interface AutoCompletecategory - the category nameitem - the ItemsetPopupEngine(org.mdiutil.text.autocomplete.AutoCompleteEngine)protected String getAdditionalSearchLabel(String typedText)
typedText - the typed textpublic void addAdditionalSearchSuggestion(String typedText)
addAdditionalSearchSuggestion in interface AutoCompletetypedText - the typed textpublic void resetDictionary()
resetDictionary in interface AutoCompletepublic AutoCompleteDictionary getDictionary()
getDictionary in interface AutoCompletepublic void setDictionnary(AutoCompleteDictionary dictionary)
setDictionnary in interface AutoCompletedictionary - the dictionnarypublic boolean addCategory(AutoCompleteDictionary.Category category)
addCategory in interface AutoCompletecategory - the categorypublic AutoCompleteDictionary.Category addCategory(String category)
addCategory in interface AutoCompletecategory - the category namepublic boolean removeCategory(AutoCompleteDictionary.Category category)
removeCategory in interface AutoCompletecategory - the categorypublic boolean removeCategory(String category)
removeCategory in interface AutoCompletecategory - the category namepublic boolean addToDictionary(String word)
addToDictionary in interface AutoCompleteword - the wordpublic boolean addToDictionary(AutoCompleteDictionary.Item item)
addToDictionary in interface AutoCompleteitem - the itempublic boolean addToDictionary(String category, String word)
addToDictionary in interface AutoCompletecategory - the item categoryword - the wordpublic boolean addToDictionary(String category, AutoCompleteDictionary.Item item)
addToDictionary in interface AutoCompletecategory - the item categoryitem - the itempublic boolean removeFromDictionary(String word)
removeFromDictionary in interface AutoCompleteword - the wordpublic boolean removeFromDictionary(AutoCompleteDictionary.Item item)
removeFromDictionary in interface AutoCompleteitem - the itempublic boolean removeFromDictionary(String category, String word)
removeFromDictionary in interface AutoCompletecategory - the item categoryword - the wordpublic boolean removeFromDictionary(String category, AutoCompleteDictionary.Item item)
removeFromDictionary in interface AutoCompletecategory - the item categoryitem - the itempublic javafx.scene.control.TextInputControl getTextComponent()