Class SearchFieldUI


public class SearchFieldUI extends BuddyTextFieldUI
The default JXSearchField UI delegate.
Author:
Peter Weishapl petw@gmx.net
  • Field Details

  • Constructor Details

    • SearchFieldUI

      public SearchFieldUI(TextUI delegate)
  • Method Details

    • installUI

      public void installUI(JComponent c)
      Calls installDefaults(), adds the search, clear and popup button to the search field and registers a PropertyChangeListener ad DocumentListener and an ActionListener on the popup button.
      Overrides:
      installUI in class BuddyTextFieldUI
    • createBuddyLayoutAndBorder

      protected BuddyLayoutAndBorder createBuddyLayoutAndBorder()
      Description copied from class: BuddyTextFieldUI
      TODO doc
      Overrides:
      createBuddyLayoutAndBorder in class BuddyTextFieldUI
      Returns:
      BuddyLayoutAndBorder
    • installDefaults

      protected void installDefaults()
      Initialize the search fields various properties based on the corresponding "SearchField.*" properties from defaults table. The JXSearchFields layout is set to the value returned by createLayout.
      See Also:
    • uninstallUI

      public void uninstallUI(JComponent c)
      Removes all installed listeners, the layout and resets the search field original border and removes all children.
      Overrides:
      uninstallUI in class BuddyTextFieldUI
    • shouldReplaceResource

      protected boolean shouldReplaceResource(Object o)
      Returns true if o is null or of instance UIResource.
      Parameters:
      o - an object
      Returns:
      true if o is null or of instance UIResource
    • getNewIcon

      protected Icon getNewIcon(Icon icon, String resKey)
      Convience method for only replacing icons if they have not been customized by the user. Returns the icon from the defaults table belonging to resKey, if shouldReplaceResource(Object) with the icon as a parameter returns true. Otherwise returns icon.
      Parameters:
      icon - the current icon
      resKey - the resource key identifying the default icon
      Returns:
      the new icon
    • clearButton

      protected final JButton clearButton()
      Convienence method.
      Returns:
      the clear button
      See Also:
    • searchButton

      protected final JButton searchButton()
      Convienence method.
      Returns:
      the search button
      See Also:
    • popupButton

      protected final JButton popupButton()
      Convienence method.
      Returns:
      the popup button
      See Also:
    • usingSeperatePopupButton

      public boolean usingSeperatePopupButton()
      Returns true if JXSearchField.isUseSeperatePopupButton() is true and a search popup menu has been set.
      Returns:
      the popup button is used in addition to the search button
    • getPopupOffset

      protected int getPopupOffset()
      Returns the number of pixels between the popup button and the clear (or search) button as specified in the default table by 'SearchField.popupOffset'. Returns 0 if usingSeperatePopupButton() returns false
      Returns:
      number of pixels between the popup button and the clear (or search) button
    • updateButtons

      protected void updateButtons()
      Sets the visibility of the search, clear and popup buttons depending on the search mode, layout stye, search text, search popup menu and the use of a seperate popup button. Also resets the search buttons pressed and rollover icons if the search field is in regular search mode or clears the icons when the search field is in instant search mode.