Class TypeaheadController

java.lang.Object
org.patternfly.component.typeahead.TypeaheadController

public class TypeaheadController extends Object
Manages typeahead input handling state. Encapsulates the refresh strategy, search filter, no-results handler, and the input logic driven by RefreshStrategy and Decision.

On each input change, the controller evaluates the strategy to get a Decision:

The controller delegates component-specific behavior through two callbacks:

  • Constructor Details

    • TypeaheadController

      public TypeaheadController()
  • Method Details

    • handleKeyup

      public void handleKeyup(Menu menu, String value)
    • handleInput

      public void handleInput(String value, Supplier<String> liveValue, Menu menu, Runnable expand, Runnable collapse)
    • handleLoaded

      public void handleLoaded(Menu menu, String currentText)
    • searchFilter

      public void searchFilter(SearchFilter searchFilter)
    • noResults

      public void noResults(NoResults noResults)
    • refreshOn

      public void refreshOn(RefreshStrategy refreshStrategy)
    • afterRefresh

      public void afterRefresh(Runnable afterRefresh)
      Sets the callback invoked after Menu.refresh() completes. Use this to perform component-specific post-refresh actions such as updating hints or firing loaded handlers.
    • onSearch

      public void onSearch(Consumer<String> onSearch)
      Sets a custom search function called instead of the default Menu.search(SearchFilter, NoResults, String). The consumer receives the current input value. Use this to add component-specific behavior like hint updates after searching.
    • searchFilter

      public SearchFilter searchFilter()
    • noResults

      public NoResults noResults()
    • refreshStrategy

      public RefreshStrategy refreshStrategy()
    • previousValue

      public String previousValue()
    • previousValue

      public void previousValue(String previousValue)
    • lastAction

      public Decision.Action lastAction()
      Returns the action from the most recent strategy evaluation. Defaults to Decision.Action.FILTER.