package CH.ifa.draw.io.exportFormats;

import java.io.File;
import javax.swing.filechooser.FileFilter;

import de.renew.draw.storables.ontology.Drawing;


/**
 * This interface must be implemented to define new ExportFormats.
 * @deprecated This type is not to be used anymore. Please use {@link de.renew.ioontology.exporting.ExportFormat} and its subtypes instead.
 */
@Deprecated(since = "5.0", forRemoval = true)
public interface ExportFormat {

    /**
      * Returns a name for the ExportFormat, e.g. PNML.
      * @ensure result != null.
      * @return String, the Name of the ExportFormat.
      */
    public String formatName();


    /**
      * Returns the FileFilter for the ExportFormat.
      * @ensure result != null.
      * @return FileFilter, the FileFilter for the ExportFormat.
      */
    public FileFilter fileFilter();

    /**
      * Converts a drawing into a file (1 to 1 export).
      * @require path != null.
      * @require drawing != null.
      * @ensure result != null.
      * @throws Exception to be caught by the ExportHolder.
      * @param drawing drawing to be exported.
      * @param file file name to export to.
      * @return TODO
      */
    public File export(Drawing drawing, File file) throws Exception;

    /**
      * Converts an array of drawings into a file (n to 1 export).
      * @require path != null.
      * @require drawings != null.
      * @require drawings.length > 0
      * @require canExportNto1()
      * @ensure result != null.
      * @throws Exception to be caught by the ExportHolder.
      * @param drawings array of drawings to be exported.
      * @param file file name to export to.
      * @return TODO
      */
    public File export(Drawing[] drawings, File file) throws Exception;

    /**
      * Converts an array of drawings into an array of files (n to n export).
      * @require path != null.
      * @require path.length > 0
      * @require drawings != null.
      * @require drawings.length > 0
      * @require drawings.length == path.length
      * @ensure result != null.
      * @throws Exception to be caught by the ExportHolder.
      * @param drawings array of drawings to be exported.
      * @param files array of file names to export to.
      * @return TODO
      */
    public File[] exportAll(Drawing[] drawings, File[] files) throws Exception;

    /**
     * Tells whether this <code>ExportFormat</code> supports files that comprise
     * multiple drawings.
     * @return  <code>true</code> if this format can generate files
     *          including multiple drawings.
     *          Returns <code>false</code>, otherwise.
     */
    public boolean canExportNto1();

    /**
     * Tells whether this <code>ExportFormat</code> can export to a file
     * named <code>path</code>.
     * @param path  the file name of the exported drawing.
     * @return  <code>true</code>, if <code>path</code> is an allowed file
     *          name for this export format.
     *          Returns <code>false</code>, otherwise.
     */
    public ExportFormat[] canExport(File path);

    /**
     * Tells whether this <code>ExportFormat</code> can export the given
     * <code>drawing</code>.
     * @param drawing  the drawing of question.
     * @return  <code>true</code>, if this export format can handle the
     *          given <code>drawing</code>.
     *          Returns <code>false</code>, otherwise.
     */
    public boolean canExportDrawing(Drawing drawing);

    /**
     * Returns the AWT shortcut key that would be appropriate when
     * including this <code>ExportFormat</code> in a menu.
     * @return  the <code>int</code> code of the shortcut key for the export
     *          menu entry associated with this format.
     *          Returns <code>-1</code> if no shortcut is desired.
     */
    public int getShortCut();


    /**
     * Returns the AWT modifier key code.
     * Use {@link java.awt.Toolkit#getMenuShortcutKeyMask} for Ctrl. Key.
     * {@link javax.swing.KeyStroke}
     * {@link java.awt.Toolkit}
     *
     * @return the <code>int</code> code of the modifier key for the export
     *          menu entry associated with this format.
     *          Returns <code>-1</code> if no shortcut is desired.
     */
    public int getModifier();

    /**
     * Returns boolean if a given name is to be forced.
     *
     * @return allowance if the given name will be forced
     */
    public boolean forceGivenName();
}