20080913, rgf

org.oorexx.misc
Class RgfFilter

java.lang.Object
  extended byjavax.swing.filechooser.FileFilter
      extended byorg.oorexx.misc.RgfFilter
All Implemented Interfaces:
java.io.FilenameFilter

public class RgfFilter
extends javax.swing.filechooser.FileFilter
implements java.io.FilenameFilter


Constructor Summary
RgfFilter(java.lang.String description)
          Constructor which accepts the description for this filter.
 
Method Summary
 boolean accept(java.io.File f)
          Method which gets invoked by javax.swing.JFrame to test the file for inclusion in the file list.
 boolean accept(java.io.File dir, java.lang.String fname)
          Method which gets invoked by java.awt.FileDialog to test the file for inclusion in the file list.
 void addExtension(java.lang.String extension)
          Allows to define the extension for files that should be included.
 java.lang.String getDescription()
          Returns the present description for the filter.
 boolean isIgnoreCase()
          Returns the present setting.
 void setDescription(java.lang.String description)
          Allows setting the description for the filter.
 void setIgnoreCase(boolean b)
          Allows setting the boolean value that controls whether the test for an existing file extension should be carried out case-insensitve (the default) or not.
 void setPattern(java.lang.String pattern)
          Set a regular expression pattern (available starting with Java 1.4).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RgfFilter

public RgfFilter(java.lang.String description)
Constructor which accepts the description for this filter.

Parameters:
description -
Method Detail

setPattern

public void setPattern(java.lang.String pattern)
Set a regular expression pattern (available starting with Java 1.4). If file extensions were set (cf. addExtension(String extension)), it is invalidated after invocation of this method, ie. it will not get used anymore.

Parameters:
pattern - regular expression pattern (java.util.regex.Pattern, since Java 1.4)

getDescription

public java.lang.String getDescription()
Returns the present description for the filter.


setDescription

public void setDescription(java.lang.String description)
Allows setting the description for the filter.

Parameters:
description -

accept

public boolean accept(java.io.File f)
Method which gets invoked by javax.swing.JFrame to test the file for inclusion in the file list.

Parameters:
f - the file object to test
Returns:
true, if the file should be included in the file list, false else

accept

public boolean accept(java.io.File dir,
                      java.lang.String fname)
Method which gets invoked by java.awt.FileDialog to test the file for inclusion in the file list.

Specified by:
accept in interface java.io.FilenameFilter
Parameters:
dir - the directory of the file
fname - the file's name
Returns:
true, if the file should be included in the file list, false else

addExtension

public void addExtension(java.lang.String extension)
Allows to define the extension for files that should be included. If you accept multiple extensions, then invoke this method accordingly, each time with a different file extension you want to accept. If a regular pattern expression was set (cf. (String pattern)), it is invalidated after invocation of this method, ie. it will not get used anymore.

Parameters:
extension - the file extension without any wild cards

setIgnoreCase

public void setIgnoreCase(boolean b)
Allows setting the boolean value that controls whether the test for an existing file extension should be carried out case-insensitve (the default) or not.

Parameters:
b - if true, then ignore case in comparisons

isIgnoreCase

public boolean isIgnoreCase()
Returns the present setting.

Returns:
true, if comparisons are carried out case insensitively, false else

20080913, rgf