FreeHEP API
Version current

org.freehep.util.export
Class ExportFileType

java.lang.Object
  extended byorg.freehep.util.export.ExportFileType
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
AbstractExportFileType

public abstract class ExportFileType
extends Object
implements Comparable

Objects which extend this class provide enough functionality to provide an output file type for the ExportDialog.

Version:
$Id: ExportFileType.java,v 1.10 2005/01/10 21:54:56 duns Exp $
Author:
Charles Loomis, Mark Donszelmann
Source Code:
ExportFileType.java

Constructor Summary
ExportFileType()
           
 
Method Summary
static File adjustExtension(File file, String preferredExtension, String[] acceptableExtensions)
          Deprecated. use adjustExtension(File, String, String[], String)
static File adjustExtension(File file, String preferredExtension, String[] acceptableExtensions, String extension)
          Change the extension of a file if it is not of the appropriate type.
 File adjustFilename(File file, Properties properties)
          Gives the accessory the chance to change the output filename.
 File adjustFilename(File file, String extension, Properties properties)
          Gives the accessory the chance to change the output filename.
 boolean applyChangedOptions(JPanel optionPanel, Properties options)
          Sets any changed options from the optionPanel to the properties object.
static boolean checkExtension(File file, String[] acceptableExtensions)
          A utility function that checks a file's extension.
 int compareTo(Object o)
          Compares to other exportfiletype in alphabetical order on the description string.
 JPanel createOptionPanel(Properties options)
          Returns a panel which allows to user to set options associated with this particular output format.
abstract  void exportToFile(File file, Component[] target, Component parent, Properties properties, String creator)
          Writes the all given components out in the format of this file type.
 void exportToFile(File file, Component target, Component parent, Properties properties, String creator)
          Writes the given component out in the format of this file type.
abstract  void exportToFile(OutputStream os, Component[] target, Component parent, Properties properties, String creator)
          Writes the all given components out in the format of this file type.
 void exportToFile(OutputStream os, Component target, Component parent, Properties properties, String creator)
          Writes the given component out in the format of this file type.
 boolean fileHasValidExtension(File file)
          This method returns true if the given file has an extension which can be handled by this file type.
abstract  String getDescription()
          Returns a short description of the format
static List getExportFileTypes()
          Return all registered ExportFileTypes
static List getExportFileTypes(String format)
          Return all registered ExportFileTypes for a certain format.
static String getExtension(File file, String[] acceptableExtensions)
          Returns the file's (longest) valid extension (ps, eps, heprep.zip), or "".
abstract  String[] getExtensions()
          Returns an array of possible extensions for the format, the first of which is the preferred extension
 String getFileExtension(File file)
          Returns the longest valid extension on this filename, or "".
 FileFilter getFileFilter()
          Returns a file filter which selects only those files which correspond to a particular file type.
abstract  String[] getMIMETypes()
          Return the MIME-type(s) for this format, the first of which is the preferred MIME type.
 boolean hasOptionPanel()
          Returns true if this format has extra options.
 boolean isMultipageCapable()
          Returns true if this ExportFileType can handle multipage output.
static void setClassLoader(ClassLoader loader)
          Sets the classloader to be used for loading ExportFileTypes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExportFileType

public ExportFileType()
Method Detail

getDescription

public abstract String getDescription()
Returns a short description of the format


getExtensions

public abstract String[] getExtensions()
Returns an array of possible extensions for the format, the first of which is the preferred extension


getMIMETypes

public abstract String[] getMIMETypes()
Return the MIME-type(s) for this format, the first of which is the preferred MIME type.


exportToFile

public void exportToFile(OutputStream os,
                         Component target,
                         Component parent,
                         Properties properties,
                         String creator)
                  throws IOException
Writes the given component out in the format of this file type.

Throws:
IOException

exportToFile

public void exportToFile(File file,
                         Component target,
                         Component parent,
                         Properties properties,
                         String creator)
                  throws IOException
Writes the given component out in the format of this file type.

Throws:
IOException

exportToFile

public abstract void exportToFile(OutputStream os,
                                  Component[] target,
                                  Component parent,
                                  Properties properties,
                                  String creator)
                           throws IOException
Writes the all given components out in the format of this file type.

Throws:
IOException

exportToFile

public abstract void exportToFile(File file,
                                  Component[] target,
                                  Component parent,
                                  Properties properties,
                                  String creator)
                           throws IOException
Writes the all given components out in the format of this file type.

Throws:
IOException

compareTo

public int compareTo(Object o)
Compares to other exportfiletype in alphabetical order on the description string.

Specified by:
compareTo in interface Comparable

hasOptionPanel

public boolean hasOptionPanel()
Returns true if this format has extra options.


createOptionPanel

public JPanel createOptionPanel(Properties options)
Returns a panel which allows to user to set options associated with this particular output format.


applyChangedOptions

public boolean applyChangedOptions(JPanel optionPanel,
                                   Properties options)
Sets any changed options from the optionPanel to the properties object.

Returns:
true if any options were set.

getFileFilter

public FileFilter getFileFilter()
Returns a file filter which selects only those files which correspond to a particular file type.


adjustFilename

public File adjustFilename(File file,
                           Properties properties)
Gives the accessory the chance to change the output filename. In particular, to change the extension to match the output file format.


adjustFilename

public File adjustFilename(File file,
                           String extension,
                           Properties properties)
Gives the accessory the chance to change the output filename. In particular, to change the extension to match the output file format.


getFileExtension

public String getFileExtension(File file)
Returns the longest valid extension on this filename, or "".


fileHasValidExtension

public boolean fileHasValidExtension(File file)
This method returns true if the given file has an extension which can be handled by this file type.


isMultipageCapable

public boolean isMultipageCapable()
Returns true if this ExportFileType can handle multipage output. The default implementation return false;


setClassLoader

public static void setClassLoader(ClassLoader loader)
Sets the classloader to be used for loading ExportFileTypes


getExportFileTypes

public static List getExportFileTypes()
Return all registered ExportFileTypes


getExportFileTypes

public static List getExportFileTypes(String format)
Return all registered ExportFileTypes for a certain format. Format may be null, in which case all ExportFileTypes are returned.


getExtension

public static String getExtension(File file,
                                  String[] acceptableExtensions)
Returns the file's (longest) valid extension (ps, eps, heprep.zip), or "".


checkExtension

public static boolean checkExtension(File file,
                                     String[] acceptableExtensions)
A utility function that checks a file's extension.


adjustExtension

public static File adjustExtension(File file,
                                   String preferredExtension,
                                   String[] acceptableExtensions)
Deprecated. use adjustExtension(File, String, String[], String)

Change the extension of a file if it is not of the appropriate type.


adjustExtension

public static File adjustExtension(File file,
                                   String preferredExtension,
                                   String[] acceptableExtensions,
                                   String extension)
Change the extension of a file if it is not of the appropriate type.

Parameters:
extension - ext to be removed.

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.