org.openstreetmap.josm.gui.preferences.projection
Class ListProjectionChoice

java.lang.Object
  extended by org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
      extended by org.openstreetmap.josm.gui.preferences.projection.ListProjectionChoice
All Implemented Interfaces:
ProjectionChoice
Direct Known Subclasses:
GaussKruegerProjectionChoice, LambertCC9ZonesProjectionChoice, LambertProjectionChoice, PuwgProjectionChoice, UTM_France_DOM_ProjectionChoice, UTMProjectionChoice

public abstract class ListProjectionChoice
extends AbstractProjectionChoice

A projection choice, that offers a list of projections in a combo-box.


Nested Class Summary
protected  class ListProjectionChoice.CBPanel
           
 
Field Summary
protected  int defaultIndex
           
protected  java.lang.Object[] entries
           
protected  int index
           
protected  java.lang.String label
           
 
Constructor Summary
ListProjectionChoice(java.lang.String id, java.lang.String name, java.lang.Object[] entries, java.lang.String label)
           
ListProjectionChoice(java.lang.String id, java.lang.String name, java.lang.Object[] entries, java.lang.String label, int defaultIndex)
          Constructor
 
Method Summary
 javax.swing.JPanel getPreferencePanel(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.String indexToZone(int index)
          Convert 0-based index to preference value.
 void setPreferences(java.util.Collection<java.lang.String> args)
          Set the internal state to match the preferences.
protected abstract  int zoneToIndex(java.lang.String zone)
          Convert preference value to 0-based index.
 
Methods inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
getId, 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, getProjection
 

Field Detail

index

protected int index

defaultIndex

protected int defaultIndex

entries

protected java.lang.Object[] entries

label

protected java.lang.String label
Constructor Detail

ListProjectionChoice

public ListProjectionChoice(java.lang.String id,
                            java.lang.String name,
                            java.lang.Object[] entries,
                            java.lang.String label)

ListProjectionChoice

public ListProjectionChoice(java.lang.String id,
                            java.lang.String name,
                            java.lang.Object[] entries,
                            java.lang.String label,
                            int defaultIndex)
Constructor

Parameters:
id - the unique id for this ProjectionChoice
name - the display name
entries - the list of display entries for the combo-box
label - a label shown left to the combo-box
defaultIndex - the default index for the combo-box
Method Detail

indexToZone

protected abstract java.lang.String indexToZone(int index)
Convert 0-based index to preference value.


zoneToIndex

protected abstract int zoneToIndex(java.lang.String zone)
Convert preference value to 0-based index.


setPreferences

public void setPreferences(java.util.Collection<java.lang.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. Argument may be null to reset everything.


getPreferencePanel

public javax.swing.JPanel getPreferencePanel(java.awt.event.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 java.util.Collection<java.lang.String> getPreferences(javax.swing.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.



JOSM