The search field requires proper configuration to work correctly:
The history manager is disabled by default, but it can be enabled using the setHistoryManager(HistoryManager) method.
We have implemented a local history manager, StringHistoryManager, which uses the Java Preferences API to store history records.
You can enable it via the setHistoryManager(HistoryManager) method.
setSuggestionProvider(Callback), setConverter(StringConverter), setCellFactory(Callback), setMatcher(BiFunction), setNewItemProducer(Callback), setComparator(Comparator)
| Modifier and Type | Class and Description |
|---|---|
| public static class | SearchField.
An event type used by the |
| private class | |
| public static class | SearchField.
the type of the cell T>A custom list cell implementation that is capable of underlining the part of the text that matches the user-typed search text. |
| public static interface | SearchField.
Represents a suggestion fetch request. |
| private class | |
| private class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final BooleanProperty | Returns: true if the text should be added to the history on commit, false otherwiseDetermines whether the text of the text field should be added to the history when the user commits to a value. |
| public final BooleanProperty | Returns: true if the text should be added to the history on Enter, false otherwiseDetermines whether the text of the text field should be added to the history when the user presses the Enter key. |
| public final BooleanProperty | Returns: true if the text should be added to the history on focus lost, false otherwiseDetermines whether the text of the text field should be added to the history when the field losses its focus. |
| private void | |
| public final BooleanProperty | Returns: the BooleanProperty for autoCommitOnFocusLost.Returns the BooleanProperty that indicates if text should auto-commit when the field loses focus. |
| public final ReadOnlyStringProperty | Returns: the auto-completed text (e.g. "ates" after the user entered "United St" in a country search field).A read-only property containing the automatically completed text. |
| public final DoubleProperty | Returns: the gap (in pixels) between the user typed text and the autocompleted textDefines the gap (in pixels) between the user typed text and the autocompleted text. |
| public final ObjectProperty | Returns: the busy graphicStores a node that will be shown on the field's right side whenever a search is ongoing. |
| public final void | |
| public final ObjectProperty | Returns: the cell factory used by the suggestion list viewA cell factory that can be used by a list view to visualize the list of suggestions. |
| public void | |
| public void | commit()
Makes the field commit to the currently selected item and updates the field to show the full text provided by the converter for the item. |
| public final ObjectProperty | Returns: the sorting comparator used for the suggestions listA comparator used to sort the list of suggestions. |
| public final ObjectProperty | Returns: the converter for turning the objects returned by the suggestion provider into textA converter for turning the objects returned by the suggestion provider into text. |
| protected Skin | createDefaultSkin()
Overrides javafx. Create a new instance of the default skin for this control. |
| private HistoryButton | |
| public final ReadOnlyStringProperty | Returns: the full text shown by the text fieldA read-only property containing the concatenation of the regular text of the text field and the autocompleted text. |
| public final String | |
| public final double | |
| public final Node | |
| public final Callback | |
| public final Comparator | |
| public final StringConverter | |
| public final TextField | Returns: the text field editor controlReturns the text field control used for editing the text. |
| public final String | |
| public final Node | |
| public final HistoryManager | |
| public final Node | |
| public final Node | |
| public final BiFunction | |
| public final Callback | |
| public final Consumer | |
| public final EventHandler | |
| public final EventHandler | |
| public final Node | |
| public final SearchFieldPopup | |
| public final String | |
| public final Node | |
| public final T | |
| public final Callback | |
| public final ObservableList | Returns: the list of suggestionsReturns a read-only (unmodifiable) list of the current suggestions. |
| public final String | |
| public String | getUserAgentStylesheet()
Overrides javafx. An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. |
| public final ObjectProperty | Returns: the field's graphicStores a node that will be shown on the field's right-hand side whenever the field is idle. |
| public final BooleanProperty | Returns: true if the popup should not be shown when there are no suggestions to display.Determines whether to hide the popup window when there are no choices available in the suggestion list. |
| public final BooleanProperty | Returns: true if the popup showing the list of suggestions will not appear if only a single choice is availableHides the popup window with the suggestion list if the list only contains a single elements. |
| public final ObjectProperty | Returns: the property representing the history managerThe history manager that is used to manage the history of the SearchField. |
| public final ObjectProperty | Returns: the property representing the history placeholder nodeReturns the property representing the history placeholder node. |
| private void | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final boolean | Returns: true if auto-commit on focus lost is enabled, false otherwise.Checks if the auto-commit on focus lost feature is enabled. |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final ObjectProperty | Returns: a custom node for the left-hand side (e.g. "clear" button)A custom node that can be shown on the left-hand side of the field. |
| public final ObjectProperty | Returns: the function used for determining the best match in the suggestion listThe function that is used to determine the first item in the suggestion list that is a good match for auto selection. |
| public final ObjectProperty | Returns: the callback for producing a new object of the field supported object typeA callback used for creating a new object on-the-fly if no item matches the search text. |
| public final ReadOnlyBooleanProperty | Returns: true if the selected item was not part of the suggestion list and has been created on-the-flyDetermines if the selected item has been created on-the-fly via the |
| public final ObjectProperty | Returns: the commit handlerA callback that gets invoked when the user has committed to the selected value. |
| private void | |
| public final ObjectProperty | Returns: the "search finished" event handlerAn event handler that can be used to get informed whenever the field finishes a search. |
| public final ObjectProperty | Returns: the "search started" event handlerAn event handler that can be used to get informed whenever the field starts a search. |
| public final ObjectProperty | Returns: the placeholder property for the list view of the auto suggest popupThe placeholder UI when no suggestions have been returned by the suggestion provider. |
| public final StringProperty | Returns: the prompt textA convenience property to set the prompt text shown by the text field when no text has been entered yet (e.g. "Search ..."). |
| public final ObjectProperty | Returns: a custom node for the right-hand side (e.g. "clear" button)A custom node that can be shown on the right-hand side of the field. |
| public final ReadOnlyBooleanProperty | Returns: true if the search is currently in progressA flag indicating whether the asynchronous search is currently in progress. |
| public void | select(T
the selected item item)Selects the given item and sets the editor's text to the string provided by the converter for the item. |
| public final ObjectProperty | |
| public final void | |
| public final void | |
| public final void | |
| public final void | setAutoCommitOnFocusLost(boolean
if true, enables auto-commit on focus lost; if false, disables it. value)Sets the value of the autoCommitOnFocusLost property. |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | setSuggestionProvider(Callback<SearchField.
|
| public final void | |
| public final BooleanProperty | Returns: true if a search icon will be shownDetermines if the field will show an icon on the right-hand side which indicates that the field is a search field. |
| public final ObjectProperty | Returns: #getSuggestionsA callback used for looking up a list of suggestions for the current search text. |
| public final StringProperty | Returns: the text shown by the fieldA convenience property bound to the editor's text property. |
| protected void | update(Collection<T>
the new suggestions to use for the field newSuggestions)Updates the control with the newly found list of suggestions. |