Class ListProjectionChoice
- java.lang.Object
-
- org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
-
- org.openstreetmap.josm.gui.preferences.projection.ListProjectionChoice
-
- All Implemented Interfaces:
ProjectionChoice
- Direct Known Subclasses:
GaussKruegerProjectionChoice
,LambertCC9ZonesProjectionChoice
,LambertProjectionChoice
,PuwgProjectionChoice
,UTMFranceDOMProjectionChoice
,UTMProjectionChoice
public abstract class ListProjectionChoice extends AbstractProjectionChoice
A projection choice, that offers a list of projections in a combo-box.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ListProjectionChoice.CBPanel
-
Field Summary
Fields Modifier and Type Field Description protected int
defaultIndex
protected String[]
entries
protected int
index
protected String
label
-
Fields inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
id, name
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ListProjectionChoice(String name, String id, String[] entries, String label)
Constructs a newListProjectionChoice
.protected
ListProjectionChoice(String name, String id, String[] entries, String label, int defaultIndex)
Constructs a newListProjectionChoice
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description JPanel
getPreferencePanel(ActionListener listener)
Generate and provide the GUI.Collection<String>
getPreferences(JPanel panel)
Extract preferences from the GUI.protected abstract String
indexToZone(int idx)
Convert 0-based index to preference value.void
setPreferences(Collection<String> args)
Set the internal state to match the preferences.protected abstract int
zoneToIndex(String zone)
Convert preference value to 0-based index.-
Methods inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
getCurrentCode, getId, getProjection, getProjectionName, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice
allCodes, getPreferencesFromCode
-
-
-
-
Constructor Detail
-
ListProjectionChoice
protected ListProjectionChoice(String name, String id, String[] entries, String label, int defaultIndex)
Constructs a newListProjectionChoice
.- Parameters:
name
- the display nameid
- the unique id for this ProjectionChoiceentries
- the list of display entries for the combo-boxlabel
- a label shown left to the combo-boxdefaultIndex
- the default index for the combo-box
-
ListProjectionChoice
protected ListProjectionChoice(String name, String id, String[] entries, String label)
Constructs a newListProjectionChoice
.- Parameters:
name
- the display nameid
- the unique id for this ProjectionChoiceentries
- the list of display entries for the combo-boxlabel
- a label shown left to the combo-box
-
-
Method Detail
-
indexToZone
protected abstract String indexToZone(int idx)
Convert 0-based index to preference value.- Parameters:
idx
- 0-based index- Returns:
- preference value
- See Also:
zoneToIndex(java.lang.String)
-
zoneToIndex
protected abstract int zoneToIndex(String zone)
Convert preference value to 0-based index.- Parameters:
zone
- preference value- Returns:
- 0-based index
- See Also:
indexToZone(int)
-
setPreferences
public void setPreferences(Collection<String> args)
Description copied from interface:ProjectionChoice
Set the internal state to match the preferences. Will be called before getPreferencePanel and when the listener from getPreferencePanel is invoked.- Parameters:
args
- preferences as a list of strings; may be null to reset everything.
-
getPreferencePanel
public JPanel getPreferencePanel(ActionListener listener)
Description copied from interface:ProjectionChoice
Generate and provide the GUI. It will be displayed to the user. Call the listener, when the user makes changes in the GUI, so the projection info in the top panel gets updated.- Parameters:
listener
- listener for any change of preferences- Returns:
- the GUI panel
-
getPreferences
public Collection<String> getPreferences(JPanel panel)
Description copied from interface:ProjectionChoice
Extract preferences from the GUI. Will be called when the preference dialog is dismissed or when the listener from getPreferencePanel is invoked.- Parameters:
panel
- projection preferences panel- Returns:
- preferences as a list of strings; may be null to reset everything.
- See Also:
ProjectionChoice.setPreferences(java.util.Collection<java.lang.String>)
-
-