Changeset 12674 in josm


Ignore:
Timestamp:
2017-08-27T17:29:32+02:00 (4 weeks ago)
Author:
Don-vip
Message:

see #15182 - move PROP_SYSTEM_OF_MEASUREMENT from gui.preferences.ProjectionPreferences to data.SystemOfMeasurment

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java

    r12542 r12674  
    1313
    1414import org.openstreetmap.josm.Main;
    15 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
     15import org.openstreetmap.josm.data.preferences.StringProperty;
    1616
    1717/**
    1818 * A system of units used to express length and area measurements.
    1919 * <p>
    20  * This class also manages one globally set system of measurement stored in the {@link ProjectionPreference}
     20 * This class also manages one globally set system of measurement stored in the {@code ProjectionPreference}
    2121 * @since 3406 (creation)
    2222 * @since 6992 (extraction in this package)
    2323 */
    2424public class SystemOfMeasurement {
     25
     26    /**
     27     * Preferences entry for system of measurement.
     28     * @since 12674 (moved from ProjectionPreference)
     29     */
     30    public static final StringProperty PROP_SYSTEM_OF_MEASUREMENT = new StringProperty("system_of_measurement", "Metric");
    2531
    2632    /**
     
    116122     */
    117123    public static SystemOfMeasurement getSystemOfMeasurement() {
    118         return Optional.ofNullable(SystemOfMeasurement.ALL_SYSTEMS.get(ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get()))
     124        return Optional.ofNullable(SystemOfMeasurement.ALL_SYSTEMS.get(PROP_SYSTEM_OF_MEASUREMENT.get()))
    119125                .orElse(SystemOfMeasurement.METRIC);
    120126    }
     
    130136            throw new IllegalArgumentException("Invalid system of measurement: "+somKey);
    131137        }
    132         String oldKey = ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get();
    133         if (ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.put(somKey)) {
     138        String oldKey = PROP_SYSTEM_OF_MEASUREMENT.get();
     139        if (PROP_SYSTEM_OF_MEASUREMENT.put(somKey)) {
    134140            fireSoMChanged(oldKey, somKey);
    135141        }
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r12663 r12674  
    7171import org.openstreetmap.josm.data.preferences.DoubleProperty;
    7272import org.openstreetmap.josm.gui.help.Helpful;
    73 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    7473import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;
    7574import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor.ProgressMonitorDialog;
     
    807806                    Component invoker = ((JPopupMenu) e.getSource()).getInvoker();
    808807                    jumpButton.setVisible(latText.equals(invoker) || lonText.equals(invoker));
    809                     String currentSOM = ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get();
     808                    String currentSOM = SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.get();
    810809                    for (JMenuItem item : somItems) {
    811810                        item.setSelected(item.getText().equals(currentSOM));
     
    919918                public void mouseClicked(MouseEvent e) {
    920919                    if (!e.isPopupTrigger() && e.getButton() == MouseEvent.BUTTON1) {
    921                         String som = ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get();
     920                        String som = SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.get();
    922921                        String newsom = soms.get((soms.indexOf(som)+1) % soms.size());
    923922                        updateSystemOfMeasurement(newsom);
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java

    r12486 r12674  
    273273
    274274    private static String projectionChoice;
    275    
     275
    276276    private static final StringProperty PROP_PROJECTION_DEFAULT = new StringProperty("projection.default", mercator.getId());
    277277    private static final StringProperty PROP_COORDINATES = new StringProperty("coordinates", null);
    278278    private static final CollectionProperty PROP_SUB_PROJECTION_DEFAULT = new CollectionProperty("projection.default.sub", null);
    279     public static final StringProperty PROP_SYSTEM_OF_MEASUREMENT = new StringProperty("system_of_measurement", "Metric");
    280279    private static final String[] unitsValues = ALL_SYSTEMS.keySet().toArray(new String[ALL_SYSTEMS.size()]);
    281280    private static final String[] unitsValuesTr = new String[unitsValues.length];
     
    339338
    340339        for (int i = 0; i < unitsValues.length; ++i) {
    341             if (unitsValues[i].equals(PROP_SYSTEM_OF_MEASUREMENT.get())) {
     340            if (unitsValues[i].equals(SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.get())) {
    342341                unitsCombo.setSelectedIndex(i);
    343342                break;
Note: See TracChangeset for help on using the changeset viewer.