Class SNTSearchableBar

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JToolBar
com.jidesoft.swing.SearchableBar
sc.fiji.snt.gui.SNTSearchableBar
All Implemented Interfaces:
com.jidesoft.swing.SearchableProvider, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
PathManagerUISearchableBar

public class SNTSearchableBar extends com.jidesoft.swing.SearchableBar
Implements a SearchableBar following SNT's UI.
Author:
Tiago Ferreira
See Also:
  • Field Details

    • _extraButtons

      protected List<AbstractButton> _extraButtons
    • subFilteringEnabled

      protected boolean subFilteringEnabled
  • Constructor Details

    • SNTSearchableBar

      public SNTSearchableBar(JTree jTree)
    • SNTSearchableBar

      public SNTSearchableBar(JList<?> list)
    • SNTSearchableBar

      public SNTSearchableBar(JTree jTree, String placeholder)
    • SNTSearchableBar

      public SNTSearchableBar(JList<?> list, String placeholder)
    • SNTSearchableBar

      public SNTSearchableBar(com.jidesoft.swing.Searchable searchable)
    • SNTSearchableBar

      public SNTSearchableBar(com.jidesoft.swing.Searchable searchable, String placeholder)
  • Method Details

    • newTreeSearchable

      public static com.jidesoft.swing.Searchable newTreeSearchable(JTree tree)
      Creates a TreeSearchable that scrolls only to the current match rather than once per hit. A plain TreeSearchable scrolls on every call to its setSelectedIndex(), and highlightAll() (on by default here, see SearchableBar.setHighlightAll(boolean)) calls it once per match, so a large/deep tree ends up scrolling repeatedly on every keystroke instead of just once.

      Also turns on TreeSearchable.setRecursive(boolean), which defaults to false in jide-oss: with it off, matches are only looked for among the currently visible (expanded) rows, so a collapsed branch is invisible to the search, not just to the eye

      Parameters:
      tree - the tree to be searched
      Returns:
      a scroll-throttled, fully-recursive searchable wrapping tree
    • newListSearchable

      public static com.jidesoft.swing.Searchable newListSearchable(JList<?> list)
      Same as newListSearchable(JList, Function), with the default toString()-based element converter
      Parameters:
      list - the list to be searched
      Returns:
      a scroll-throttled searchable wrapping list
    • newListSearchable

      public static com.jidesoft.swing.Searchable newListSearchable(JList<?> list, Function<Object,String> elementConverter)
      Creates a ListSearchable with the same scroll-throttling and match-counting fixes as newTreeSearchable(JTree).
      Parameters:
      list - the list to be searched
      elementConverter - optional; converts a list element to the string matched against, or null to use the element's own toString()
      Returns:
      a scroll-throttled searchable wrapping list
    • getMaxHistoryLength

      public int getMaxHistoryLength()
      Overrides:
      getMaxHistoryLength in class com.jidesoft.swing.SearchableBar
    • getSearchField

      public SearchField getSearchField()
    • setStatusLabelPlaceholder

      public void setStatusLabelPlaceholder(String placeholder)
    • installComponents

      protected void installComponents()
      Overrides:
      installComponents in class com.jidesoft.swing.SearchableBar
    • setSearchableObjectDescription

      protected void setSearchableObjectDescription(String objectDescription)
    • setGuiUtils

      public void setGuiUtils(GuiUtils guiUtils)
    • appendToOptionsMenu

      protected void appendToOptionsMenu(Collection<JMenuItem> menuItems)
    • setSubFilteringEnabled

      public void setSubFilteringEnabled(boolean enable)
    • addOptionsMenuItem

      public void addOptionsMenuItem(JMenuItem item)
      Adds a menu item to the search bar's options (gear) menu. The item is appended before the "Tips & Shortcuts" entry.
      Parameters:
      item - the menu item to add
    • setStatus

      public void setStatus(String text)
    • createFindPrevButton

      protected AbstractButton createFindPrevButton(AbstractAction findPrevAction)
      Overrides:
      createFindPrevButton in class com.jidesoft.swing.SearchableBar
    • createFindNextButton

      protected AbstractButton createFindNextButton(AbstractAction findNextAction)
      Overrides:
      createFindNextButton in class com.jidesoft.swing.SearchableBar
    • getImageIcon

      protected ImageIcon getImageIcon(String name)
      Overrides:
      getImageIcon in class com.jidesoft.swing.SearchableBar
    • createCloseButton

      protected AbstractButton createCloseButton(AbstractAction closeAction)
      Overrides:
      createCloseButton in class com.jidesoft.swing.SearchableBar
    • createHighlightButton

      protected AbstractButton createHighlightButton()
      Overrides:
      createHighlightButton in class com.jidesoft.swing.SearchableBar
    • formatButton

      protected void formatButton(AbstractButton button, IconFactory.GLYPH glyph)