Class FileExtensionFilter
- java.lang.Object
-
- net.sf.jguiraffe.gui.dlg.filechooser.FileExtensionFilter
-
public final class FileExtensionFilter extends Object
A class representing an extension filter that can be used together with the file chooser service.
When defining the options to show a file chooser dialog an arbitrary number of objects of this class can be specified. Each filter represents a specific file type and can be configured with the corresponding file extensions, such as
"Image files"; "gif", "jpeg", "jpg", "png"
. The user is displayed a list with all pre-configured extension filters; when selecting a specific one, only the files matched by the filter are visible. (When providing a file extension do not prepend a separator character or a wildcard, such as*.txt
; just use the plain extensiontxt
).The description of the filter is displayed to the user. It can be defined as a
TextResource
object, i.e. either as plain text or via a resource ID.Instances of this class are immutable.
- Since:
- 1.4
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXT_ALL_FILES
Constant for a special extension with the meaning that all files should be matched.
-
Constructor Summary
Constructors Constructor Description FileExtensionFilter(TextResource descResource, String... extensions)
Creates a new instance ofFileExtensionFilter
and sets the resource for a description and the single file extensions to be matched by this filter.FileExtensionFilter(TextResource descResource, List<String> extList)
Creates a new instance ofFileExtensionFilter
and sets the resource for a description and a collection with the file extensions to be matched by this filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Two instances of this class are considered equals if all of their properties are equal.TextResource
getDescription()
Returns theTextResource
for the filter description.List<String>
getExtensions()
Returns a (unmodifiable) list with the file extensions assigned to this filter.int
hashCode()
String
toString()
-
-
-
Field Detail
-
EXT_ALL_FILES
public static final String EXT_ALL_FILES
Constant for a special extension with the meaning that all files should be matched. This extension should be specified for an "All files" filter.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FileExtensionFilter
public FileExtensionFilter(TextResource descResource, List<String> extList)
Creates a new instance ofFileExtensionFilter
and sets the resource for a description and a collection with the file extensions to be matched by this filter.- Parameters:
descResource
- the resource for the filter descriptionextList
- a list with file extensions
-
FileExtensionFilter
public FileExtensionFilter(TextResource descResource, String... extensions)
Creates a new instance ofFileExtensionFilter
and sets the resource for a description and the single file extensions to be matched by this filter.- Parameters:
descResource
- the resource for the filter descriptionextensions
- the file extensions
-
-
Method Detail
-
getDescription
public TextResource getDescription()
Returns theTextResource
for the filter description.- Returns:
- the resource for the filter description
-
getExtensions
public List<String> getExtensions()
Returns a (unmodifiable) list with the file extensions assigned to this filter.- Returns:
- a collection with file extensions
-
equals
public boolean equals(Object o)
Two instances of this class are considered equals if all of their properties are equal.
-
-