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

java.lang.Object
  extended by org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference
All Implemented Interfaces:
PreferenceSetting, SubPreferenceSetting

public class ProjectionPreference
extends java.lang.Object
implements SubPreferenceSetting


Nested Class Summary
static class ProjectionPreference.Factory
           
 
Field Summary
private static java.util.Map<java.lang.String,java.lang.String> aliasNormalizer
           
private  javax.swing.JLabel bounds
           
private  JosmComboBox coordinatesCombo
          Combobox with all coordinate display possibilities
static ProjectionChoice mercator
           
private static java.util.List<ProjectionChoice> projectionChoices
           
private static java.util.Map<java.lang.String,ProjectionChoice> projectionChoicesById
           
private  javax.swing.JLabel projectionCode
           
private  java.awt.Component projectionCodeGlue
           
private  javax.swing.JLabel projectionCodeLabel
           
private  JosmComboBox projectionCombo
          Combobox with all projections available
private  javax.swing.JPanel projPanel
          This is the panel holding all projection preferences
private  javax.swing.JPanel projSubPrefPanel
          This variable holds the JPanel with the projection's preferences.
private static GBC projSubPrefPanelGBC
          The GridBagConstraints for the Panel containing the ProjectionSubPrefs.
private  javax.swing.JPanel projSubPrefPanelWrapper
           
private static StringProperty PROP_COORDINATES
           
private static StringProperty PROP_PROJECTION
           
private static CollectionProperty PROP_SUB_PROJECTION
           
static StringProperty PROP_SYSTEM_OF_MEASUREMENT
           
private  JosmComboBox unitsCombo
           
private static java.lang.String[] unitsValues
           
private static java.lang.String[] unitsValuesTr
           
 
Constructor Summary
ProjectionPreference()
           
 
Method Summary
 void addGui(PreferenceTabbedPane gui)
          Add the GUI elements to the dialog.
static java.util.List<ProjectionChoice> getProjectionChoices()
           
private  java.util.Collection<java.lang.String> getSubprojectionPreference(ProjectionChoice pc)
           
 TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui)
          Returns the preference setting (displayed in the specified preferences tab pane) that contains this preference setting.
 boolean isExpert()
          Called to know if the preferences tab has only to be displayed in expert mode.
 boolean ok()
          Called when OK is pressed to save the setting in the preferences file.
static void registerProjectionChoice(ProjectionChoice c)
           
static void registerProjectionChoice(java.lang.String id, Projection projection)
           
private  void selectedProjectionChanged(ProjectionChoice pc)
          Handles all the work related to update the projection-specific preferences
static void setProjection()
           
static void setProjection(java.lang.String id, java.util.Collection<java.lang.String> pref)
           
private  ProjectionChoice setupProjectionCombo()
          Sets up projection combobox with default values and action listener
private  void updateMeta(ProjectionChoice pc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

projectionChoices

private static java.util.List<ProjectionChoice> projectionChoices

projectionChoicesById

private static java.util.Map<java.lang.String,ProjectionChoice> projectionChoicesById

aliasNormalizer

private static java.util.Map<java.lang.String,java.lang.String> aliasNormalizer

mercator

public static ProjectionChoice mercator

PROP_PROJECTION

private static final StringProperty PROP_PROJECTION

PROP_COORDINATES

private static final StringProperty PROP_COORDINATES

PROP_SUB_PROJECTION

private static final CollectionProperty PROP_SUB_PROJECTION

PROP_SYSTEM_OF_MEASUREMENT

public static final StringProperty PROP_SYSTEM_OF_MEASUREMENT

unitsValues

private static final java.lang.String[] unitsValues

unitsValuesTr

private static final java.lang.String[] unitsValuesTr

projectionCombo

private JosmComboBox projectionCombo
Combobox with all projections available


coordinatesCombo

private JosmComboBox coordinatesCombo
Combobox with all coordinate display possibilities


unitsCombo

private JosmComboBox unitsCombo

projSubPrefPanel

private javax.swing.JPanel projSubPrefPanel
This variable holds the JPanel with the projection's preferences. If the selected projection does not implement this, it will be set to an empty Panel.


projSubPrefPanelWrapper

private javax.swing.JPanel projSubPrefPanelWrapper

projectionCodeLabel

private javax.swing.JLabel projectionCodeLabel

projectionCodeGlue

private java.awt.Component projectionCodeGlue

projectionCode

private javax.swing.JLabel projectionCode

bounds

private javax.swing.JLabel bounds

projPanel

private javax.swing.JPanel projPanel
This is the panel holding all projection preferences


projSubPrefPanelGBC

private static GBC projSubPrefPanelGBC
The GridBagConstraints for the Panel containing the ProjectionSubPrefs. This is required twice in the code, creating it here keeps both occurrences in sync

Constructor Detail

ProjectionPreference

public ProjectionPreference()
Method Detail

registerProjectionChoice

public static void registerProjectionChoice(ProjectionChoice c)

registerProjectionChoice

public static void registerProjectionChoice(java.lang.String id,
                                            Projection projection)

getProjectionChoices

public static java.util.List<ProjectionChoice> getProjectionChoices()

addGui

public void addGui(PreferenceTabbedPane gui)
Description copied from interface: PreferenceSetting
Add the GUI elements to the dialog. The elements should be initialized after the current preferences.

Specified by:
addGui in interface PreferenceSetting

updateMeta

private void updateMeta(ProjectionChoice pc)

ok

public boolean ok()
Description copied from interface: PreferenceSetting
Called when OK is pressed to save the setting in the preferences file. Return true when restart is required.

Specified by:
ok in interface PreferenceSetting

setProjection

public static void setProjection()

setProjection

public static void setProjection(java.lang.String id,
                                 java.util.Collection<java.lang.String> pref)

selectedProjectionChanged

private void selectedProjectionChanged(ProjectionChoice pc)
Handles all the work related to update the projection-specific preferences

Parameters:
proj -

setupProjectionCombo

private ProjectionChoice setupProjectionCombo()
Sets up projection combobox with default values and action listener


getSubprojectionPreference

private java.util.Collection<java.lang.String> getSubprojectionPreference(ProjectionChoice pc)

isExpert

public boolean isExpert()
Description copied from interface: PreferenceSetting
Called to know if the preferences tab has only to be displayed in expert mode.

Specified by:
isExpert in interface PreferenceSetting
Returns:
true if the tab has only to be displayed in expert mode, false otherwise.

getTabPreferenceSetting

public TabPreferenceSetting getTabPreferenceSetting(PreferenceTabbedPane gui)
Description copied from interface: SubPreferenceSetting
Returns the preference setting (displayed in the specified preferences tab pane) that contains this preference setting.

Specified by:
getTabPreferenceSetting in interface SubPreferenceSetting


JOSM