001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.layer;
003
004/**
005 * Interface for layers that can save data to a file.
006 * @since 9751
007 */
008public interface SaveToFile {
009
010    /**
011     * Replies the savable state of the layer (i.e. if it can be saved through
012     * a "File->Save" dialog).  A layer that implements the
013     * {@code SaveToFile} interface must return {@code true}.
014     *
015     * @return {@code true} if the layer can be saved to a file; {@code false}, otherwise
016     */
017    boolean isSavable();
018
019    /**
020     * Determines if the data managed by this layer needs to be saved to
021     * a file. Only replies true if a file is assigned to this layer and
022     * if the data managed by this layer has been modified since the last
023     * save operation to the file.
024     *
025     * @return {@code true} if the data managed by this layer needs to be saved to a file; {@code false}, otherwise
026     */
027    boolean requiresSaveToFile();
028
029    /**
030     * Initializes the layer after a successful save of data to a file.
031     */
032    void onPostSaveToFile();
033}