Class SearchField<T>

java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.control.Control
com.dlsc.gemsfx.SearchField<T>
Type Parameters:
T - the type of objects to work on
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable
Direct Known Subclasses:
TagsField

public class SearchField<T> extends javafx.scene.control.Control
The search field is a standard text field with auto suggest capabilities and a selection model for a specific type of object. This type is defined by the generic type argument. The main difference to other auto-suggest text fields is that the main outcome of this field is an object and not just the text entered by the user. Another difference is how the text field automatically finds and selects the first object that matches the text typed by the user so far. A third feature of this control is its ability to create new instances of the specified object type if no matching object can be found in the list of objects returned by the suggestion provider. This last feature allows an application to let the user either pick an existing object or to create a new one on-the-fly (but only if a new item producer has been set).

The search field requires proper configuration to work correctly:

  1. Suggestion Provider - a callback that returns a collection of items for a given search field suggestion request. The suggestion provider is invoked asynchronously via JavaFX concurrency API (service & task). The suggestion provider gets invoked slightly delayed whenever the user types some text into the field. If the user types again the current search gets cancelled and a new search gets initiated. As long as the user types fast enough the actual search will not be performed.
  2. Converter - the converter is used to convert the items found in the suggestions list to text. This is just a standard StringConverter instance (only the toString() method needs to be implemented).
  3. Cell Factory - a standard list cell factory / callback used for the ListView instance shown in the popup that presents the suggested items. The default cell factory should be sufficient for most use cases. It simply displays the name of the items via the help of the string converter. However, it also underlines the text match in the name.
  4. Matcher - a function taking two arguments that will be applied to the suggested items to find "perfect matches" for the given search text (entered by the user). The function takes an item and the search text as input and returns a boolean. The first perfect match found will be used to autocomplete the text of the search field.
  5. New Item Producer - a callback that returns a new item instance of the type supported by the search field. This callback is used if the field is configured to create items "on-the-fly", meaning the typed text does not match anything in the suggested list of items.
  6. Comparator - a standard comparator used to perform a first sorting of the suggested items. However, internally the field wraps this comparator to place some items higher up in the dropdown list as they are better matches for the current search text.

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.

See Also:
  • Property Summary

    Properties
    Type
    Property
    Description
    final javafx.beans.property.BooleanProperty
    Determines whether the text of the text field should be added to the history when the user commits to a value.
    final javafx.beans.property.BooleanProperty
    Determines whether the text of the text field should be added to the history when the user presses the Enter key.
    final javafx.beans.property.BooleanProperty
    Determines whether the text of the text field should be added to the history when the field losses its focus.
    final javafx.beans.property.BooleanProperty
    Returns the BooleanProperty that indicates if text should auto-commit when the field loses focus.
    final javafx.beans.property.ReadOnlyStringProperty
    A read-only property containing the automatically completed text.
    final javafx.beans.property.DoubleProperty
    Defines the gap (in pixels) between the user typed text and the autocompleted text.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Stores a node that will be shown on the field's right side whenever a search is ongoing.
    final javafx.beans.property.ObjectProperty<javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>>
    A cell factory that can be used by a list view to visualize the list of suggestions.
    final javafx.beans.property.ObjectProperty<Comparator<T>>
    A comparator used to sort the list of suggestions.
    final javafx.beans.property.ObjectProperty<javafx.util.StringConverter<T>>
    A converter for turning the objects returned by the suggestion provider into text.
    final javafx.beans.property.ReadOnlyStringProperty
    A read-only property containing the concatenation of the regular text of the text field and the autocompleted text.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Stores a node that will be shown on the field's right-hand side whenever the field is idle.
    final javafx.beans.property.BooleanProperty
    Determines whether to hide the popup window when there are no choices available in the suggestion list.
    final javafx.beans.property.BooleanProperty
    Hides the popup window with the suggestion list if the list only contains a single elements.
    final javafx.beans.property.ObjectProperty<HistoryManager<String>>
    The history manager that is used to manage the history of the SearchField.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Returns the property representing the history placeholder node.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    A custom node that can be shown on the left-hand side of the field.
    final javafx.beans.property.ObjectProperty<BiFunction<T,String,Boolean>>
    The function that is used to determine the first item in the suggestion list that is a good match for auto selection.
    final javafx.beans.property.ObjectProperty<javafx.util.Callback<String,T>>
    A callback used for creating a new object on-the-fly if no item matches the search text.
    final javafx.beans.property.ReadOnlyBooleanProperty
    Determines if the selected item has been created on-the-fly via the newItemProducer.
    final javafx.beans.property.ObjectProperty<Consumer<T>>
    A callback that gets invoked when the user has committed to the selected value.
    final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>>
    An event handler that can be used to get informed whenever the field finishes a search.
    final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>>
    An event handler that can be used to get informed whenever the field starts a search.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The placeholder UI when no suggestions have been returned by the suggestion provider.
    final javafx.beans.property.StringProperty
    A convenience property to set the prompt text shown by the text field when no text has been entered yet (e.g.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    A custom node that can be shown on the right-hand side of the field.
    final javafx.beans.property.ReadOnlyBooleanProperty
    A flag indicating whether the asynchronous search is currently in progress.
    final javafx.beans.property.ObjectProperty<T>
    Contains the currently selected item.
    final javafx.beans.property.BooleanProperty
    Determines if the field will show an icon on the right-hand side which indicates that the field is a search field.
    final javafx.beans.property.ObjectProperty<javafx.util.Callback<SearchField.SearchFieldSuggestionRequest,Collection<T>>>
    A callback used for looking up a list of suggestions for the current search text.
    final javafx.beans.property.StringProperty
    A convenience property bound to the editor's text property.

    Properties inherited from class javafx.scene.control.Control

    contextMenu, skin, tooltip

    Properties inherited from class javafx.scene.layout.Region

    background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width

    Properties inherited from class javafx.scene.Parent

    needsLayout

    Properties inherited from class javafx.scene.Node

    accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    An event type used by the SearchField to indicate the start and end of searching operations.
    static class 
    A custom list cell implementation that is capable of underlining the part of the text that matches the user-typed search text.
    static interface 
    Represents a suggestion fetch request.
  • Field Summary

    Fields inherited from class javafx.scene.layout.Region

    USE_COMPUTED_SIZE, USE_PREF_SIZE

    Fields inherited from class javafx.scene.Node

    BASELINE_OFFSET_SAME_AS_HEIGHT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new spotlight field.
  • Method Summary

    Modifier and Type
    Method
    Description
    final javafx.beans.property.BooleanProperty
    Determines whether the text of the text field should be added to the history when the user commits to a value.
    final javafx.beans.property.BooleanProperty
    Determines whether the text of the text field should be added to the history when the user presses the Enter key.
    final javafx.beans.property.BooleanProperty
    Determines whether the text of the text field should be added to the history when the field losses its focus.
    final javafx.beans.property.BooleanProperty
    Returns the BooleanProperty that indicates if text should auto-commit when the field loses focus.
    final javafx.beans.property.ReadOnlyStringProperty
    A read-only property containing the automatically completed text.
    final javafx.beans.property.DoubleProperty
    Defines the gap (in pixels) between the user typed text and the autocompleted text.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Stores a node that will be shown on the field's right side whenever a search is ongoing.
    final void
    Cancels the current search in progress.
    final javafx.beans.property.ObjectProperty<javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>>
    A cell factory that can be used by a list view to visualize the list of suggestions.
    void
    Convenience method to invoke clear() on the text field.
    void
    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.
    final javafx.beans.property.ObjectProperty<Comparator<T>>
    A comparator used to sort the list of suggestions.
    final javafx.beans.property.ObjectProperty<javafx.util.StringConverter<T>>
    A converter for turning the objects returned by the suggestion provider into text.
    protected javafx.scene.control.Skin<?>
     
    final javafx.beans.property.ReadOnlyStringProperty
    A read-only property containing the concatenation of the regular text of the text field and the autocompleted text.
    final String
    Gets the value of the property autoCompletedText.
    final double
    Gets the value of the property autoCompletionGap.
    final javafx.scene.Node
    Gets the value of the property busyGraphic.
    final javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>
    Gets the value of the property cellFactory.
    final Comparator<T>
    Gets the value of the property comparator.
    final javafx.util.StringConverter<T>
    Gets the value of the property converter.
    final javafx.scene.control.TextField
    Returns the text field control used for editing the text.
    final String
    Gets the value of the property fullText.
    final javafx.scene.Node
    Gets the value of the property graphic.
    Gets the value of the property historyManager.
    final javafx.scene.Node
    Gets the value of the property historyPlaceholder.
    final javafx.scene.Node
    Gets the value of the property left.
    Gets the value of the property matcher.
    final javafx.util.Callback<String,T>
    Gets the value of the property newItemProducer.
    final Consumer<T>
    Gets the value of the property onCommit.
    final javafx.event.EventHandler<SearchField.SearchEvent>
    Gets the value of the property onSearchFinished.
    final javafx.event.EventHandler<SearchField.SearchEvent>
    Gets the value of the property onSearchStarted.
    final javafx.scene.Node
    Gets the value of the property placeholder.
     
    final String
    Gets the value of the property promptText.
    final javafx.scene.Node
    Gets the value of the property right.
    final T
    Gets the value of the property selectedItem.
    Gets the value of the property suggestionProvider.
    final javafx.collections.ObservableList<T>
    Returns a read-only (unmodifiable) list of the current suggestions.
    final String
    Gets the value of the property text.
     
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Stores a node that will be shown on the field's right-hand side whenever the field is idle.
    final javafx.beans.property.BooleanProperty
    Determines whether to hide the popup window when there are no choices available in the suggestion list.
    final javafx.beans.property.BooleanProperty
    Hides the popup window with the suggestion list if the list only contains a single elements.
    final javafx.beans.property.ObjectProperty<HistoryManager<String>>
    The history manager that is used to manage the history of the SearchField.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    Returns the property representing the history placeholder node.
    final boolean
    Gets the value of the property addingItemToHistoryOnCommit.
    final boolean
    Gets the value of the property addingItemToHistoryOnEnter.
    final boolean
    Gets the value of the property addingItemToHistoryOnFocusLost.
    final boolean
    Checks if the auto-commit on focus lost feature is enabled.
    final boolean
    Gets the value of the property hidePopupWithNoChoice.
    final boolean
    Gets the value of the property hidePopupWithSingleChoice.
    final boolean
    Gets the value of the property newItem.
    final boolean
    Gets the value of the property searching.
    final boolean
    Gets the value of the property showSearchIcon.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    A custom node that can be shown on the left-hand side of the field.
    final javafx.beans.property.ObjectProperty<BiFunction<T,String,Boolean>>
    The function that is used to determine the first item in the suggestion list that is a good match for auto selection.
    final javafx.beans.property.ObjectProperty<javafx.util.Callback<String,T>>
    A callback used for creating a new object on-the-fly if no item matches the search text.
    final javafx.beans.property.ReadOnlyBooleanProperty
    Determines if the selected item has been created on-the-fly via the newItemProducer.
    final javafx.beans.property.ObjectProperty<Consumer<T>>
    A callback that gets invoked when the user has committed to the selected value.
    final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>>
    An event handler that can be used to get informed whenever the field finishes a search.
    final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>>
    An event handler that can be used to get informed whenever the field starts a search.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    The placeholder UI when no suggestions have been returned by the suggestion provider.
    final javafx.beans.property.StringProperty
    A convenience property to set the prompt text shown by the text field when no text has been entered yet (e.g.
    final javafx.beans.property.ObjectProperty<javafx.scene.Node>
    A custom node that can be shown on the right-hand side of the field.
    final javafx.beans.property.ReadOnlyBooleanProperty
    A flag indicating whether the asynchronous search is currently in progress.
    void
    select(T item)
    Selects the given item and sets the editor's text to the string provided by the converter for the item.
    final javafx.beans.property.ObjectProperty<T>
    Contains the currently selected item.
    final void
    setAddingItemToHistoryOnCommit(boolean addingItemToHistoryOnCommit)
    Sets the value of the property addingItemToHistoryOnCommit.
    final void
    setAddingItemToHistoryOnEnter(boolean addingItemToHistoryOnEnter)
    Sets the value of the property addingItemToHistoryOnEnter.
    final void
    setAddingItemToHistoryOnFocusLost(boolean addingItemToHistoryOnFocusLost)
    Sets the value of the property addingItemToHistoryOnFocusLost.
    final void
    setAutoCommitOnFocusLost(boolean value)
    Sets the value of the autoCommitOnFocusLost property.
    final void
    setAutoCompletionGap(double autoCompletionGap)
    Sets the value of the property autoCompletionGap.
    final void
    setBusyGraphic(javafx.scene.Node busyGraphic)
    Sets the value of the property busyGraphic.
    final void
    setCellFactory(javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>> cellFactory)
    Sets the value of the property cellFactory.
    final void
    setComparator(Comparator<T> comparator)
    Sets the value of the property comparator.
    final void
    setConverter(javafx.util.StringConverter<T> converter)
    Sets the value of the property converter.
    final void
    setGraphic(javafx.scene.Node graphic)
    Sets the value of the property graphic.
    final void
    setHidePopupWithNoChoice(boolean hidePopupWithNoChoice)
    Sets the value of the property hidePopupWithNoChoice.
    final void
    setHidePopupWithSingleChoice(boolean hidePopupWithSingleChoice)
    Sets the value of the property hidePopupWithSingleChoice.
    final void
    Sets the value of the property historyManager.
    final void
    setHistoryPlaceholder(javafx.scene.Node historyPlaceholder)
    Sets the value of the property historyPlaceholder.
    final void
    setLeft(javafx.scene.Node left)
    Sets the value of the property left.
    final void
    Sets the value of the property matcher.
    final void
    setNewItemProducer(javafx.util.Callback<String,T> newItemProducer)
    Sets the value of the property newItemProducer.
    void
    setOnCommit(Consumer<T> onCommit)
    Sets the value of the property onCommit.
    final void
    setOnSearchFinished(javafx.event.EventHandler<SearchField.SearchEvent> value)
    Sets the value of the property onSearchFinished.
    final void
    setOnSearchStarted(javafx.event.EventHandler<SearchField.SearchEvent> value)
    Sets the value of the property onSearchStarted.
    final void
    setPlaceholder(javafx.scene.Node value)
    Sets the value of the property placeholder.
    final void
    setPromptText(String promptText)
    Sets the value of the property promptText.
    final void
    setRight(javafx.scene.Node right)
    Sets the value of the property right.
    final void
    setSelectedItem(T selectedItem)
    Sets the value of the property selectedItem.
    final void
    setShowSearchIcon(boolean showSearchIcon)
    Sets the value of the property showSearchIcon.
    final void
    Sets the value of the property suggestionProvider.
    final void
    Sets the value of the property text.
    final javafx.beans.property.BooleanProperty
    Determines if the field will show an icon on the right-hand side which indicates that the field is a search field.
    final javafx.beans.property.ObjectProperty<javafx.util.Callback<SearchField.SearchFieldSuggestionRequest,Collection<T>>>
    A callback used for looking up a list of suggestions for the current search text.
    final javafx.beans.property.StringProperty
    A convenience property bound to the editor's text property.
    protected void
    update(Collection<T> newSuggestions)
    Updates the control with the newly found list of suggestions.

    Methods inherited from class javafx.scene.control.Control

    computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty

    Methods inherited from class javafx.scene.layout.Region

    backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty

    Methods inherited from class javafx.scene.Parent

    getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds

    Methods inherited from class javafx.scene.Node

    accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Property Details

    • onCommit

      public final javafx.beans.property.ObjectProperty<Consumer<T>> onCommitProperty
      A callback that gets invoked when the user has committed to the selected value. "Committing" means that the user has hit the ENTER key, or the RIGHT arrow, or the field has lost its focus. Or the user has clicked on one of the suggestions in the popup window.
      See Also:
    • onSearchStarted

      public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>> onSearchStartedProperty
      An event handler that can be used to get informed whenever the field starts a search. This event gets fired often while the user is still typing as the search gets reset with every keystroke.
      See Also:
    • onSearchFinished

      public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>> onSearchFinishedProperty
      An event handler that can be used to get informed whenever the field finishes a search.
      See Also:
    • graphic

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> graphicProperty
      Stores a node that will be shown on the field's right-hand side whenever the field is idle.
      See Also:
    • busyGraphic

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> busyGraphicProperty
      Stores a node that will be shown on the field's right side whenever a search is ongoing.
      See Also:
    • hidePopupWithSingleChoice

      public final javafx.beans.property.BooleanProperty hidePopupWithSingleChoiceProperty
      Hides the popup window with the suggestion list if the list only contains a single elements. The default is "false".
      See Also:
    • hidePopupWithNoChoice

      public final javafx.beans.property.BooleanProperty hidePopupWithNoChoiceProperty
      Determines whether to hide the popup window when there are no choices available in the suggestion list. The default value is "false", indicating that the popup does not hide automatically under this condition.
      See Also:
    • searching

      public final javafx.beans.property.ReadOnlyBooleanProperty searchingProperty
      A flag indicating whether the asynchronous search is currently in progress. This flag can be used to animate something that expresses that the search is ongoing.
      See Also:
    • newItem

      public final javafx.beans.property.ReadOnlyBooleanProperty newItemProperty
      Determines if the selected item has been created on-the-fly via the newItemProducer. This will only ever happen if a new item producer has been specified.
      See Also:
    • cellFactory

      public final javafx.beans.property.ObjectProperty<javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>> cellFactoryProperty
      A cell factory that can be used by a list view to visualize the list of suggestions.
      See Also:
    • comparator

      public final javafx.beans.property.ObjectProperty<Comparator<T>> comparatorProperty
      A comparator used to sort the list of suggestions. The field will try to find a first best match inside the sorted list. Internally the control uses an "inner" comparator to ensure that suggestions appear based on the entered text, which means that a perfect match will always show up first and then the suggests that "start" with the search string.
      See Also:
    • newItemProducer

      public final javafx.beans.property.ObjectProperty<javafx.util.Callback<String,T>> newItemProducerProperty
      A callback used for creating a new object on-the-fly if no item matches the search text.
      See Also:
    • autoCompletionGap

      public final javafx.beans.property.DoubleProperty autoCompletionGapProperty
      Defines the gap (in pixels) between the user typed text and the autocompleted text.
      See Also:
    • fullText

      public final javafx.beans.property.ReadOnlyStringProperty fullTextProperty
      A read-only property containing the concatenation of the regular text of the text field and the autocompleted text.
      See Also:
    • text

      public final javafx.beans.property.StringProperty textProperty
      A convenience property bound to the editor's text property.
      See Also:
    • promptText

      public final javafx.beans.property.StringProperty promptTextProperty
      A convenience property to set the prompt text shown by the text field when no text has been entered yet (e.g. "Search ...").
      See Also:
    • autoCompletedText

      public final javafx.beans.property.ReadOnlyStringProperty autoCompletedTextProperty
      A read-only property containing the automatically completed text. This property is completely managed by the control.
      See Also:
    • matcher

      public final javafx.beans.property.ObjectProperty<BiFunction<T,String,Boolean>> matcherProperty
      The function that is used to determine the first item in the suggestion list that is a good match for auto selection. This is normally the case if the text provided by the converter for an item starts with exactly the text typed by the user. Auto selection will cause the field to automatically complete the text typed by the user with the name of the match.
      See Also:
    • selectedItem

      public final javafx.beans.property.ObjectProperty<T> selectedItemProperty
      Contains the currently selected item.
      See Also:
    • suggestionProvider

      public final javafx.beans.property.ObjectProperty<javafx.util.Callback<SearchField.SearchFieldSuggestionRequest,Collection<T>>> suggestionProviderProperty
      A callback used for looking up a list of suggestions for the current search text.
      See Also:
    • converter

      public final javafx.beans.property.ObjectProperty<javafx.util.StringConverter<T>> converterProperty
      A converter for turning the objects returned by the suggestion provider into text.
      See Also:
    • placeholder

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> placeholderProperty
      The placeholder UI when no suggestions have been returned by the suggestion provider.
      See Also:
    • autoCommitOnFocusLost

      public final javafx.beans.property.BooleanProperty autoCommitOnFocusLostProperty
      Returns the BooleanProperty that indicates if text should auto-commit when the field loses focus. The property is lazy-initialized and defaults to true, enabling auto-commit by default.
      See Also:
    • left

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> leftProperty
      A custom node that can be shown on the left-hand side of the field.
      See Also:
    • right

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> rightProperty
      A custom node that can be shown on the right-hand side of the field.
      See Also:
    • showSearchIcon

      public final javafx.beans.property.BooleanProperty showSearchIconProperty
      Determines if the field will show an icon on the right-hand side which indicates that the field is a search field.
      See Also:
    • historyPlaceholder

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> historyPlaceholderProperty
      Returns the property representing the history placeholder node.
      See Also:
    • addingItemToHistoryOnEnter

      public final javafx.beans.property.BooleanProperty addingItemToHistoryOnEnterProperty
      Determines whether the text of the text field should be added to the history when the user presses the Enter key.
      See Also:
    • addingItemToHistoryOnFocusLost

      public final javafx.beans.property.BooleanProperty addingItemToHistoryOnFocusLostProperty
      Determines whether the text of the text field should be added to the history when the field losses its focus.
      See Also:
    • addingItemToHistoryOnCommit

      public final javafx.beans.property.BooleanProperty addingItemToHistoryOnCommitProperty
      Determines whether the text of the text field should be added to the history when the user commits to a value.
      See Also:
    • historyManager

      public final javafx.beans.property.ObjectProperty<HistoryManager<String>> historyManagerProperty
      The history manager that is used to manage the history of the SearchField.

      If its value is null, the history feature will not be enabled, which means only the magnifying glass icon will be displayed, and the dropdown arrow next to the magnifying glass will not be shown.

      If its value is not null, the history feature will be enabled, meaning that both the magnifying glass icon and the dropdown arrow will be displayed. Clicking the magnifying glass icon button will display the history popup.

      To enable the history feature, you need to set an instance of HistoryManager. Typically, you would use an instance of StringHistoryManager, which is an implementation of HistoryManager that manages string-type history records.

      See Also:
  • Constructor Details

    • SearchField

      public SearchField()
      Constructs a new spotlight field. The field will set defaults for the matcher, the converter, the cell factory, and the comparator. It will not set a default for the "new item" producer.

      The history manager is initialized with default values.

      See Also:
  • Method Details

    • commit

      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. This method can be called multiple times. For a single event when the user explicitly commits to a value use the onCommitProperty().
    • getOnCommit

      public final Consumer<T> getOnCommit()
      Gets the value of the property onCommit.
      Property description:
      A callback that gets invoked when the user has committed to the selected value. "Committing" means that the user has hit the ENTER key, or the RIGHT arrow, or the field has lost its focus. Or the user has clicked on one of the suggestions in the popup window.
    • onCommitProperty

      public final javafx.beans.property.ObjectProperty<Consumer<T>> onCommitProperty()
      A callback that gets invoked when the user has committed to the selected value. "Committing" means that the user has hit the ENTER key, or the RIGHT arrow, or the field has lost its focus. Or the user has clicked on one of the suggestions in the popup window.
      See Also:
    • setOnCommit

      public void setOnCommit(Consumer<T> onCommit)
      Sets the value of the property onCommit.
      Property description:
      A callback that gets invoked when the user has committed to the selected value. "Committing" means that the user has hit the ENTER key, or the RIGHT arrow, or the field has lost its focus. Or the user has clicked on one of the suggestions in the popup window.
    • onSearchStartedProperty

      public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>> onSearchStartedProperty()
      An event handler that can be used to get informed whenever the field starts a search. This event gets fired often while the user is still typing as the search gets reset with every keystroke.
      See Also:
    • setOnSearchStarted

      public final void setOnSearchStarted(javafx.event.EventHandler<SearchField.SearchEvent> value)
      Sets the value of the property onSearchStarted.
      Property description:
      An event handler that can be used to get informed whenever the field starts a search. This event gets fired often while the user is still typing as the search gets reset with every keystroke.
    • getOnSearchStarted

      public final javafx.event.EventHandler<SearchField.SearchEvent> getOnSearchStarted()
      Gets the value of the property onSearchStarted.
      Property description:
      An event handler that can be used to get informed whenever the field starts a search. This event gets fired often while the user is still typing as the search gets reset with every keystroke.
    • onSearchFinishedProperty

      public final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<SearchField.SearchEvent>> onSearchFinishedProperty()
      An event handler that can be used to get informed whenever the field finishes a search.
      See Also:
    • setOnSearchFinished

      public final void setOnSearchFinished(javafx.event.EventHandler<SearchField.SearchEvent> value)
      Sets the value of the property onSearchFinished.
      Property description:
      An event handler that can be used to get informed whenever the field finishes a search.
    • getOnSearchFinished

      public final javafx.event.EventHandler<SearchField.SearchEvent> getOnSearchFinished()
      Gets the value of the property onSearchFinished.
      Property description:
      An event handler that can be used to get informed whenever the field finishes a search.
    • getGraphic

      public final javafx.scene.Node getGraphic()
      Gets the value of the property graphic.
      Property description:
      Stores a node that will be shown on the field's right-hand side whenever the field is idle.
    • graphicProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> graphicProperty()
      Stores a node that will be shown on the field's right-hand side whenever the field is idle.
      See Also:
    • setGraphic

      public final void setGraphic(javafx.scene.Node graphic)
      Sets the value of the property graphic.
      Property description:
      Stores a node that will be shown on the field's right-hand side whenever the field is idle.
    • getBusyGraphic

      public final javafx.scene.Node getBusyGraphic()
      Gets the value of the property busyGraphic.
      Property description:
      Stores a node that will be shown on the field's right side whenever a search is ongoing.
    • busyGraphicProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> busyGraphicProperty()
      Stores a node that will be shown on the field's right side whenever a search is ongoing.
      See Also:
    • setBusyGraphic

      public final void setBusyGraphic(javafx.scene.Node busyGraphic)
      Sets the value of the property busyGraphic.
      Property description:
      Stores a node that will be shown on the field's right side whenever a search is ongoing.
    • isSearching

      public final boolean isSearching()
      Gets the value of the property searching.
      Property description:
      A flag indicating whether the asynchronous search is currently in progress. This flag can be used to animate something that expresses that the search is ongoing.
    • isHidePopupWithSingleChoice

      public final boolean isHidePopupWithSingleChoice()
      Gets the value of the property hidePopupWithSingleChoice.
      Property description:
      Hides the popup window with the suggestion list if the list only contains a single elements. The default is "false".
    • hidePopupWithSingleChoiceProperty

      public final javafx.beans.property.BooleanProperty hidePopupWithSingleChoiceProperty()
      Hides the popup window with the suggestion list if the list only contains a single elements. The default is "false".
      See Also:
    • setHidePopupWithSingleChoice

      public final void setHidePopupWithSingleChoice(boolean hidePopupWithSingleChoice)
      Sets the value of the property hidePopupWithSingleChoice.
      Property description:
      Hides the popup window with the suggestion list if the list only contains a single elements. The default is "false".
    • isHidePopupWithNoChoice

      public final boolean isHidePopupWithNoChoice()
      Gets the value of the property hidePopupWithNoChoice.
      Property description:
      Determines whether to hide the popup window when there are no choices available in the suggestion list. The default value is "false", indicating that the popup does not hide automatically under this condition.
    • hidePopupWithNoChoiceProperty

      public final javafx.beans.property.BooleanProperty hidePopupWithNoChoiceProperty()
      Determines whether to hide the popup window when there are no choices available in the suggestion list. The default value is "false", indicating that the popup does not hide automatically under this condition.
      See Also:
    • setHidePopupWithNoChoice

      public final void setHidePopupWithNoChoice(boolean hidePopupWithNoChoice)
      Sets the value of the property hidePopupWithNoChoice.
      Property description:
      Determines whether to hide the popup window when there are no choices available in the suggestion list. The default value is "false", indicating that the popup does not hide automatically under this condition.
    • searchingProperty

      public final javafx.beans.property.ReadOnlyBooleanProperty searchingProperty()
      A flag indicating whether the asynchronous search is currently in progress. This flag can be used to animate something that expresses that the search is ongoing.
      See Also:
    • getEditor

      public final javafx.scene.control.TextField getEditor()
      Returns the text field control used for editing the text.
      Returns:
      the text field editor control
    • select

      public void select(T item)
      Selects the given item and sets the editor's text to the string provided by the converter for the item.
      Parameters:
      item - the selected item
    • cancel

      public final void cancel()
      Cancels the current search in progress.
    • update

      protected void update(Collection<T> newSuggestions)
      Updates the control with the newly found list of suggestions. The suggestions are provided by a background search service.
      Parameters:
      newSuggestions - the new suggestions to use for the field
    • createDefaultSkin

      protected javafx.scene.control.Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class javafx.scene.control.Control
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class javafx.scene.layout.Region
    • clear

      public void clear()
      Convenience method to invoke clear() on the text field.
    • getSuggestions

      public final javafx.collections.ObservableList<T> getSuggestions()
      Returns a read-only (unmodifiable) list of the current suggestions.
      Returns:
      the list of suggestions
      See Also:
    • isNewItem

      public final boolean isNewItem()
      Gets the value of the property newItem.
      Property description:
      Determines if the selected item has been created on-the-fly via the newItemProducer. This will only ever happen if a new item producer has been specified.
    • newItemProperty

      public final javafx.beans.property.ReadOnlyBooleanProperty newItemProperty()
      Determines if the selected item has been created on-the-fly via the newItemProducer. This will only ever happen if a new item producer has been specified.
      See Also:
    • getCellFactory

      public final javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>> getCellFactory()
      Gets the value of the property cellFactory.
      Property description:
      A cell factory that can be used by a list view to visualize the list of suggestions.
    • cellFactoryProperty

      public final javafx.beans.property.ObjectProperty<javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>>> cellFactoryProperty()
      A cell factory that can be used by a list view to visualize the list of suggestions.
      See Also:
    • setCellFactory

      public final void setCellFactory(javafx.util.Callback<javafx.scene.control.ListView<T>,javafx.scene.control.ListCell<T>> cellFactory)
      Sets the value of the property cellFactory.
      Property description:
      A cell factory that can be used by a list view to visualize the list of suggestions.
    • getComparator

      public final Comparator<T> getComparator()
      Gets the value of the property comparator.
      Property description:
      A comparator used to sort the list of suggestions. The field will try to find a first best match inside the sorted list. Internally the control uses an "inner" comparator to ensure that suggestions appear based on the entered text, which means that a perfect match will always show up first and then the suggests that "start" with the search string.
    • comparatorProperty

      public final javafx.beans.property.ObjectProperty<Comparator<T>> comparatorProperty()
      A comparator used to sort the list of suggestions. The field will try to find a first best match inside the sorted list. Internally the control uses an "inner" comparator to ensure that suggestions appear based on the entered text, which means that a perfect match will always show up first and then the suggests that "start" with the search string.
      See Also:
    • setComparator

      public final void setComparator(Comparator<T> comparator)
      Sets the value of the property comparator.
      Property description:
      A comparator used to sort the list of suggestions. The field will try to find a first best match inside the sorted list. Internally the control uses an "inner" comparator to ensure that suggestions appear based on the entered text, which means that a perfect match will always show up first and then the suggests that "start" with the search string.
    • getNewItemProducer

      public final javafx.util.Callback<String,T> getNewItemProducer()
      Gets the value of the property newItemProducer.
      Property description:
      A callback used for creating a new object on-the-fly if no item matches the search text.
    • newItemProducerProperty

      public final javafx.beans.property.ObjectProperty<javafx.util.Callback<String,T>> newItemProducerProperty()
      A callback used for creating a new object on-the-fly if no item matches the search text.
      See Also:
    • setNewItemProducer

      public final void setNewItemProducer(javafx.util.Callback<String,T> newItemProducer)
      Sets the value of the property newItemProducer.
      Property description:
      A callback used for creating a new object on-the-fly if no item matches the search text.
    • getAutoCompletionGap

      public final double getAutoCompletionGap()
      Gets the value of the property autoCompletionGap.
      Property description:
      Defines the gap (in pixels) between the user typed text and the autocompleted text.
    • autoCompletionGapProperty

      public final javafx.beans.property.DoubleProperty autoCompletionGapProperty()
      Defines the gap (in pixels) between the user typed text and the autocompleted text.
      See Also:
    • setAutoCompletionGap

      public final void setAutoCompletionGap(double autoCompletionGap)
      Sets the value of the property autoCompletionGap.
      Property description:
      Defines the gap (in pixels) between the user typed text and the autocompleted text.
    • getFullText

      public final String getFullText()
      Gets the value of the property fullText.
      Property description:
      A read-only property containing the concatenation of the regular text of the text field and the autocompleted text.
    • fullTextProperty

      public final javafx.beans.property.ReadOnlyStringProperty fullTextProperty()
      A read-only property containing the concatenation of the regular text of the text field and the autocompleted text.
      See Also:
    • getText

      public final String getText()
      Gets the value of the property text.
      Property description:
      A convenience property bound to the editor's text property.
    • textProperty

      public final javafx.beans.property.StringProperty textProperty()
      A convenience property bound to the editor's text property.
      See Also:
    • setText

      public final void setText(String text)
      Sets the value of the property text.
      Property description:
      A convenience property bound to the editor's text property.
    • getPromptText

      public final String getPromptText()
      Gets the value of the property promptText.
      Property description:
      A convenience property to set the prompt text shown by the text field when no text has been entered yet (e.g. "Search ...").
    • promptTextProperty

      public final javafx.beans.property.StringProperty promptTextProperty()
      A convenience property to set the prompt text shown by the text field when no text has been entered yet (e.g. "Search ...").
      See Also:
    • setPromptText

      public final void setPromptText(String promptText)
      Sets the value of the property promptText.
      Property description:
      A convenience property to set the prompt text shown by the text field when no text has been entered yet (e.g. "Search ...").
    • getAutoCompletedText

      public final String getAutoCompletedText()
      Gets the value of the property autoCompletedText.
      Property description:
      A read-only property containing the automatically completed text. This property is completely managed by the control.
    • autoCompletedTextProperty

      public final javafx.beans.property.ReadOnlyStringProperty autoCompletedTextProperty()
      A read-only property containing the automatically completed text. This property is completely managed by the control.
      See Also:
    • getMatcher

      public final BiFunction<T,String,Boolean> getMatcher()
      Gets the value of the property matcher.
      Property description:
      The function that is used to determine the first item in the suggestion list that is a good match for auto selection. This is normally the case if the text provided by the converter for an item starts with exactly the text typed by the user. Auto selection will cause the field to automatically complete the text typed by the user with the name of the match.
    • matcherProperty

      public final javafx.beans.property.ObjectProperty<BiFunction<T,String,Boolean>> matcherProperty()
      The function that is used to determine the first item in the suggestion list that is a good match for auto selection. This is normally the case if the text provided by the converter for an item starts with exactly the text typed by the user. Auto selection will cause the field to automatically complete the text typed by the user with the name of the match.
      See Also:
    • setMatcher

      public final void setMatcher(BiFunction<T,String,Boolean> matcher)
      Sets the value of the property matcher.
      Property description:
      The function that is used to determine the first item in the suggestion list that is a good match for auto selection. This is normally the case if the text provided by the converter for an item starts with exactly the text typed by the user. Auto selection will cause the field to automatically complete the text typed by the user with the name of the match.
    • selectedItemProperty

      public final javafx.beans.property.ObjectProperty<T> selectedItemProperty()
      Contains the currently selected item.
      See Also:
    • getSelectedItem

      public final T getSelectedItem()
      Gets the value of the property selectedItem.
      Property description:
      Contains the currently selected item.
    • setSelectedItem

      public final void setSelectedItem(T selectedItem)
      Sets the value of the property selectedItem.
      Property description:
      Contains the currently selected item.
    • getSuggestionProvider

      public final javafx.util.Callback<SearchField.SearchFieldSuggestionRequest,Collection<T>> getSuggestionProvider()
      Gets the value of the property suggestionProvider.
      Property description:
      A callback used for looking up a list of suggestions for the current search text.
    • suggestionProviderProperty

      public final javafx.beans.property.ObjectProperty<javafx.util.Callback<SearchField.SearchFieldSuggestionRequest,Collection<T>>> suggestionProviderProperty()
      A callback used for looking up a list of suggestions for the current search text.
      See Also:
    • setSuggestionProvider

      public final void setSuggestionProvider(javafx.util.Callback<SearchField.SearchFieldSuggestionRequest,Collection<T>> suggestionProvider)
      Sets the value of the property suggestionProvider.
      Property description:
      A callback used for looking up a list of suggestions for the current search text.
    • getConverter

      public final javafx.util.StringConverter<T> getConverter()
      Gets the value of the property converter.
      Property description:
      A converter for turning the objects returned by the suggestion provider into text.
    • converterProperty

      public final javafx.beans.property.ObjectProperty<javafx.util.StringConverter<T>> converterProperty()
      A converter for turning the objects returned by the suggestion provider into text.
      See Also:
    • setConverter

      public final void setConverter(javafx.util.StringConverter<T> converter)
      Sets the value of the property converter.
      Property description:
      A converter for turning the objects returned by the suggestion provider into text.
    • placeholderProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> placeholderProperty()
      The placeholder UI when no suggestions have been returned by the suggestion provider.
      See Also:
    • setPlaceholder

      public final void setPlaceholder(javafx.scene.Node value)
      Sets the value of the property placeholder.
      Property description:
      The placeholder UI when no suggestions have been returned by the suggestion provider.
    • getPlaceholder

      public final javafx.scene.Node getPlaceholder()
      Gets the value of the property placeholder.
      Property description:
      The placeholder UI when no suggestions have been returned by the suggestion provider.
    • autoCommitOnFocusLostProperty

      public final javafx.beans.property.BooleanProperty autoCommitOnFocusLostProperty()
      Returns the BooleanProperty that indicates if text should auto-commit when the field loses focus. The property is lazy-initialized and defaults to true, enabling auto-commit by default.
      See Also:
    • isAutoCommitOnFocusLost

      public final boolean isAutoCommitOnFocusLost()
      Checks if the auto-commit on focus lost feature is enabled.
      Returns:
      true if auto-commit on focus lost is enabled, false otherwise.
    • setAutoCommitOnFocusLost

      public final void setAutoCommitOnFocusLost(boolean value)
      Sets the value of the autoCommitOnFocusLost property.
      Parameters:
      value - if true, enables auto-commit on focus lost; if false, disables it.
    • getLeft

      public final javafx.scene.Node getLeft()
      Gets the value of the property left.
      Property description:
      A custom node that can be shown on the left-hand side of the field.
    • leftProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> leftProperty()
      A custom node that can be shown on the left-hand side of the field.
      See Also:
    • setLeft

      public final void setLeft(javafx.scene.Node left)
      Sets the value of the property left.
      Property description:
      A custom node that can be shown on the left-hand side of the field.
    • getRight

      public final javafx.scene.Node getRight()
      Gets the value of the property right.
      Property description:
      A custom node that can be shown on the right-hand side of the field.
    • rightProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> rightProperty()
      A custom node that can be shown on the right-hand side of the field.
      See Also:
    • setRight

      public final void setRight(javafx.scene.Node right)
      Sets the value of the property right.
      Property description:
      A custom node that can be shown on the right-hand side of the field.
    • isShowSearchIcon

      public final boolean isShowSearchIcon()
      Gets the value of the property showSearchIcon.
      Property description:
      Determines if the field will show an icon on the right-hand side which indicates that the field is a search field.
    • showSearchIconProperty

      public final javafx.beans.property.BooleanProperty showSearchIconProperty()
      Determines if the field will show an icon on the right-hand side which indicates that the field is a search field.
      See Also:
    • setShowSearchIcon

      public final void setShowSearchIcon(boolean showSearchIcon)
      Sets the value of the property showSearchIcon.
      Property description:
      Determines if the field will show an icon on the right-hand side which indicates that the field is a search field.
    • historyPlaceholderProperty

      public final javafx.beans.property.ObjectProperty<javafx.scene.Node> historyPlaceholderProperty()
      Returns the property representing the history placeholder node.
      See Also:
    • getHistoryPlaceholder

      public final javafx.scene.Node getHistoryPlaceholder()
      Gets the value of the property historyPlaceholder.
      Property description:
      Returns the property representing the history placeholder node.
    • setHistoryPlaceholder

      public final void setHistoryPlaceholder(javafx.scene.Node historyPlaceholder)
      Sets the value of the property historyPlaceholder.
      Property description:
      Returns the property representing the history placeholder node.
    • addingItemToHistoryOnEnterProperty

      public final javafx.beans.property.BooleanProperty addingItemToHistoryOnEnterProperty()
      Determines whether the text of the text field should be added to the history when the user presses the Enter key.
      See Also:
    • isAddingItemToHistoryOnEnter

      public final boolean isAddingItemToHistoryOnEnter()
      Gets the value of the property addingItemToHistoryOnEnter.
      Property description:
      Determines whether the text of the text field should be added to the history when the user presses the Enter key.
    • setAddingItemToHistoryOnEnter

      public final void setAddingItemToHistoryOnEnter(boolean addingItemToHistoryOnEnter)
      Sets the value of the property addingItemToHistoryOnEnter.
      Property description:
      Determines whether the text of the text field should be added to the history when the user presses the Enter key.
    • addingItemToHistoryOnFocusLostProperty

      public final javafx.beans.property.BooleanProperty addingItemToHistoryOnFocusLostProperty()
      Determines whether the text of the text field should be added to the history when the field losses its focus.
      See Also:
    • isAddingItemToHistoryOnFocusLost

      public final boolean isAddingItemToHistoryOnFocusLost()
      Gets the value of the property addingItemToHistoryOnFocusLost.
      Property description:
      Determines whether the text of the text field should be added to the history when the field losses its focus.
    • setAddingItemToHistoryOnFocusLost

      public final void setAddingItemToHistoryOnFocusLost(boolean addingItemToHistoryOnFocusLost)
      Sets the value of the property addingItemToHistoryOnFocusLost.
      Property description:
      Determines whether the text of the text field should be added to the history when the field losses its focus.
    • addingItemToHistoryOnCommitProperty

      public final javafx.beans.property.BooleanProperty addingItemToHistoryOnCommitProperty()
      Determines whether the text of the text field should be added to the history when the user commits to a value.
      See Also:
    • isAddingItemToHistoryOnCommit

      public final boolean isAddingItemToHistoryOnCommit()
      Gets the value of the property addingItemToHistoryOnCommit.
      Property description:
      Determines whether the text of the text field should be added to the history when the user commits to a value.
    • setAddingItemToHistoryOnCommit

      public final void setAddingItemToHistoryOnCommit(boolean addingItemToHistoryOnCommit)
      Sets the value of the property addingItemToHistoryOnCommit.
      Property description:
      Determines whether the text of the text field should be added to the history when the user commits to a value.
    • historyManagerProperty

      public final javafx.beans.property.ObjectProperty<HistoryManager<String>> historyManagerProperty()
      The history manager that is used to manage the history of the SearchField.

      If its value is null, the history feature will not be enabled, which means only the magnifying glass icon will be displayed, and the dropdown arrow next to the magnifying glass will not be shown.

      If its value is not null, the history feature will be enabled, meaning that both the magnifying glass icon and the dropdown arrow will be displayed. Clicking the magnifying glass icon button will display the history popup.

      To enable the history feature, you need to set an instance of HistoryManager. Typically, you would use an instance of StringHistoryManager, which is an implementation of HistoryManager that manages string-type history records.

      See Also:
    • getHistoryManager

      public final HistoryManager<String> getHistoryManager()
      Gets the value of the property historyManager.
      Property description:
      The history manager that is used to manage the history of the SearchField.

      If its value is null, the history feature will not be enabled, which means only the magnifying glass icon will be displayed, and the dropdown arrow next to the magnifying glass will not be shown.

      If its value is not null, the history feature will be enabled, meaning that both the magnifying glass icon and the dropdown arrow will be displayed. Clicking the magnifying glass icon button will display the history popup.

      To enable the history feature, you need to set an instance of HistoryManager. Typically, you would use an instance of StringHistoryManager, which is an implementation of HistoryManager that manages string-type history records.

    • setHistoryManager

      public final void setHistoryManager(HistoryManager<String> historyManager)
      Sets the value of the property historyManager.
      Property description:
      The history manager that is used to manage the history of the SearchField.

      If its value is null, the history feature will not be enabled, which means only the magnifying glass icon will be displayed, and the dropdown arrow next to the magnifying glass will not be shown.

      If its value is not null, the history feature will be enabled, meaning that both the magnifying glass icon and the dropdown arrow will be displayed. Clicking the magnifying glass icon button will display the history popup.

      To enable the history feature, you need to set an instance of HistoryManager. Typically, you would use an instance of StringHistoryManager, which is an implementation of HistoryManager that manages string-type history records.

    • getPopup

      public final SearchFieldPopup<T> getPopup()