source: josm/trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupport.java@ 17609

Last change on this file since 17609 was 17609, checked in by simon04, 3 years ago

see #18949 - Extract class TaggingPresetItemGuiSupport

File size: 2.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.tagging.presets;
3
4import org.openstreetmap.josm.data.osm.OsmPrimitive;
5
6import java.util.Arrays;
7import java.util.Collection;
8
9/**
10 * Supporting class for creating the GUI for a preset item.
11 *
12 * @since xxx
13 */
14public 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}
Note: See TracBrowser for help on using the repository browser.