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

java.lang.Object
  extended by org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
      extended by org.openstreetmap.josm.gui.preferences.projection.SingleProjectionChoice
All Implemented Interfaces:
ProjectionChoice
Direct Known Subclasses:
SwissGridProjectionChoice

public class SingleProjectionChoice
extends AbstractProjectionChoice

ProjectionChoice, that offers just one projection as choice. The GUI is an empty panel.


Field Summary
protected  java.lang.String code
           
 
Fields inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
cacheDir, id, name
 
Constructor Summary
SingleProjectionChoice(java.lang.String name, java.lang.String id, java.lang.String code)
           
SingleProjectionChoice(java.lang.String name, java.lang.String id, java.lang.String code, java.lang.String cacheDir)
          Constructor.
 
Method Summary
 java.lang.String[] allCodes()
          Return all projection codes supported by this projection choice.
 java.lang.String getCurrentCode()
           
 javax.swing.JPanel getPreferencePanel(java.awt.event.ActionListener listener)
          Generate and provide the GUI.
 java.util.Collection<java.lang.String> getPreferences(javax.swing.JPanel p)
          Extract preferences from the GUI.
 java.util.Collection<java.lang.String> getPreferencesFromCode(java.lang.String code)
          Get Preferences from projection code.
 java.lang.String getProjectionName()
           
 void setPreferences(java.util.Collection<java.lang.String> args)
          Set the internal state to match the preferences.
 java.lang.String toString()
          Short name of the projection choice as shown in the GUI (combo box).
 
Methods inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
getCacheDir, getId, getProjection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code

protected java.lang.String code
Constructor Detail

SingleProjectionChoice

public SingleProjectionChoice(java.lang.String name,
                              java.lang.String id,
                              java.lang.String code,
                              java.lang.String cacheDir)
Constructor.

Parameters:
name - short name of the projection choice as shown in the GUI
id - unique identifier for the projection choice, e.g. "core:thisproj"
code - the unique identifier for the projection, e.g. "EPSG:1234"
cacheDir - a cache directory name

SingleProjectionChoice

public SingleProjectionChoice(java.lang.String name,
                              java.lang.String id,
                              java.lang.String code)
Method Detail

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

allCodes

public java.lang.String[] allCodes()
Description copied from interface: ProjectionChoice
Return all projection codes supported by this projection choice.


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.

Parameters:
args - preferences as a list of strings; may be null to reset everything.

getPreferences

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


toString

public java.lang.String toString()
Description copied from interface: ProjectionChoice
Short name of the projection choice as shown in the GUI (combo box).

Specified by:
toString in interface ProjectionChoice
Overrides:
toString in class AbstractProjectionChoice
Returns:
the name

getPreferencesFromCode

public java.util.Collection<java.lang.String> getPreferencesFromCode(java.lang.String code)
Description copied from interface: ProjectionChoice
Get Preferences from projection code.

Returns:
null when code is not part of this projection choice. An empty Collection as return value indicates, that the code is supported, but no preferences are required to set it up.

getCurrentCode

public java.lang.String getCurrentCode()
Specified by:
getCurrentCode in class AbstractProjectionChoice

getProjectionName

public java.lang.String getProjectionName()
Specified by:
getProjectionName in class AbstractProjectionChoice


JOSM