Module MaterialFX

Class MFXFilterComboBox<T>

All Implemented Interfaces:
MFXCombo<T>, MFXMenuControl, Validated, Styleable, EventTarget, Skinnable

public class MFXFilterComboBox<T> extends MFXComboBox<T>
Extends MFXComboBox and changes the popup's content slightly to allow filtering the items list.

In addition to the base class futures this adds:

- Uses a TransformableListWrapper to filter the items. You could even sort them by retrieving the list instance and setting a comparator, TransformableList.comparatorProperty(). Beware to this though, TransformableList.setReversed(boolean), it's really important to specify that the comparator is in reverse order otherwise indexes will be inconsistent.

- A function that takes the typed search text as an input and builds a Predicate as a result to filter the list. This means that the user can fully customize how the list is filtered.

Note: this combo box do not uses MFXComboBoxCell and while it does allow it it should never be used. Use MFXFilterComboBoxCell instead for consistent selection behavior.
  • Property Details

  • Constructor Details

    • MFXFilterComboBox

      public MFXFilterComboBox()
    • MFXFilterComboBox

      public MFXFilterComboBox(ObservableList<T> items)
  • Method Details

    • getSearchText

      public String getSearchText()
      Gets the value of the property searchText.
      Property description:
      Specifies the text used to filter the items list.

      By default this text is bound bidirectionally with the text-field's used in the popup
    • searchTextProperty

      public StringProperty searchTextProperty()
      Specifies the text used to filter the items list.

      By default this text is bound bidirectionally with the text-field's used in the popup
      See Also:
    • setSearchText

      public void setSearchText(String searchText)
      Sets the value of the property searchText.
      Property description:
      Specifies the text used to filter the items list.

      By default this text is bound bidirectionally with the text-field's used in the popup
    • getFilterList

      public TransformableList<T> getFilterList()
    • getFilterFunction

      public Function<String,Predicate<T>> getFilterFunction()
      Gets the value of the property filterFunction.
      Property description:
      Specifies the function used to build a Predicate from the typed search text, the predicate is then used to filter the list.
    • filterFunctionProperty

      public FunctionProperty<String,Predicate<T>> filterFunctionProperty()
      Specifies the function used to build a Predicate from the typed search text, the predicate is then used to filter the list.
      See Also:
    • setFilterFunction

      public void setFilterFunction(Function<String,Predicate<T>> filterFunction)
      Sets the value of the property filterFunction.
      Property description:
      Specifies the function used to build a Predicate from the typed search text, the predicate is then used to filter the list.
    • isResetOnPopupHidden

      public boolean isResetOnPopupHidden()
      Returns:
      whether to reset the filter state, such as the searchTextProperty() when the popup is closed
    • setResetOnPopupHidden

      public void setResetOnPopupHidden(boolean resetOnPopupHidden)
      Sets whether to reset the filter state, such as the searchTextProperty() when the popup is closed
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class MFXComboBox<T>
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class MFXComboBox<T>