Package hdf.view
Class DefaultFileFilter
- 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
-
-
-
Constructor Detail
-
DefaultFileFilter
public DefaultFileFilter()
Creates a file filter. If no filters are added, then all files are accepted.- See Also:
addExtension(java.lang.String)
-
DefaultFileFilter
public DefaultFileFilter(String extension)
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
public DefaultFileFilter(String extension, String description)
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
public DefaultFileFilter(String[] filters)
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
public DefaultFileFilter(String[] filters, String description)
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 Detail
-
getExtensions
public String getExtensions()
- Returns:
- the file extensions associated with this DefaultFileFilter
-
addExtension
public void addExtension(String extension)
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
public String getDescription()
- Returns:
- the human readable description of this filter. For example: "JPEG and GIF Image Files (*.jpg, *.gif)"
-
setDescription
public void setDescription(String description)
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
public void setExtensionListInDescription(boolean b)
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
public boolean 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
public static DefaultFileFilter getFileFilter()
- Returns:
- a file filter for HDF4/5 file.
-
getFileFilterNetCDF3
public static DefaultFileFilter getFileFilterNetCDF3()
- Returns:
- a file filter for NetCDF3 file.
-
getFileFilterHDF4
public static DefaultFileFilter getFileFilterHDF4()
- Returns:
- a file filter for HDF4 file.
-
getFileFilterHDF5
public static DefaultFileFilter getFileFilterHDF5()
- Returns:
- a file filter for HDF5 file.
-
getFileFilterJPEG
public static DefaultFileFilter getFileFilterJPEG()
- Returns:
- a file filter for JPEG image files.
-
getFileFilterTIFF
public static DefaultFileFilter getFileFilterTIFF()
- Returns:
- a file filter for TIFF image files.
-
getFileFilterPNG
public static DefaultFileFilter getFileFilterPNG()
- Returns:
- a file filter for PNG image files.
-
getFileFilterBMP
public static DefaultFileFilter getFileFilterBMP()
- Returns:
- a file filter for BMP image files.
-
getFileFilterGIF
public static DefaultFileFilter getFileFilterGIF()
- Returns:
- a file filter for GIF image files.
-
getImageFileFilter
public static DefaultFileFilter getImageFileFilter()
- Returns:
- a file filter for GIF, JPEG, BMP, or PNG image files.
-
getFileFilterText
public static DefaultFileFilter getFileFilterText()
- Returns:
- a file filter for text file.
-
getFileFilterBinary
public static DefaultFileFilter getFileFilterBinary()
- Returns:
- a file filter for binary file.
-
-