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 |
|
---|
8 | import org.openstreetmap.josm.tools.ImageProvider;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Sort the selected relation members and all members below.
|
---|
12 | * @since 9496
|
---|
13 | */
|
---|
14 | public class SortBelowAction extends AbstractRelationEditorAction {
|
---|
15 | private static final long serialVersionUID = 1L;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Constructs a new {@code SortBelowAction}.
|
---|
19 | * @param memberTable member table
|
---|
20 | * @param memberTableModel member table model
|
---|
21 | */
|
---|
22 | public SortBelowAction(IRelationEditorActionAccess editorAccess) {
|
---|
23 | super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
|
---|
24 | new ImageProvider("dialogs", "sort_below").getResource().attachImageIcon(this, true);
|
---|
25 | putValue(NAME, tr("Sort below"));
|
---|
26 | putValue(SHORT_DESCRIPTION, tr("Sort the selected relation members and all members below"));
|
---|
27 | updateEnabledState();
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public void actionPerformed(ActionEvent e) {
|
---|
32 | editorAccess.getMemberTableModel().sortBelow();
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | protected void updateEnabledState() {
|
---|
37 | setEnabled(editorAccess.getMemberTableModel().getRowCount() > 0 && !editorAccess.getMemberTableModel().getSelectionModel().isSelectionEmpty());
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public boolean isExpertOnly() {
|
---|
42 | return true;
|
---|
43 | }
|
---|
44 | }
|
---|