1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.tagging.presets;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
5 |
|
---|
6 | import java.util.Arrays;
|
---|
7 | import java.util.Collection;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Supporting class for creating the GUI for a preset item.
|
---|
11 | *
|
---|
12 | * @since xxx
|
---|
13 | */
|
---|
14 | public class TaggingPresetItemGuiSupport {
|
---|
15 |
|
---|
16 | private final Collection<OsmPrimitive> selected;
|
---|
17 | private final boolean presetInitiallyMatches;
|
---|
18 |
|
---|
19 | private TaggingPresetItemGuiSupport(boolean presetInitiallyMatches, Collection<OsmPrimitive> selected) {
|
---|
20 | this.selected = selected;
|
---|
21 | this.presetInitiallyMatches = presetInitiallyMatches;
|
---|
22 | }
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * Returns the selected primitives
|
---|
26 | *
|
---|
27 | * @return the selected primitives
|
---|
28 | */
|
---|
29 | public Collection<OsmPrimitive> getSelected() {
|
---|
30 | return selected;
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Returns whether the preset initially matched (before opening the dialog)
|
---|
35 | *
|
---|
36 | * @return whether the preset initially matched
|
---|
37 | */
|
---|
38 | public boolean isPresetInitiallyMatches() {
|
---|
39 | return presetInitiallyMatches;
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Creates a new {@code TaggingPresetItemGuiSupport}
|
---|
44 | *
|
---|
45 | * @param selected the selected primitives
|
---|
46 | * @param presetInitiallyMatches whether the preset initially matched
|
---|
47 | * @return the new {@code TaggingPresetItemGuiSupport}
|
---|
48 | */
|
---|
49 | public static TaggingPresetItemGuiSupport create(boolean presetInitiallyMatches, Collection<OsmPrimitive> selected) {
|
---|
50 | return new TaggingPresetItemGuiSupport(presetInitiallyMatches, selected);
|
---|
51 | }
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Creates a new {@code TaggingPresetItemGuiSupport}
|
---|
55 | *
|
---|
56 | * @param selected the selected primitives
|
---|
57 | * @param presetInitiallyMatches whether the preset initially matched
|
---|
58 | * @return the new {@code TaggingPresetItemGuiSupport}
|
---|
59 | */
|
---|
60 | public static TaggingPresetItemGuiSupport create(boolean presetInitiallyMatches, OsmPrimitive... selected) {
|
---|
61 | return new TaggingPresetItemGuiSupport(presetInitiallyMatches, Arrays.asList(selected));
|
---|
62 | }
|
---|
63 | }
|
---|