Class JXSearchPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

@JavaBean public class JXSearchPanel extends AbstractPatternPanel

JXSearchPanel provides complex searching features. Users are able to specify searching rules, enter searching text (including regular expressions), and toggle case-sensitivity.

One of the main features that JXSearchPanel provides is the ability to update PatternMatchers. To highlight text with a Highlighter, you need to update the highlighter via a pattern matcher.

 public class PatternHandler implements PatternMatcher {
 
     private Highlighter highlighter;
 
     private Pattern pattern;
 
     public void setPattern(Pattern pattern) {
         this.pattern = pattern;
         highlighter.setHighlightPredicate(new PatternPredicate(pattern));
     }
 
 }
 

TODO: allow custom PatternModel and/or access to configuration of bound PatternModel.

TODO: fully support control of multiple PatternMatchers.

Author:
Ramesh Gupta, Jeanette Winzenburg
See Also:
  • Field Details

    • MATCH_RULE_ACTION_COMMAND

      public static final String MATCH_RULE_ACTION_COMMAND
      The action command key.
      See Also:
  • Constructor Details

    • JXSearchPanel

      public JXSearchPanel()
      Creates a search panel.
  • Method Details

    • addPatternMatcher

      public void addPatternMatcher(PatternMatcher matcher)
      Adds a pattern matcher.
      Parameters:
      matcher - the matcher to add.
    • setFieldName

      public void setFieldName(String name)
      set the label of the search combo.
      Parameters:
      name - the label
    • getFieldName

      public String getFieldName()
      returns the label of the search combo.
    • getPattern

      public Pattern getPattern()
      returns the current compiled Pattern.
      Returns:
      the current compiled Pattern
    • updateFieldName

      protected void updateFieldName(PatternMatcher matcher)
      Parameters:
      matcher -
    • match

      public void match()
      Updates the pattern matchers.
      Specified by:
      match in class AbstractPatternPanel
    • updateMatchRule

      public void updateMatchRule()
      set's the PatternModel's MatchRule to the selected in combo. NOTE: this is public as an implementation side-effect! No need to ever call directly.
    • initExecutables

      protected void initExecutables()
      Description copied from class: AbstractPatternPanel
      creates and registers all "executable" actions. Meaning: the actions bound to a callback method on this. PENDING: not quite correctly factored? Name?
      Overrides:
      initExecutables in class AbstractPatternPanel
    • bind

      protected void bind()
      bind the components to the patternModel/actions.
      Overrides:
      bind in class AbstractPatternPanel
    • updateLocaleState

      protected void updateLocaleState(Locale locale)
      Updates locale-dependent state. Here: updates registered column actions' locale-dependent state.

      PENDING: Try better to find all column actions including custom additions? Or move to columnControl?

      Overrides:
      updateLocaleState in class AbstractPatternPanel
      Parameters:
      locale - the local language
      See Also:
    • initComponents

      protected void initComponents()
      create contained components.
      Overrides:
      initComponents in class AbstractPatternPanel