001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.io.session;
003
004import java.awt.Component;
005import java.io.IOException;
006import java.util.Collection;
007
008import org.w3c.dom.Element;
009
010import org.openstreetmap.josm.gui.layer.Layer;
011import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
012
013public interface SessionLayerExporter {
014
015    /**
016     * Return the Layers, this Layer depends on.
017     */
018    Collection<Layer> getDependencies();
019
020    /**
021     * The GUI for exporting this layer.
022     */
023    Component getExportPanel();
024
025    /**
026     * Return true, if the layer should be included in the
027     * list of exported layers.
028     *
029     * The user can veto this in the export panel.
030     */
031    boolean shallExport();
032
033    /**
034     * Return true, if some data needs to be included in
035     * the zip archive. This decision depends on the user
036     * selection in the export panel.
037     *
038     * If any layer requires zip, the user can only save as
039     * .joz. Otherwise both .jos and .joz are possible.
040     */
041    boolean requiresZip();
042
043    /**
044     * Save meta data to the .jos file. Return a layer XML element.
045     * Use <code>support</code> to save files in the zip archive as needed.
046     */
047    Element export(ExportSupport support) throws IOException;
048
049}
050