public class SnapFileFilter extends FileFilter
FileFilter with file extensions support.| Modifier and Type | Class and Description |
|---|---|
static class |
SnapFileFilter.FileSelectionMode
File selection modes.
|
| Constructor and Description |
|---|
SnapFileFilter() |
SnapFileFilter(String formatName,
String[] extensions,
String description) |
SnapFileFilter(String formatName,
String extension,
String description) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(File file)
Tests whether or not the given file is accepted by this filter.
|
boolean |
checkExtension(File file)
Utility method which checks the extension the given file.
|
boolean |
checkExtension(String filename)
Utility method which checks the extension the given filename.
|
static boolean |
checkExtensions(String filename,
String[] extensions)
Utility method which checks the extension the given filename.
|
boolean |
equals(Object o) |
String |
getDefaultExtension()
Returns the default extension.
|
String |
getDescription()
Returns the description of this filter.
|
String[] |
getExtensions()
Returns the accepted extensions of this filter.
|
SnapFileFilter.FileSelectionMode |
getFileSelectionMode()
Gets the file selection mode for the
JFileChooser if this filter is used. |
String |
getFormatName() |
static <T extends ProductIOPlugIn> |
getSortedFileFilters(Iterator<T> pluginIterator)
Return a alphabetically sorted list of file filters originating from a productIO plugin iterator.
|
boolean |
hasExtensions()
Returns whether or not this file filter has extensions.
|
int |
hashCode() |
boolean |
isCompoundDocument(File dir)
Checks if the given directory represents a compound document.
|
void |
setDescription(String description)
Returns the description of this filter.
|
void |
setExtensions(String[] extensions)
Sets the accepted extensions of this filter.
|
void |
setFormatName(String formatName) |
public String getFormatName()
public void setFormatName(String formatName)
public boolean hasExtensions()
true if sopublic String getDefaultExtension()
getExtensions method.null if no extensions have bees specified.getExtensions()public String[] getExtensions()
{".jpg", ".gif", ".png"}.setExtensions(java.lang.String[])public void setExtensions(String[] extensions)
{".jpg", ".gif", ".png"}.extensions - The array of extensions.getExtensions()public String getDescription()
"JPEG Images (*.jpg,*.jpeg)".getDescription in class FileFilterFileView.getTypeDescription(java.io.File)public void setDescription(String description)
"JPEG Images (*.jpg,*.jpeg)". If the extension
list is missing in the description text, it is automatically appended.description - The description, must not be null.getDescription()public boolean checkExtension(File file)
file - the filetrue if the given file path ends with one of the registered extensions, false
otherwise.public boolean checkExtension(String filename)
filename - the file nametrue if the given file name ends with one of the registered extensions, false
otherwise.public static boolean checkExtensions(String filename, String[] extensions)
filename - the file nameextensions - the extensiontrue if the given file name ends with one of the registered extensions, false
otherwise.public boolean accept(File file)
true if the given file is a directory or the path string ends with one of the registered extensions.
if no extension are defined, the method always returns trueaccept in class FileFilterfile - the file to be or not be accepted.true if given file is accepted by this filterpublic boolean isCompoundDocument(File dir)
JFileChooser.
The default implementation returns false.
Clients may override.dir - The directory to check.true If the given directory represents a compound document.public SnapFileFilter.FileSelectionMode getFileSelectionMode()
JFileChooser if this filter is used.
The default implementation returns SnapFileFilter.FileSelectionMode.FILES_ONLY.
Clients may override.true if the user can also select directories using this filter.public static <T extends ProductIOPlugIn> List<SnapFileFilter> getSortedFileFilters(Iterator<T> pluginIterator)
pluginIterator - a productIO plugin iteratorCopyright © 2014–2017 European Space Agency (ESA). All rights reserved.