Class MenuSearchInput

All Implemented Interfaces:
Attachable, ElementAttributeMethods<HTMLElement,MenuSearchInput>, ElementClassListMethods<HTMLElement,MenuSearchInput>, ElementConsumerMethods<HTMLElement,MenuSearchInput>, ElementContainerMethods<HTMLElement,MenuSearchInput>, ElementEventMethods<HTMLElement,MenuSearchInput>, ElementIdMethods<HTMLElement,MenuSearchInput>, ElementQueryMethods<HTMLElement>, HTMLElementAttributeMethods<HTMLElement,MenuSearchInput>, HTMLElementDataMethods<HTMLElement,MenuSearchInput>, HTMLElementStyleMethods<HTMLElement,MenuSearchInput>, HTMLElementVisibilityMethods<HTMLElement,MenuSearchInput>, IsElement<HTMLElement>, TypedBuilder<HTMLElement,MenuSearchInput>

public class MenuSearchInput extends SubComponent<HTMLElement,MenuSearchInput> implements Attachable
  • Method Details

    • attach

      public void attach(MutationRecord mutationRecord)
      Specified by:
      attach in interface Attachable
    • onSearch

      public MenuSearchInput onSearch(BiPredicate<MenuItem,String> searchFilter)
      Configures the search behavior for the search input you have added with addSearchInput(TextInputGroup).

      Menu menu = menu(MenuType.menu, click)
              .addSearch(menuSearch()
                      .addSearchInput(menuSearchInput()
                              .addSearchInput(searchInputGroup())
                              .onSearch((menuItem, value) ->
                                      menuItem.text().toLowerCase().contains(value.toLowerCase()))
                              .onNoResults(value ->
                                      menuItem(Id.unique("no-results"), "No results found for \"" + value + "\"")
                                              .disabled())))
              .addDivider()
              .addContent(menuContent()
                      .addList(menuList()
                              .addItem(menuItem("item-0", "Action 1"))
                              .addItem(menuItem("item-1", "Action 2"))
                              .addItem(menuItem("item-2", "Action 3"))));
      
      Parameters:
      searchFilter - a BiPredicate that defines the search logic. The first parameter is a MenuItem representing a menu item, and the second parameter is a String representing the search query. The predicate should return true for items matching the search.
      Returns:
      the MenuSearchInput instance for method chaining.
    • onNoResults

      public MenuSearchInput onNoResults(Function<String,MenuItem> noResults)
    • that

      public MenuSearchInput that()
      Specified by:
      that in interface TypedBuilder<HTMLElement,MenuSearchInput>
    • addSearchInput

      public MenuSearchInput addSearchInput(TextInputGroup textInputGroup)