source: josm/trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionChoice.java@ 9239

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

javadoc update

  • Property svn:eol-style set to native
File size: 2.5 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 * @param panel projection preferences panel
61 * @return preferences as a list of strings; may be null to reset everything.
62 * @see #setPreferences
63 */
64 Collection<String> getPreferences(JPanel panel);
65
66 /**
67 * Return all projection codes supported by this projection choice.
68 * @return all supported projection codes
69 */
70 String[] allCodes();
71
72 /**
73 * Get Preferences from projection code.
74 * @param code projection code
75 *
76 * @return null when code is not part of this projection choice.
77 * An empty Collection as return value indicates, that the code is supported,
78 * but no preferences are required to set it up.
79 */
80 Collection<String> getPreferencesFromCode(String code);
81
82 /**
83 * Short name of the projection choice as shown in the GUI (combo box).
84 *
85 * @return the name
86 */
87 @Override
88 String toString();
89}
Note: See TracBrowser for help on using the repository browser.