bb.io.filefilter
Class VisibleOrRootFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by bb.io.filefilter.BaseFilter
          extended by bb.io.filefilter.VisibleFilter
              extended by bb.io.filefilter.VisibleOrRootFilter
All Implemented Interfaces:
FileFilter

public class VisibleOrRootFilter
extends VisibleFilter

Subclass of VisibleFilter that additionally accepts Files which are system roots. This filter was introduced because it has been observed that Windows (XP, on NTFS disks, at least) marks roots as hidden.

This class is multithread safe: it is immutable (all of its fields are final, none of their state can be changed after construction, and it is always properly constructed; see p. 53 of Java Concurrency In Practice for more discussion).

Author:
Brent Boyer

Nested Class Summary
 
Nested classes/interfaces inherited from class bb.io.filefilter.BaseFilter
BaseFilter.UnitTest
 
Constructor Summary
VisibleOrRootFilter()
          Constructs a new VisibleOrRootFilter instance.
 
Method Summary
 String getDescription()
          
private  boolean isRootFile(File file)
           
protected  boolean passesTest(File file)
          Applies this filter's test to file.
 
Methods inherited from class bb.io.filefilter.BaseFilter
accept, acceptImpl, extractPart, getDirectoryMode, getFileMode, getListener, getOtherMode, getPartMode, passesTest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisibleOrRootFilter

public VisibleOrRootFilter()
Constructs a new VisibleOrRootFilter instance.

Method Detail

passesTest

protected boolean passesTest(File file)
Description copied from class: BaseFilter
Applies this filter's test to file.

Implementation here returns passesTest( extractPart(file) ).

Overrides:
passesTest in class VisibleFilter

isRootFile

private boolean isRootFile(File file)

getDescription

public String getDescription()
Description copied from class: BaseFilter

Overrides:
getDescription in class VisibleFilter