Package hdf.view

Class 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 Detail

      • 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 on
        description - 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 names
        description - 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();