Last change
on this file since 5799 was 5799, checked in by akks, 12 years ago |
Membership tabled in properties toggle dialog supports multiselect (and multiple membership deletion)
Property toggle dialog refactoring - methods splitting and reordering
see #7846: more RelationListDialog refactoring, all other relation-related actions separated from dialogs, @Override, JavaDocs
|
File size:
1.0 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions.relation;
|
---|
3 |
|
---|
4 | import java.util.Collection;
|
---|
5 | import java.util.Collections;
|
---|
6 |
|
---|
7 | import javax.swing.AbstractAction;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.data.osm.Relation;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Ancestor for all actions that want to work with relation collection and
|
---|
13 | * to be disabled is the collection is empty
|
---|
14 | * @since 5793
|
---|
15 | */
|
---|
16 | public abstract class AbstractRelationAction extends AbstractAction {
|
---|
17 | protected Collection<Relation> relations = Collections.<Relation>emptySet();
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Specifies the working set of relations.
|
---|
21 | * @param relations The new working set of relations. Can be null or empty
|
---|
22 | */
|
---|
23 | public void setRelations(Collection<Relation> relations) {
|
---|
24 | if (relations==null) {
|
---|
25 | this.relations = Collections.<Relation>emptySet();
|
---|
26 | } else {
|
---|
27 | this.relations = relations;
|
---|
28 | }
|
---|
29 | updateEnabledState();
|
---|
30 | }
|
---|
31 |
|
---|
32 | protected void updateEnabledState() {
|
---|
33 | setEnabled(!relations.isEmpty());
|
---|
34 | }
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.