Package kiyut.sketsa.io

## Class DefaultFileFilter

- java.lang.Object
- - javax.swing.filechooser.FileFilter
  - - kiyut.sketsa.io.DefaultFileFilter

- Direct Known Subclasses:
    `SVGFileFilter`

      public class DefaultFileFilter
      extends FileFilter

  Defaulft File Filter
  Author:
    Kiyut

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected String` | `description` |
    `protected List<String>` | `filters` |
    `protected String` | `fullDescription` |
    `protected static String` | `HIDDEN_FILE` |
    `protected static String` | `TYPE_UNKNOWN` |
    `protected boolean` | `useExtensionsInDescription` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultFileFilter()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `accept​(File f)` |
    `void` | `addExtension​(String extension)` | Adds a filetype "dot" extension to filter against.
    `String` | `getDescription()` | Returns the human readable description of this filter.
    `boolean` | `isExtensionListInDescription()` | Returns whether the extension list (.jpg, .gif, etc) should show up in the human readable description.
    `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`

- - ### Field Detail

    - #### TYPE_UNKNOWN

          protected static final String TYPE_UNKNOWN

      See Also:
        Constant Field Values

    - #### HIDDEN_FILE

          protected static final String HIDDEN_FILE

      See Also:
        Constant Field Values

    - #### filters

          protected List<String> filters

    - #### description

          protected String description

    - #### fullDescription

          protected String fullDescription

    - #### useExtensionsInDescription

          protected boolean useExtensionsInDescription

  - ### Constructor Detail

    - #### DefaultFileFilter

          public DefaultFileFilter()

  - ### Method Detail

    - #### accept

          public boolean accept​(File f)

      Specified by:
        `accept` in class `FileFilter`

    - #### 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":

             ExampleFileFilter filter = new ExampleFileFilter();
             filter.addExtension("jpg");
             filter.addExtension("tif");

      Note that the "." before the extension is not needed and will be ignored.
      Parameters:
        `extension` - the file extension

    - #### getDescription

          public String getDescription()

      Returns the human readable description of this filter. For example: "JPEG and GIF Image Files (*.jpg, *.gif)"
      Specified by:
        `getDescription` in class `FileFilter`
      Returns:
        description
      See Also:
        `setDescription(java.lang.String)`, `setExtensionListInDescription(boolean)`, `isExtensionListInDescription()`

    - #### setDescription

          public void setDescription​(String description)

      Sets the human readable description of this filter. For example: filter.setDescription("Gif and JPG Images");
      Parameters:
        `description` - description
      See Also:
        `setDescription(java.lang.String)`, `setExtensionListInDescription(boolean)`, `isExtensionListInDescription()`

    - #### 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` - true or false
      See Also:
        `getDescription()`, `setDescription(java.lang.String)`, `isExtensionListInDescription()`

    - #### 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();
      Returns:
        true or false
      See Also:
        `getDescription()`, `setDescription(java.lang.String)`, `setExtensionListInDescription(boolean)`