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 classListProjectionChoice.CBPanel
-
Field Summary
Fields Modifier and Type Field Description protected intdefaultIndexprotected java.lang.String[]entriesprotected intindexprotected java.lang.Stringlabel-
Fields inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
id, name
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedListProjectionChoice(java.lang.String name, java.lang.String id, java.lang.String[] entries, java.lang.String label)Constructs a newListProjectionChoice.protectedListProjectionChoice(java.lang.String name, java.lang.String id, java.lang.String[] entries, java.lang.String label, int defaultIndex)Constructs a newListProjectionChoice.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javax.swing.JPanelgetPreferencePanel(java.awt.event.ActionListener listener)Generate and provide the GUI.java.util.Collection<java.lang.String>getPreferences(javax.swing.JPanel panel)Extract preferences from the GUI.protected abstract java.lang.StringindexToZone(int idx)Convert 0-based index to preference value.voidsetPreferences(java.util.Collection<java.lang.String> args)Set the internal state to match the preferences.protected abstract intzoneToIndex(java.lang.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
-
-
-
-
Field Detail
-
index
protected int index
-
defaultIndex
protected int defaultIndex
-
entries
protected java.lang.String[] entries
-
label
protected java.lang.String label
-
-
Constructor Detail
-
ListProjectionChoice
protected ListProjectionChoice(java.lang.String name, java.lang.String id, java.lang.String[] entries, java.lang.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(java.lang.String name, java.lang.String id, java.lang.String[] entries, java.lang.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 java.lang.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(java.lang.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(java.util.Collection<java.lang.String> args)
Description copied from interface:ProjectionChoiceSet 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 javax.swing.JPanel getPreferencePanel(java.awt.event.ActionListener listener)
Description copied from interface:ProjectionChoiceGenerate 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 java.util.Collection<java.lang.String> getPreferences(javax.swing.JPanel panel)
Description copied from interface:ProjectionChoiceExtract 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>)
-
-