Changeset 9659 in josm


Ignore:
Timestamp:
2016-01-27T23:38:23+01:00 (9 years ago)
Author:
Don-vip
Message:

see #12410 - rename super interface, fix unit test

Location:
trunk
Files:
19 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r9657 r9659  
    254254    }
    255255
    256     /**
    257      * Reloads data from relation.
    258      */
     256    @Override
    259257    public void reloadDataFromRelation() {
    260258        setRelation(getRelation());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/IRelationEditor.java

    r9655 r9659  
    55
    66/**
    7  * Super interface of relation-aware editors.
    8  * @since 9496
     7 * Super interface of relation editors.
     8 * @since 9659
    99 */
    10 public interface RelationAware {
     10public interface IRelationEditor {
    1111
    1212    /**
     
    4040     */
    4141    boolean isDirtyRelation();
     42
     43    /**
     44     * Reloads data from relation.
     45     */
     46    void reloadDataFromRelation();
    4247}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r9496 r9659  
    2323 * @since 1599
    2424 */
    25 public abstract class RelationEditor extends ExtendedDialog implements RelationAware {
     25public abstract class RelationEditor extends ExtendedDialog implements IRelationEditor {
    2626
    2727    /** the property name for the current relation.
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorAction.java

    r9496 r9659  
    1010import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1111import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    12 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     12import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1313import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1414
     
    2121    protected final MemberTableModel memberTableModel;
    2222    protected final transient OsmDataLayer layer;
    23     protected final transient RelationAware editor;
     23    protected final transient IRelationEditor editor;
    2424
    2525    protected AbstractRelationEditorAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey) {
     
    2828
    2929    protected AbstractRelationEditorAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey,
    30             OsmDataLayer layer, RelationAware editor) {
     30            OsmDataLayer layer, IRelationEditor editor) {
    3131        this.memberTable = memberTable;
    3232        this.memberTableModel = memberTableModel;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddFromSelectionAction.java

    r9496 r9659  
    1313import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1414import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    15 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     15import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1616import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable;
    1717import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
     
    2828
    2929    protected AddFromSelectionAction(MemberTable memberTable, MemberTableModel memberTableModel, SelectionTable selectionTable,
    30             SelectionTableModel selectionTableModel, String actionMapKey, OsmDataLayer layer, RelationAware editor) {
     30            SelectionTableModel selectionTableModel, String actionMapKey, OsmDataLayer layer, IRelationEditor editor) {
    3131        super(memberTable, memberTableModel, actionMapKey, layer, editor);
    3232        this.selectionTable = selectionTable;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAfterSelection.java

    r9496 r9659  
    99import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    1010import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     11import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1212import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    1313import org.openstreetmap.josm.tools.ImageProvider;
     
    2525     * @param editor relation editor
    2626     */
    27     public AddSelectedAfterSelection(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, RelationAware editor) {
     27    public AddSelectedAfterSelection(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    2828        super(null, memberTableModel, null, selectionTableModel, null, null, editor);
    2929        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset after the last selected member"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtEndAction.java

    r9496 r9659  
    99import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    1010import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     11import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1212import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    1313import org.openstreetmap.josm.tools.ImageProvider;
     
    2525     * @param editor relation editor
    2626     */
    27     public AddSelectedAtEndAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, RelationAware editor) {
     27    public AddSelectedAtEndAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    2828        super(null, memberTableModel, null, selectionTableModel, null, null, editor);
    2929        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset after the last member"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtStartAction.java

    r9496 r9659  
    99import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    1010import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     11import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1212import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    1313import org.openstreetmap.josm.tools.ImageProvider;
     
    2525     * @param editor relation editor
    2626     */
    27     public AddSelectedAtStartAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, RelationAware editor) {
     27    public AddSelectedAtStartAction(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    2828        super(null, memberTableModel, null, selectionTableModel, null, null, editor);
    2929        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset before the first member"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedBeforeSelection.java

    r9496 r9659  
    99import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    1010import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     11import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1212import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    1313import org.openstreetmap.josm.tools.ImageProvider;
     
    2525     * @param editor relation editor
    2626     */
    27     public AddSelectedBeforeSelection(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, RelationAware editor) {
     27    public AddSelectedBeforeSelection(MemberTableModel memberTableModel, SelectionTableModel selectionTableModel, IRelationEditor editor) {
    2828        super(null, memberTableModel, null, selectionTableModel, null, null, editor);
    2929        putValue(SHORT_DESCRIPTION, tr("Add all objects selected in the current dataset before the first selected member"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java

    r9657 r9659  
    55
    66import java.awt.event.ActionEvent;
    7 
    87import java.beans.PropertyChangeEvent;
    98import java.beans.PropertyChangeListener;
     
    1211import javax.swing.event.TableModelListener;
    1312
    14 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor;
     13import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1514import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1615import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    17 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
    1816import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1917import org.openstreetmap.josm.gui.tagging.TagEditorModel;
     
    3533     */
    3634    public ApplyAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    37             RelationAware editor) {
     35            IRelationEditor editor) {
    3836        super(memberTable, memberTableModel, tagModel, layer, editor, null);
    3937        putValue(SHORT_DESCRIPTION, tr("Apply the current updates"));
     
    4846    public void actionPerformed(ActionEvent e) {
    4947        if (applyChanges()) {
    50             ((GenericRelationEditor) editor).reloadDataFromRelation();
     48            editor.reloadDataFromRelation();
    5149        }
    5250    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java

    r9657 r9659  
    1818import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1919import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    20 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     20import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    2121import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2222import org.openstreetmap.josm.gui.tagging.TagEditorModel;
     
    4040     */
    4141    public CancelAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    42             RelationAware editor, AutoCompletingTextField tfRole) {
     42            IRelationEditor editor, AutoCompletingTextField tfRole) {
    4343        super(memberTable, memberTableModel, tagModel, layer, editor, tfRole);
    4444        putValue(SHORT_DESCRIPTION, tr("Cancel the updates and close the dialog"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CopyMembersAction.java

    r9496 r9659  
    1010import org.openstreetmap.josm.data.osm.RelationMember;
    1111import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    12 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     12import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1313import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1414
     
    2525     * @param editor relation editor
    2626     */
    27     public CopyMembersAction(MemberTableModel memberTableModel, OsmDataLayer layer, RelationAware editor) {
     27    public CopyMembersAction(MemberTableModel memberTableModel, OsmDataLayer layer, IRelationEditor editor) {
    2828        super(null, memberTableModel, null, null, null, layer, editor);
    2929    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DeleteCurrentRelationAction.java

    r9496 r9659  
    1111import org.openstreetmap.josm.data.osm.Relation;
    1212import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor;
    13 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     13import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1414import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1515import org.openstreetmap.josm.tools.ImageProvider;
     
    2626     * @param editor relation editor
    2727     */
    28     public DeleteCurrentRelationAction(OsmDataLayer layer, RelationAware editor) {
     28    public DeleteCurrentRelationAction(OsmDataLayer layer, IRelationEditor editor) {
    2929        super(null, null, null, layer, editor);
    3030        putValue(SHORT_DESCRIPTION, tr("Delete the currently edited relation"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DownloadIncompleteMembersAction.java

    r9496 r9659  
    1212import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1313import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    14 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     14import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1515import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1616import org.openstreetmap.josm.io.OnlineResource;
     
    3333     */
    3434    public DownloadIncompleteMembersAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey,
    35             OsmDataLayer layer, RelationAware editor) {
     35            OsmDataLayer layer, IRelationEditor editor) {
    3636        super(memberTable, memberTableModel, actionMapKey, layer, editor);
    3737        Shortcut sc = Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/DownloadSelectedIncompleteMembersAction.java

    r9496 r9659  
    1111import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1212import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    13 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     13import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1414import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1515import org.openstreetmap.josm.io.OnlineResource;
     
    3131     */
    3232    public DownloadSelectedIncompleteMembersAction(MemberTable memberTable, MemberTableModel memberTableModel, String actionMapKey,
    33             OsmDataLayer layer, RelationAware editor) {
     33            OsmDataLayer layer, IRelationEditor editor) {
    3434        super(memberTable, memberTableModel, actionMapKey, layer, editor);
    3535        //  Shortcut.register Shortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/OKAction.java

    r9657 r9659  
    99import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1010import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     11import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1212import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1313import org.openstreetmap.josm.gui.tagging.TagEditorModel;
     
    3030     */
    3131    public OKAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    32             RelationAware editor, AutoCompletingTextField tfRole) {
     32            IRelationEditor editor, AutoCompletingTextField tfRole) {
    3333        super(memberTable, memberTableModel, tagModel, layer, editor, tfRole);
    3434        putValue(SHORT_DESCRIPTION, tr("Apply the updates and close the dialog"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersAction.java

    r9496 r9659  
    1616import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException;
    1717import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    18 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     18import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    1919import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2020
     
    3131     * @param editor relation editor
    3232     */
    33     public PasteMembersAction(MemberTableModel memberTableModel, OsmDataLayer layer, RelationAware editor) {
     33    public PasteMembersAction(MemberTableModel memberTableModel, OsmDataLayer layer, IRelationEditor editor) {
    3434        super(null, memberTableModel, null, null, null, layer, editor);
    3535    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java

    r9657 r9659  
    1717import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1818import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    19 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     19import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    2020import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2121import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
     
    3939     */
    4040    public RefreshAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    41             RelationAware editor) {
     41            IRelationEditor editor) {
    4242        super(memberTable, memberTableModel, tagModel, layer, editor, null);
    4343        // CHECKSTYLE.OFF: LineLength
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java

    r9657 r9659  
    2323import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    2424import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    25 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
     25import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    2626import org.openstreetmap.josm.gui.dialogs.relation.RelationDialogManager;
    2727import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
     
    4141
    4242    protected SavingAction(MemberTable memberTable, MemberTableModel memberTableModel, TagEditorModel tagModel, OsmDataLayer layer,
    43             RelationAware editor, AutoCompletingTextField tfRole) {
     43            IRelationEditor editor, AutoCompletingTextField tfRole) {
    4444        super(memberTable, memberTableModel, null, layer, editor);
    4545        this.tagModel = tagModel;
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java

    r9657 r9659  
    77import org.openstreetmap.josm.data.osm.DataSet;
    88import org.openstreetmap.josm.data.osm.Relation;
     9import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;
    910import org.openstreetmap.josm.gui.dialogs.relation.MemberTable;
    1011import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel;
    11 import org.openstreetmap.josm.gui.dialogs.relation.RelationAware;
    1212import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel;
    1313import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    4040        SelectionTableModel selectionTableModel = new SelectionTableModel(layer);
    4141
    42         RelationAware editor = new RelationAware() {
     42        IRelationEditor editor = new IRelationEditor() {
    4343            private Relation r = orig;
    4444
     
    6161            public Relation getRelation() {
    6262                return r;
     63            }
     64
     65            @Override
     66            public void reloadDataFromRelation() {
     67                // Do nothing
    6368            }
    6469        };
Note: See TracChangeset for help on using the changeset viewer.