Class JXSearchPanel

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

    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:
    Serialized Form
    • Field Detail

      • MATCH_RULE_ACTION_COMMAND

        public static final String MATCH_RULE_ACTION_COMMAND
        The action command key.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JXSearchPanel

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

      • 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 -
      • 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