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

Last change on this file since 6070 was 6070, checked in by stoecker, 11 years ago

see #8853 remove tabs, trailing spaces, windows line ends, strange characters

File size: 2.3 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 */
41 Projection getProjection();
42
43 /**
44 * Generate and provide the GUI.
45 *
46 * It will be displayed to the user. Call the listener, when the user makes
47 * changes in the GUI, so the projection info in the top panel gets updated.
48 *
49 * @param listener listener for any change of preferences
50 * @return the GUI panel
51 */
52 JPanel getPreferencePanel(ActionListener listener);
53
54 /**
55 * Extract preferences from the GUI.
56 *
57 * Will be called when the preference dialog is dismissed or
58 * when the listener from getPreferencePanel is invoked.
59 */
60 Collection<String> getPreferences(JPanel panel);
61
62 /**
63 * Return all projection codes supported by this projection choice.
64 */
65 String[] allCodes();
66
67 /**
68 * Get Preferences from projection code.
69 *
70 * @return null when code is not part of this projection choice.
71 * An empty Collection as return value indicates, that the code is supported,
72 * but no preferences are required to set it up.
73 */
74 Collection<String> getPreferencesFromCode(String code);
75
76 /**
77 * Short name of the projection choice as shown in the GUI (combo box).
78 *
79 * @return the name
80 */
81 String toString();
82
83}
Note: See TracBrowser for help on using the repository browser.