org.opensourcephysics.media.core
Class VideoFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by org.opensourcephysics.media.core.VideoFileFilter
All Implemented Interfaces:
java.lang.Comparable<VideoFileFilter>

public class VideoFileFilter
extends javax.swing.filechooser.FileFilter
implements java.lang.Comparable<VideoFileFilter>

This is a FileFilter that accepts video files. Filters for single container types (eg, gif, mov, avi, mp4, etc) are created by specifying the container type and one or more extensions in the constructor. The no-arg constructor creates a filter that accepts all container types in the collection VideoIO.singleVideoTypeFilters.

Version:
1.0
Author:
Douglas Brown

Constructor Summary
VideoFileFilter()
          No-arg constructor.
VideoFileFilter(java.lang.String containerType, java.lang.String[] extensions)
          Constructor with container type and accepted file extensions.
 
Method Summary
 boolean accept(java.io.File f)
          Accepts directories and files with extensions specified in constructor, or (no-arg constructor) with any extension in VideoIO.singleVideoTypeFilters.
 int compareTo(VideoFileFilter filter)
          Compares this filter to another.
 java.lang.String getContainerType()
          Gets the container type.
 java.lang.String getDefaultExtension()
          Gets the default extension to suggest when saving.
 java.lang.String getDescription()
          Gets a description of the file types accepted by this filter.
 java.lang.String[] getExtensions()
          Gets all extensions accepted by this filter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VideoFileFilter

public VideoFileFilter()
No-arg constructor. Will accept all types in VideoIO.singleVideoTypeFilters


VideoFileFilter

public VideoFileFilter(java.lang.String containerType,
                       java.lang.String[] extensions)
Constructor with container type and accepted file extensions.

Parameters:
containerType - the container type (eg "mov" or "jpg")
extensions - array of accepted extensions
Method Detail

accept

public boolean accept(java.io.File f)
Accepts directories and files with extensions specified in constructor, or (no-arg constructor) with any extension in VideoIO.singleVideoTypeFilters.

Specified by:
accept in class javax.swing.filechooser.FileFilter
Parameters:
f - the file
Returns:
true if accepted

getDescription

public java.lang.String getDescription()
Gets a description of the file types accepted by this filter.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter
Returns:
the description

getDefaultExtension

public java.lang.String getDefaultExtension()
Gets the default extension to suggest when saving.

Returns:
the default extension

getExtensions

public java.lang.String[] getExtensions()
Gets all extensions accepted by this filter.

Returns:
array of extensions

getContainerType

public java.lang.String getContainerType()
Gets the container type.

Returns:
the container type

compareTo

public int compareTo(VideoFileFilter filter)
Compares this filter to another. Implements Comparable. This compares them alphabetically by description.

Specified by:
compareTo in interface java.lang.Comparable<VideoFileFilter>
Parameters:
filter - the filter to compare
Returns:
the comparison of their descriptions