source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/projection/SingleProjectionChoice.java@ 13182

Last change on this file since 13182 was 13182, checked in by Don-vip, 6 years ago

see #15310 - cacheDir is unused, deprecate new methods

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.preferences.projection;
3
4import java.awt.event.ActionListener;
5import java.util.Collection;
6import java.util.Collections;
7
8import javax.swing.JPanel;
9
10/**
11 * ProjectionChoice, that offers just one projection as choice.
12 *
13 * The GUI is an empty panel.
14 */
15public class SingleProjectionChoice extends AbstractProjectionChoice {
16
17 protected String code;
18
19 /**
20 * Constructs a new {@code SingleProjectionChoice}.
21 *
22 * @param name short name of the projection choice as shown in the GUI
23 * @param id unique identifier for the projection choice, e.g. "core:thisproj"
24 * @param code the unique identifier for the projection, e.g. "EPSG:1234"
25 * @param cacheDir unused
26 * @deprecated use {@link #SingleProjectionChoice(String, String, String)} instead
27 */
28 @Deprecated
29 public SingleProjectionChoice(String name, String id, String code, String cacheDir) {
30 this(name, id, code);
31 }
32
33 /**
34 * Constructs a new {@code SingleProjectionChoice}.
35 *
36 * @param name short name of the projection choice as shown in the GUI
37 * @param id unique identifier for the projection choice, e.g. "core:thisproj"
38 * @param code the unique identifier for the projection, e.g. "EPSG:1234"
39 */
40 public SingleProjectionChoice(String name, String id, String code) {
41 super(name, id);
42 this.code = code;
43 }
44
45 @Override
46 public JPanel getPreferencePanel(ActionListener listener) {
47 return new JPanel();
48 }
49
50 @Override
51 public String[] allCodes() {
52 return new String[] {code};
53 }
54
55 @Override
56 public void setPreferences(Collection<String> args) {
57 // Do nothing
58 }
59
60 @Override
61 public Collection<String> getPreferences(JPanel p) {
62 return Collections.emptyList();
63 }
64
65 @Override
66 public Collection<String> getPreferencesFromCode(String code) {
67 if (code.equals(this.code))
68 return Collections.emptyList();
69 else
70 return null;
71 }
72
73 @Override
74 public String getCurrentCode() {
75 return code;
76 }
77
78 @Override
79 public String getProjectionName() {
80 return name; // the same name as the projection choice
81 }
82
83}
Note: See TracBrowser for help on using the repository browser.