com.alee.utils.filefilter
Class GroupedFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by com.alee.utils.filefilter.AbstractFileFilter
          extended by com.alee.utils.filefilter.GroupedFileFilter
All Implemented Interfaces:
Filter<java.io.File>, java.io.FileFilter

public class GroupedFileFilter
extends AbstractFileFilter

This file filter groups specified file filters in a certain way defined by filter group type.

Author:
Mikle Garin

Field Summary
protected  AbstractFileFilter defaultFilter
          Default file filter used to display icon and description.
protected  FilterGroupType filterGroupType
          The way file filters will be grouped.
protected  java.util.List<java.io.FileFilter> filters
          List of grouped file filters.
 
Constructor Summary
GroupedFileFilter(AbstractFileFilter defaultFilter, FilterGroupType filterGroupType, java.io.FileFilter... filters)
          Constructs grouped file filter with the specified parameters.
GroupedFileFilter(java.io.FileFilter... filters)
          Constructs grouped file filter with the specified parameters.
GroupedFileFilter(FilterGroupType filterGroupType, java.io.FileFilter... filters)
          Constructs grouped file filter with the specified parameters.
 
Method Summary
 boolean accept(java.io.File file)
          Returns whether the given file is accepted by this filter or not.
 java.lang.String getDescription()
          Returns short file filter description.
 javax.swing.ImageIcon getIcon()
          Returns file filter icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterGroupType

protected FilterGroupType filterGroupType
The way file filters will be grouped.


defaultFilter

protected AbstractFileFilter defaultFilter
Default file filter used to display icon and description.


filters

protected java.util.List<java.io.FileFilter> filters
List of grouped file filters.

Constructor Detail

GroupedFileFilter

public GroupedFileFilter(java.io.FileFilter... filters)
Constructs grouped file filter with the specified parameters.

Parameters:
filters - list of file filters to be grouped

GroupedFileFilter

public GroupedFileFilter(FilterGroupType filterGroupType,
                         java.io.FileFilter... filters)
Constructs grouped file filter with the specified parameters.

Parameters:
filterGroupType - the way file filters will be grouped
filters - list of file filters to be grouped

GroupedFileFilter

public GroupedFileFilter(AbstractFileFilter defaultFilter,
                         FilterGroupType filterGroupType,
                         java.io.FileFilter... filters)
Constructs grouped file filter with the specified parameters.

Parameters:
defaultFilter - default file filter used to display icon and description
filterGroupType - the way file filters will be grouped
filters - list of file filters to be grouped
Method Detail

getIcon

public javax.swing.ImageIcon getIcon()
Returns file filter icon.

Specified by:
getIcon in class AbstractFileFilter
Returns:
file filter icon

getDescription

public java.lang.String getDescription()
Returns short file filter description.

Specified by:
getDescription in class AbstractFileFilter
Returns:
short file filter description

accept

public boolean accept(java.io.File file)
Returns whether the given file is accepted by this filter or not.

Specified by:
accept in interface Filter<java.io.File>
Specified by:
accept in interface java.io.FileFilter
Specified by:
accept in class AbstractFileFilter
Parameters:
file - file to process
Returns:
true if the given file is accepted by this filter, false otherwise