Changeset 12933 in josm


Ignore:
Timestamp:
2017-10-07T14:39:29+02:00 (2 months ago)
Author:
Don-vip
Message:

fix #15368 - Button that selects the relation from relation editor

Location:
trunk
Files:
1 added
4 edited

Legend:

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

    r12846 r12933  
    6363import org.openstreetmap.josm.gui.ScrollViewport;
    6464import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
     65import org.openstreetmap.josm.gui.dialogs.relation.actions.AbstractRelationEditorAction;
    6566import org.openstreetmap.josm.gui.dialogs.relation.actions.AddSelectedAfterSelection;
    6667import org.openstreetmap.josm.gui.dialogs.relation.actions.AddSelectedAtEndAction;
     
    8384import org.openstreetmap.josm.gui.dialogs.relation.actions.RemoveSelectedAction;
    8485import org.openstreetmap.josm.gui.dialogs.relation.actions.ReverseAction;
     86import org.openstreetmap.josm.gui.dialogs.relation.actions.SelectAction;
    8587import org.openstreetmap.josm.gui.dialogs.relation.actions.SelectPrimitivesForSelectedMembersAction;
    8688import org.openstreetmap.josm.gui.dialogs.relation.actions.SelectedMembersForSelectionAction;
     
    143145    private final ApplyAction applyAction;
    144146    /**
     147     * Action for performing the {@link SelectAction}
     148     */
     149    private final SelectAction selectAction;
     150    /**
    145151     * Action for performing the {@link DuplicateRelationAction}
    146152     */
     
    245251        refreshAction = new RefreshAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this);
    246252        applyAction = new ApplyAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this);
     253        selectAction = new SelectAction(getLayer(), this);
    247254        duplicateAction = new DuplicateRelationAction(memberTableModel, tagEditorPanel.getModel(), getLayer());
    248255        deleteAction = new DeleteCurrentRelationAction(getLayer(), this);
     
    252259        cancelAction = new CancelAction(memberTable, memberTableModel, tagEditorPanel.getModel(), getLayer(), this, tfRole);
    253260
    254         getContentPane().add(buildToolBar(refreshAction, applyAction, duplicateAction, deleteAction), BorderLayout.NORTH);
     261        getContentPane().add(buildToolBar(refreshAction, applyAction, selectAction, duplicateAction, deleteAction), BorderLayout.NORTH);
    255262        getContentPane().add(tabbedPane, BorderLayout.CENTER);
    256263        getContentPane().add(buildOkCancelButtonPanel(okAction, cancelAction), BorderLayout.SOUTH);
     
    331338
    332339    /**
     340     * Select relation.
     341     * @see SelectAction
     342     * @since 12933
     343     */
     344    public void select() {
     345        selectAction.actionPerformed(null);
     346    }
     347
     348    /**
    333349     * Cancel changes.
    334350     * @see CancelAction
     
    340356    /**
    341357     * Creates the toolbar
    342      * @param refreshAction refresh action
    343      * @param applyAction apply action
    344      * @param duplicateAction duplicate action
    345      * @param deleteAction delete action
    346      *
     358     * @param actions relation toolbar actions
    347359     * @return the toolbar
    348      */
    349     protected static JToolBar buildToolBar(RefreshAction refreshAction, ApplyAction applyAction,
    350             DuplicateRelationAction duplicateAction, DeleteCurrentRelationAction deleteAction) {
     360     * @since 12933
     361     */
     362    protected static JToolBar buildToolBar(AbstractRelationEditorAction... actions) {
    351363        JToolBar tb = new JToolBar();
    352364        tb.setFloatable(false);
    353         tb.add(refreshAction);
    354         tb.add(applyAction);
    355         tb.add(duplicateAction);
    356         tb.add(deleteAction);
     365        for (AbstractRelationEditorAction action : actions) {
     366            tb.add(action);
     367        }
    357368        return tb;
    358369    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorAction.java

    r12846 r12933  
    1717 * @since 9496
    1818 */
    19 abstract class AbstractRelationEditorAction extends AbstractAction implements TableModelListener, ListSelectionListener {
     19public abstract class AbstractRelationEditorAction extends AbstractAction implements TableModelListener, ListSelectionListener {
    2020    protected final MemberTable memberTable;
    2121    protected final MemberTableModel memberTableModel;
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java

    r12728 r12933  
    2323import org.openstreetmap.josm.gui.dialogs.relation.actions.OKAction;
    2424import org.openstreetmap.josm.gui.dialogs.relation.actions.RefreshAction;
     25import org.openstreetmap.josm.gui.dialogs.relation.actions.SelectAction;
    2526import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2627import org.openstreetmap.josm.gui.tagging.TagEditorModel;
     
    143144                new RefreshAction(memberTable, memberTableModel, tagModel, layer, re),
    144145                new ApplyAction(memberTable, memberTableModel, tagModel, layer, re),
     146                new SelectAction(layer, re),
    145147                new DuplicateRelationAction(memberTableModel, tagModel, layer),
    146148                new DeleteCurrentRelationAction(layer, re)));
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java

    r12564 r12933  
    6060        new PasteMembersAction(memberTable, layer, editor).actionPerformed(null);
    6161
     62        new SelectAction(layer, editor).actionPerformed(null);
    6263        new DeleteCurrentRelationAction(layer, editor).actionPerformed(null);
    6364
Note: See TracChangeset for help on using the changeset viewer.