Object
hdf.view.DefaultFileFilter
public class DefaultFileFilter extends Object
A convenience implementation of FileFilter that filters out all files except
for those type extensions that it knows about.
- Version:
- 2.4 4/27/2016
- Author:
- Jordan T. Henderson
-
Constructor Summary
Constructors Constructor Description DefaultFileFilter()
Creates a file filter.DefaultFileFilter(String extension)
Creates a file filter that accepts files with the given extension.DefaultFileFilter(String[] filters)
Creates a file filter from the given string array.DefaultFileFilter(String[] filters, String description)
Creates a file filter from the given string array and description.DefaultFileFilter(String extension, String description)
Creates a file filter that accepts the given file type. -
Method Summary
Modifier and Type Method Description void
addExtension(String extension)
Adds a filetype "dot" extension to filter against.String
getDescription()
String
getExtensions()
static DefaultFileFilter
getFileFilter()
static DefaultFileFilter
getFileFilterBinary()
static DefaultFileFilter
getFileFilterBMP()
static DefaultFileFilter
getFileFilterGIF()
static DefaultFileFilter
getFileFilterHDF4()
static DefaultFileFilter
getFileFilterHDF5()
static DefaultFileFilter
getFileFilterJPEG()
static DefaultFileFilter
getFileFilterNetCDF3()
static DefaultFileFilter
getFileFilterPNG()
static DefaultFileFilter
getFileFilterText()
static DefaultFileFilter
getFileFilterTIFF()
static DefaultFileFilter
getImageFileFilter()
boolean
isExtensionListInDescription()
void
setDescription(String description)
Sets the human readable description of this filter.void
setExtensionListInDescription(boolean b)
Determines whether the extension list (.jpg, .gif, etc) should show up in the human readable description.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DefaultFileFilter
public DefaultFileFilter()Creates a file filter. If no filters are added, then all files are accepted.- See Also:
addExtension(java.lang.String)
-
DefaultFileFilter
Creates a file filter that accepts files with the given extension. Example: new DefaultFileFilter("jpg");- Parameters:
extension
- the file extension to filter on- See Also:
addExtension(java.lang.String)
-
DefaultFileFilter
Creates a file filter that accepts the given file type. Example: new DefaultFileFilter("jpg", "JPEG Image Images"); Note that the "." before the extension is not needed. If provided, it will be ignored.- Parameters:
extension
- the file extension to filter ondescription
- the file extension full description- See Also:
addExtension(java.lang.String)
-
DefaultFileFilter
Creates a file filter from the given string array. Example: new DefaultFileFilter(String {"gif", "jpg"}); Note that the "." before the extension is not needed and will be ignored.- Parameters:
filters
- the list of filter names- See Also:
addExtension(java.lang.String)
-
DefaultFileFilter
Creates a file filter from the given string array and description. Example: new DefaultFileFilter(String {"gif", "jpg"}, "Gif and JPG Images"); Note that the "." before the extension is not needed and will be ignored.- Parameters:
filters
- the list of filter namesdescription
- the name of the filter list- See Also:
addExtension(java.lang.String)
-
-
Method Details
-
getExtensions
- Returns:
- the file extensions associated with this DefaultFileFilter
-
addExtension
Adds a filetype "dot" extension to filter against. For example: the following code will create a filter that filters out all files except those that end in ".jpg" and ".tif": DefaultFileFilter filter = new DefaultFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif"); or filter.addExtension("jpg, tif"); Note that the "." before the extension is not needed and will be ignored.- Parameters:
extension
- the file extension to add to the file filter
-
getDescription
- Returns:
- the human readable description of this filter. For example: "JPEG and GIF Image Files (*.jpg, *.gif)"
-
setDescription
Sets the human readable description of this filter. For example: filter.setDescription("Gif and JPG Images");- Parameters:
description
- the full description of the file filter
-
setExtensionListInDescription
Determines whether the extension list (.jpg, .gif, etc) should show up in the human readable description. Only relevent if a description was provided in the constructor or using setDescription();- Parameters:
b
- the show state of the extension list
-
isExtensionListInDescription
- Returns:
- whether the extension list (.jpg, .gif, etc) should show up in the human readable description. Only relevent if a description was provided in the constructor or using setDescription();
-
getFileFilter
- Returns:
- a file filter for HDF4/5 file.
-
getFileFilterNetCDF3
- Returns:
- a file filter for NetCDF3 file.
-
getFileFilterHDF4
- Returns:
- a file filter for HDF4 file.
-
getFileFilterHDF5
- Returns:
- a file filter for HDF5 file.
-
getFileFilterJPEG
- Returns:
- a file filter for JPEG image files.
-
getFileFilterTIFF
- Returns:
- a file filter for TIFF image files.
-
getFileFilterPNG
- Returns:
- a file filter for PNG image files.
-
getFileFilterBMP
- Returns:
- a file filter for BMP image files.
-
getFileFilterGIF
- Returns:
- a file filter for GIF image files.
-
getImageFileFilter
- Returns:
- a file filter for GIF, JPEG, BMP, or PNG image files.
-
getFileFilterText
- Returns:
- a file filter for text file.
-
getFileFilterBinary
- Returns:
- a file filter for binary file.
-