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

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

remove deprecated API

  • Property svn:eol-style set to native
File size: 1.7 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 */
26 public SingleProjectionChoice(String name, String id, String code) {
27 super(name, id);
28 this.code = code;
29 }
30
31 @Override
32 public JPanel getPreferencePanel(ActionListener listener) {
33 return new JPanel();
34 }
35
36 @Override
37 public String[] allCodes() {
38 return new String[] {code};
39 }
40
41 @Override
42 public void setPreferences(Collection<String> args) {
43 // Do nothing
44 }
45
46 @Override
47 public Collection<String> getPreferences(JPanel p) {
48 return Collections.emptyList();
49 }
50
51 @Override
52 public Collection<String> getPreferencesFromCode(String code) {
53 if (code.equals(this.code))
54 return Collections.emptyList();
55 else
56 return null;
57 }
58
59 @Override
60 public String getCurrentCode() {
61 return code;
62 }
63
64 @Override
65 public String getProjectionName() {
66 return name; // the same name as the projection choice
67 }
68
69}
Note: See TracBrowser for help on using the repository browser.