com.tensegrity.gui.swing.dialog.graphfilechooser
Class CustomFileFilter

java.lang.Object
  extended byjavax.swing.filechooser.FileFilter
      extended bycom.tensegrity.gui.swing.dialog.graphfilechooser.CustomFileFilter
All Implemented Interfaces:
ExtendedFileFilter
Direct Known Subclasses:
TemplatesFileFilter

public class CustomFileFilter
extends javax.swing.filechooser.FileFilter
implements ExtendedFileFilter

Generic file filter class that can be created for any file extension.

Version:
$Id: CustomFileFilter.java,v 1.11 2004/12/16 09:25:31 BurkhardWick Exp $
Author:
BurkhardWick, GillesIachelini

Field Summary
protected  UIManager uiManager
          The UIManager used to retrieve text resources
 
Constructor Summary
CustomFileFilter(int type, java.util.List extensions, UIManager uiMan)
          Constructor.
CustomFileFilter(int type, java.util.List extensions, UIManager uiMan, java.lang.String name)
          Constructor
CustomFileFilter(int type, java.lang.String[] extensions, UIManager uiMan)
          Constructor.
CustomFileFilter(int type, java.lang.String extension, UIManager uiMan)
          Constructor.
CustomFileFilter(java.lang.String[] extensions, UIManager uiMan)
          Constructor.
CustomFileFilter(java.lang.String extension, UIManager uiMan)
          Constructor.
 
Method Summary
 boolean accept(java.io.File f)
          Checks if the given file is accepted by this filter
 java.lang.String getDescription()
          Returns the description of this file filter
 java.lang.String[] getExtensionList()
          Returns an array with all valid extensions for this file type
 int getType()
          Returns the type of the file this filter belongs to.
 java.lang.String getValidFilename(java.io.File file)
          Returns a valid filename for the given file
 void openInViewer(java.io.File file)
          Opens an external viewer for the given file.
 boolean supportsOpenInViewer()
          Checks whether the file type can be opened by an external viewer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uiManager

protected UIManager uiManager
The UIManager used to retrieve text resources

Constructor Detail

CustomFileFilter

public CustomFileFilter(java.lang.String extension,
                        UIManager uiMan)
Constructor.

Parameters:
extension - The extension of this file type
uiMan - The UIManager to use to resolve resources

CustomFileFilter

public CustomFileFilter(int type,
                        java.lang.String extension,
                        UIManager uiMan)
Constructor.

Parameters:
type - The type of the file this filter belongs to
extension - The extension of this file type
uiMan - The UIManager to use to resolve resources
See Also:
GraphFileConstants

CustomFileFilter

public CustomFileFilter(java.lang.String[] extensions,
                        UIManager uiMan)
Constructor.

Parameters:
extensions - The extensions of this file type
uiMan - The UIManager to use to resolve resources

CustomFileFilter

public CustomFileFilter(int type,
                        java.lang.String[] extensions,
                        UIManager uiMan)
Constructor.

Parameters:
type - The type of the file this filter belongs to
extensions - The extensions of this file type
uiMan - The UIManager to use to resolve resources
See Also:
GraphFileConstants

CustomFileFilter

public CustomFileFilter(int type,
                        java.util.List extensions,
                        UIManager uiMan)
Constructor.

Parameters:
type - The type of the file this filter belongs to
extensions - The extensions of this file type as a List of Strings.
uiMan - The UIManager to use to resolve resources
See Also:
GraphFileConstants

CustomFileFilter

public CustomFileFilter(int type,
                        java.util.List extensions,
                        UIManager uiMan,
                        java.lang.String name)
Constructor

Parameters:
type - The type of the file this filter belongs to
extensions - The extensions of this file type as a List of Strings.
uiMan - The UIManager to use to resolve resources
name - The name of the file type
See Also:
GraphFileConstants
Method Detail

accept

public boolean accept(java.io.File f)
Checks if the given file is accepted by this filter

Parameters:
f - The file to check
Returns:
Returns true, if the file is approved

getDescription

public java.lang.String getDescription()
Returns the description of this file filter

Returns:
the description of this file filter

getValidFilename

public java.lang.String getValidFilename(java.io.File file)
Returns a valid filename for the given file

Specified by:
getValidFilename in interface ExtendedFileFilter
Parameters:
file - The file to create a valid filename for
Returns:
a valid filename for the given file

supportsOpenInViewer

public boolean supportsOpenInViewer()
Checks whether the file type can be opened by an external viewer.

Specified by:
supportsOpenInViewer in interface ExtendedFileFilter
Returns:
Returns false, because this has to be implemented in a specific file filter

getType

public int getType()
Returns the type of the file this filter belongs to.

Specified by:
getType in interface ExtendedFileFilter
Returns:
the type of the file this filter belongs to.

openInViewer

public void openInViewer(java.io.File file)
Opens an external viewer for the given file. Not implemented! Will throw an UnsupportedMethodException.

Specified by:
openInViewer in interface ExtendedFileFilter
Parameters:
file - The file to open

getExtensionList

public java.lang.String[] getExtensionList()
Description copied from interface: ExtendedFileFilter
Returns an array with all valid extensions for this file type

Specified by:
getExtensionList in interface ExtendedFileFilter
Returns:
an array with all valid extensions for this file type


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.