1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.dialogs.relation.actions;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.tools.ImageProvider;
|
---|
10 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Move the currently selected members down.
|
---|
14 | * @since 9496
|
---|
15 | */
|
---|
16 | public class MoveDownAction extends AbstractRelationEditorAction {
|
---|
17 | private static final long serialVersionUID = 1L;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Constructs a new {@code MoveDownAction}.
|
---|
21 | * @param editorAccess An interface to access the relation editor contents.
|
---|
22 | * @param actionMapKey action map key
|
---|
23 | */
|
---|
24 | public MoveDownAction(IRelationEditorActionAccess editorAccess, String actionMapKey) {
|
---|
25 | super(editorAccess, actionMapKey, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
|
---|
26 | new ImageProvider("dialogs", "down").getResource().attachImageIcon(this, true);
|
---|
27 | Shortcut sc = Shortcut.registerShortcut("relationeditor:movedown", tr("Relation Editor: Move Down"), KeyEvent.VK_DOWN, Shortcut.ALT);
|
---|
28 | sc.setAccelerator(this);
|
---|
29 | sc.setTooltip(this, tr("Move the currently selected members down"));
|
---|
30 | setEnabled(false);
|
---|
31 | }
|
---|
32 |
|
---|
33 | @Override
|
---|
34 | public void actionPerformed(ActionEvent e) {
|
---|
35 | editorAccess.getMemberTableModel().moveDown(editorAccess.getMemberTable().getSelectedRows());
|
---|
36 | editorAccess.stopMemberCellEditing();
|
---|
37 | }
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | protected void updateEnabledState() {
|
---|
41 | setEnabled(editorAccess.getMemberTableModel().canMoveDown(editorAccess.getMemberTable().getSelectedRows()));
|
---|
42 | }
|
---|
43 | }
|
---|