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

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

sonar - squid:S1186 - Methods should not be empty

  • 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 a cache directory name
26 */
27 public SingleProjectionChoice(String name, String id, String code, String cacheDir) {
28 super(name, id, cacheDir);
29 this.code = code;
30 }
31
32 /**
33 * Constructs a new {@code SingleProjectionChoice}.
34 *
35 * @param name short name of the projection choice as shown in the GUI
36 * @param id unique identifier for the projection choice, e.g. "core:thisproj"
37 * @param code the unique identifier for the projection, e.g. "EPSG:1234"
38 */
39 public SingleProjectionChoice(String name, String id, String code) {
40 super(name, id);
41 this.code = code;
42 }
43
44 @Override
45 public JPanel getPreferencePanel(ActionListener listener) {
46 return new JPanel();
47 }
48
49 @Override
50 public String[] allCodes() {
51 return new String[] {code};
52 }
53
54 @Override
55 public void setPreferences(Collection<String> args) {
56 // Do nothing
57 }
58
59 @Override
60 public Collection<String> getPreferences(JPanel p) {
61 return Collections.emptyList();
62 }
63
64 @Override
65 public Collection<String> getPreferencesFromCode(String code) {
66 if (code.equals(this.code))
67 return Collections.emptyList();
68 else
69 return null;
70 }
71
72 @Override
73 public String getCurrentCode() {
74 return code;
75 }
76
77 @Override
78 public String getProjectionName() {
79 return name; // the same name as the projection choice
80 }
81
82}
Note: See TracBrowser for help on using the repository browser.