001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.dialogs.relation;
003
004import org.openstreetmap.josm.data.osm.Relation;
005import org.openstreetmap.josm.gui.layer.OsmDataLayer;
006
007/**
008 * Super interface of relation editors.
009 * @since 9659
010 */
011public interface IRelationEditor {
012
013    /**
014     * Replies the currently edited relation
015     *
016     * @return the currently edited relation
017     */
018    Relation getRelation();
019
020    /**
021     * Sets the currently edited relation. Creates a snapshot of the current
022     * state of the relation. See {@link #getRelationSnapshot()}
023     *
024     * @param relation the relation
025     */
026    void setRelation(Relation relation);
027
028    /**
029     * Replies the state of the edited relation when the editor has been launched.
030     * @return the state of the edited relation when the editor has been launched
031     */
032    Relation getRelationSnapshot();
033
034    /**
035     * Replies true if the currently edited relation has been changed elsewhere.
036     *
037     * In this case a relation editor can't apply updates to the relation directly. Rather,
038     * it has to create a conflict.
039     *
040     * @return true if the currently edited relation has been changed elsewhere.
041     */
042    boolean isDirtyRelation();
043
044    /**
045     * Reloads data from relation.
046     */
047    void reloadDataFromRelation();
048
049    /**
050     * Replies the {@link OsmDataLayer} in whose context this relation editor is open
051     *
052     * @return the {@link OsmDataLayer} in whose context this relation editor is open
053     */
054    OsmDataLayer getLayer();
055}