001 // License: GPL. For details, see LICENSE file.
002 package org.openstreetmap.josm.io.session;
003
004 import java.awt.Component;
005 import java.io.IOException;
006 import java.util.Collection;
007
008 import org.w3c.dom.Element;
009
010 import org.openstreetmap.josm.gui.layer.Layer;
011 import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
012
013 public 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