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

Last change on this file since 7937 was 7937, checked in by bastiK, 9 years ago

add subversion property svn:eol=native

  • 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 }
57
58 @Override
59 public Collection<String> getPreferences(JPanel p) {
60 return Collections.emptyList();
61 }
62
63 @Override
64 public Collection<String> getPreferencesFromCode(String code) {
65 if (code.equals(this.code))
66 return Collections.emptyList();
67 else
68 return null;
69 }
70
71 @Override
72 public String getCurrentCode() {
73 return code;
74 }
75
76 @Override
77 public String getProjectionName() {
78 return name; // the same name as the projection choice
79 }
80
81}
Note: See TracBrowser for help on using the repository browser.