Class SearchAndSortControl

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class SearchAndSortControl extends JPanel
A simple search-and-sort control panel. It displays a ascending,descending,reset sort button group, as well as a search text bar. Visibility of each control group depends on the set of provided listeners.
See Also:
  • Field Details

    • INVALID_REGEX_COLOR

      public static final Color INVALID_REGEX_COLOR
  • Constructor Details

    • SearchAndSortControl

      public SearchAndSortControl()
      Create a SearchAndSortControl.
  • Method Details

    • findNext

      public void findNext()
      Tell all listeners to find the next matching item.
    • findPrev

      public void findPrev()
      Tell all listeners to find the previous matching item.
    • focusSearch

      public void focusSearch()
      Make the 'Search' text box the focused control.
    • setSearchText

      public void setSearchText(@NotNull String newText)
      Set the search text value
      Parameters:
      newText - the new search text value
    • connectSearchAction

      public void connectSearchAction(Object key, KeyStroke stroke, int inputMapCondition, Action action)
      Connect an Action to a specific KeyStroke when the 'Search' box has focus.
      Parameters:
      key - the acton key
      stroke - they KeyStroke that triggers the action
      inputMapCondition - the condition the action is valid
      action - the action to take
    • addSortListener

      public void addSortListener(@NotNull SearchAndSortControl.SortListener listener)
      Add a sort listener.
      Parameters:
      listener - the listener
    • removeSortListener

      public void removeSortListener(@NotNull SearchAndSortControl.SortListener listener)
      Remove a sort listener.
      Parameters:
      listener - the listener
    • addSearchListener

      public void addSearchListener(@NotNull SearchAndSortControl.SearchListener listener)
      Add a search listener.
      Parameters:
      listener - the listener
    • removeSearchListener

      public void removeSearchListener(@NotNull SearchAndSortControl.SearchListener listener)
      Remove a search listener.
      Parameters:
      listener - the listener
    • setAscendingSortIcon

      public void setAscendingSortIcon(Icon icon)
      Set the icon for the ascending sort button.
      Parameters:
      icon - the icon
    • setDescendingSortIcon

      public void setDescendingSortIcon(Icon icon)
      Set the icon for the descending sort button.
      Parameters:
      icon - the icon
    • setSortFocusable

      public void setSortFocusable(boolean isFocusable)
      Sets focusability of sortAscending/sortDescending buttons
      Parameters:
      isFocusable - if the buttons should be focusable
    • getSortDirective

      public SortOrder getSortDirective()
      Get the current sort directive.
      Returns:
      the sort directive
    • setSortDirective

      public void setSortDirective(SortOrder directive)
    • setPreferredSize

      public void setPreferredSize(Dimension dimension)
      Overrides:
      setPreferredSize in class JComponent
    • $$$getRootComponent$$$

      public JComponent $$$getRootComponent$$$()
      Noinspection:
      ALL