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.openstreetmap.josm.gui.layer.Layer; 009import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport; 010import org.w3c.dom.Element; 011 012public interface SessionLayerExporter { 013 014 /** 015 * Return the Layers, this Layer depends on. 016 * @return the layer dependencies 017 */ 018 Collection<Layer> getDependencies(); 019 020 /** 021 * The GUI for exporting this layer. 022 * @return the export panel 023 */ 024 Component getExportPanel(); 025 026 /** 027 * Return true, if the layer should be included in the list of exported layers. 028 * 029 * The user can veto this in the export panel. 030 * @return {@code true} if the layer should be included in the list of exported layers, {@code false} otherwise. 031 */ 032 boolean shallExport(); 033 034 /** 035 * Return true, if some data needs to be included in 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 .joz. Otherwise both .jos and .joz are possible. 039 * @return {@code true} if some data needs to be included in the zip archive, {@code false} otherwise. 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 * @param support support class providing export utilities 047 * @return the resulting XML element 048 * @throws IOException if any I/O error occurs 049 */ 050 Element export(ExportSupport support) throws IOException; 051}