Ignore:
Timestamp:
2012-02-14T21:43:28+01:00 (12 years ago)
Author:
stoecker
Message:

remove calls to deprecated Preferences.hasKey()

Location:
applications/editors/josm/plugins/routing/src/com/innovant/josm
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java

    r26119 r27760  
    2727
    2828package com.innovant.josm.plugin.routing;
     29
     30import static org.openstreetmap.josm.tools.I18n.marktr;
    2931
    3032import java.awt.BasicStroke;
     
    5961import org.openstreetmap.josm.tools.ImageProvider;
    6062
    61 import com.innovant.josm.jrt.core.PreferencesKeys;
    6263import com.innovant.josm.jrt.osm.OsmEdge;
    6364
     
    6970 */
    7071public class RoutingLayer extends Layer {
     72
     73    public enum PreferencesKeys {
     74        KEY_ACTIVE_ROUTE_COLOR (marktr("routing active route")),
     75        KEY_INACTIVE_ROUTE_COLOR (marktr("routing inactive route")),
     76        KEY_ROUTE_WIDTH ("routing.route.width"),
     77        KEY_ROUTE_SELECT ("routing.route.select");
     78
     79        public final String key;
     80        PreferencesKeys (String key) {
     81            this.key=key;
     82        }
     83
     84        public String getKey() {return key;};
     85    }
    7186
    7287    /**
     
    240255        // Get path stroke color from preferences
    241256        // Color is different for active and inactive layers
    242         String colorString;
     257        Color color;
    243258        if (isActiveLayer) {
    244             if (Main.pref.hasKey(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key))
    245                     colorString = Main.pref.get(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key);
    246             else {
    247                 colorString = ColorHelper.color2html(Color.RED);
    248                 Main.pref.put(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key, colorString);
    249             }
     259            color = Main.pref.getColor(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key, Color.RED);
    250260        } else {
    251             if (Main.pref.hasKey(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key))
    252                 colorString = Main.pref.get(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key);
    253             else {
    254                 colorString = ColorHelper.color2html(Color.decode("#dd2222"));
    255                 Main.pref.put(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key, colorString);
    256             }
    257         }
    258         Color color = ColorHelper.html2color(colorString);
     261            color = Main.pref.getColor(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key, Color.decode("#dd2222"));
     262        }
    259263
    260264        // Get path stroke width from preferences
Note: See TracChangeset for help on using the changeset viewer.