org.jdesktop.swing.decorator
Class PatternFilter

java.lang.Object
  extended byorg.jdesktop.swing.decorator.Filter
      extended byorg.jdesktop.swing.decorator.PatternFilter
All Implemented Interfaces:
PatternMatcher

public class PatternFilter
extends Filter
implements PatternMatcher

Pluggable pattern filter.


Field Summary
protected  Pattern pattern
           
 
Fields inherited from class org.jdesktop.swing.decorator.Filter
adapter
 
Constructor Summary
PatternFilter()
           
PatternFilter(String regularExpr, int matchFlags, int col)
           
 
Method Summary
protected  void filter()
          Performs the filter operation defined by this filter.
protected  void generateMappingFromPrevious()
          Generates the row mappings from the previous filter to this filter.
 Pattern getPattern()
          Returns the pattern used by this filter for matching.
 int getSize()
          Returns the number of records that remain in this filter's "view" after the input records have been filtered.
protected  void init()
          Provides filter-specific initialization.
protected  void reset()
          Resets the internal row mappings from this filter to the previous filter.
 void setPattern(Pattern pattern)
          Sets the pattern used by this filter for matching.
 void setPattern(String regularExpr, int matchFlags)
           
 boolean test(int row)
           
protected  int translateFromPreviousFilter(int row)
          Returns the row in this filter that maps to the specified row in the previous filter.
protected  int translateToPreviousFilter(int row)
          Returns the row in the previous filter that maps to the specified row in this filter.
 
Methods inherited from class org.jdesktop.swing.decorator.Filter
convertRowIndexToModel, convertRowIndexToView, getColumnIndex, getColumnName, getInputSize, getInputValue, getPipeline, getValueAt, isCellEditable, refresh, refresh, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pattern

protected Pattern pattern
Constructor Detail

PatternFilter

public PatternFilter()

PatternFilter

public PatternFilter(String regularExpr,
                     int matchFlags,
                     int col)
Method Detail

init

protected void init()
Description copied from class: Filter
Provides filter-specific initialization. Called from the Filter constructor.

Specified by:
init in class Filter

setPattern

public void setPattern(String regularExpr,
                       int matchFlags)

setPattern

public void setPattern(Pattern pattern)
Sets the pattern used by this filter for matching.

Specified by:
setPattern in interface PatternMatcher
Parameters:
pattern - the pattern used by this filter for matching
See Also:
Pattern

getPattern

public Pattern getPattern()
Returns the pattern used by this filter for matching.

Specified by:
getPattern in interface PatternMatcher
Returns:
the pattern used by this filter for matching
See Also:
Pattern

reset

protected void reset()
Resets the internal row mappings from this filter to the previous filter.

Specified by:
reset in class Filter

generateMappingFromPrevious

protected void generateMappingFromPrevious()
Generates the row mappings from the previous filter to this filter.

Specified by:
generateMappingFromPrevious in class Filter

filter

protected void filter()
Description copied from class: Filter
Performs the filter operation defined by this filter.

Specified by:
filter in class Filter

test

public boolean test(int row)

getSize

public int getSize()
Description copied from class: Filter
Returns the number of records that remain in this filter's "view" after the input records have been filtered.

Specified by:
getSize in class Filter
Returns:
the number of records that remain in this filter's "view" after the input records have been filtered

translateFromPreviousFilter

protected int translateFromPreviousFilter(int row)
Returns the row in this filter that maps to the specified row in the previous filter. If there is no previous filter in the pipeline, this returns the row in this filter that maps to the specified row in the data model. This method is called from convertRowIndexToView

Specified by:
translateFromPreviousFilter in class Filter
Parameters:
row - a row index in the previous filter's "view" of the data model
Returns:
the row in this filter that maps to the specified row in the previous filter

translateToPreviousFilter

protected int translateToPreviousFilter(int row)
Returns the row in the previous filter that maps to the specified row in this filter. If there is no previous filter in the pipeline, this returns the row in the data model that maps to the specified row in this filter. This method is called from convertRowIndexToModel

Specified by:
translateToPreviousFilter in class Filter
Parameters:
row - a row index in this filter's "view" of the data model
Returns:
the row in the previous filter that maps to the specified row in this filter


Copyright 2004 by Sun Microsystems, Inc. All Rights Reserved.