Class TypeaheadController
java.lang.Object
org.patternfly.component.typeahead.TypeaheadController
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:
Decision.Action.REFRESH— re-query the server immediately viaMenu.refresh()Decision.Action.DEBOUNCE— re-query the server after a debounce timeoutDecision.Action.FILTER— filter existing items locally viaMenu.search(SearchFilter, NoResults, String)Decision.Action.KEEP— do nothing, keep the current menu state as-is
The controller delegates component-specific behavior through two callbacks:
afterRefresh— called afterMenu.refresh()completes (e.g., update hints, fire loaded handlers)onSearch— called instead ofMenu.search(SearchFilter, NoResults, String)to allow additional behavior like hint updates
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterRefresh(Runnable afterRefresh) Sets the callback invoked afterMenu.refresh()completes.voidhandleInput(String value, Supplier<String> liveValue, Menu menu, Runnable expand, Runnable collapse) voidhandleKeyup(Menu menu, String value) voidhandleLoaded(Menu menu, String currentText) Returns the action from the most recent strategy evaluation.voidvoidSets a custom search function called instead of the defaultMenu.search(SearchFilter, NoResults, String).voidpreviousValue(String previousValue) voidrefreshOn(RefreshStrategy refreshStrategy) voidsearchFilter(SearchFilter searchFilter)
-
Constructor Details
-
TypeaheadController
public TypeaheadController()
-
-
Method Details
-
refreshOn
-
afterRefresh
Sets the callback invoked afterMenu.refresh()completes. Use this to perform component-specific post-refresh actions such as updating hints or firing loaded handlers. -
onSearch
Sets a custom search function called instead of the defaultMenu.search(SearchFilter, NoResults, String). The consumer receives the current input value. Use this to add component-specific behavior like hint updates after searching. -
searchFilter
-
noResults
-
refreshStrategy
-
previousValue
-
previousValue
-
lastAction
Returns the action from the most recent strategy evaluation. Defaults toDecision.Action.FILTER.