source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionChoice.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.4 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;
6
7import javax.swing.JPanel;
8
9import org.openstreetmap.josm.data.projection.Projection;
10
11/**
12 * This class offers a choice of projections to the user.
13 *
14 * It can display a GUI panel, in order to select the parameters.
15 */
16public interface ProjectionChoice {
17
18 /**
19 * Get a unique id for the projection choice.
20 *
21 * Will be used to save the user selection to the preference file.
22 *
23 * @return the string identifier
24 */
25 String getId();
26
27 /**
28 * Set the internal state to match the preferences.
29 *
30 * Will be called before getPreferencePanel and when the
31 * listener from getPreferencePanel is invoked.
32 *
33 * @param args preferences as a list of strings; may be null
34 * to reset everything.
35 */
36 void setPreferences(Collection<String> args);
37
38 /**
39 * Get the projection that matches the internal state.
40 * @return the effective projection
41 */
42 Projection getProjection();
43
44 /**
45 * Generate and provide the GUI.
46 *
47 * It will be displayed to the user. Call the listener, when the user makes
48 * changes in the GUI, so the projection info in the top panel gets updated.
49 *
50 * @param listener listener for any change of preferences
51 * @return the GUI panel
52 */
53 JPanel getPreferencePanel(ActionListener listener);
54
55 /**
56 * Extract preferences from the GUI.
57 *
58 * Will be called when the preference dialog is dismissed or
59 * when the listener from getPreferencePanel is invoked.
60 */
61 Collection<String> getPreferences(JPanel panel);
62
63 /**
64 * Return all projection codes supported by this projection choice.
65 * @return all supported projection codes
66 */
67 String[] allCodes();
68
69 /**
70 * Get Preferences from projection code.
71 * @param code projection code
72 *
73 * @return null when code is not part of this projection choice.
74 * An empty Collection as return value indicates, that the code is supported,
75 * but no preferences are required to set it up.
76 */
77 Collection<String> getPreferencesFromCode(String code);
78
79 /**
80 * Short name of the projection choice as shown in the GUI (combo box).
81 *
82 * @return the name
83 */
84 String toString();
85}
Note: See TracBrowser for help on using the repository browser.