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 default boolean isDirtyRelation() { 043 return isDirtyRelation(false); 044 } 045 046 /** 047 * Replies true if the currently edited relation has been changed elsewhere. 048 * 049 * In this case a relation editor can't apply updates to the relation directly. Rather, 050 * it has to create a conflict. 051 * 052 * @param ignoreUninterestingTags whether to ignore uninteresting tag changes 053 * @return true if the currently edited relation has been changed elsewhere. 054 * @since 19398 055 */ 056 boolean isDirtyRelation(boolean ignoreUninterestingTags); 057 058 /** 059 * Replies true if the relation has been changed in the editor (but not yet applied). 060 * 061 * Reloading data from the relation would cause the pending changes to be lost. 062 * 063 * @return true if the currently edited relation has been changed in the editor. 064 * @since 19398 065 */ 066 boolean isDirtyEditor(); 067 068 /** 069 * Set the isSaving flag to the given value. See #24444 070 * @param b the flag value 071 * @since 19438 072 */ 073 void setIsSaving(boolean b); 074 075 /** 076 * Reloads data from relation. 077 */ 078 void reloadDataFromRelation(); 079 080 /** 081 * Replies the {@link OsmDataLayer} in whose context this relation editor is open 082 * 083 * @return the {@link OsmDataLayer} in whose context this relation editor is open 084 */ 085 OsmDataLayer getLayer(); 086}