preferences.put(ROUTING_SERVICE_PREFERENCE, service.getName());
fireChanged();
}
public TravelMode getTravelMode() {
TravelMode preferredTravelMode = getRoutingService().getPreferredTravelMode();
String lookupName = preferences.get(TRAVEL_MODE_PREFERENCE + getRoutingService().getName(), preferredTravelMode.getName());
for (TravelMode travelMode : getRoutingService().getAvailableTravelModes()) {
if (lookupName.equals(travelMode.getName()))
return travelMode;
}
if (!loggedFailedTravelModeWarning) {
log.warning(format("Failed to find travel mode %s; using preferred travel mode %s", lookupName, preferredTravelMode.getName()));
loggedFailedTravelModeWarning = true;
}
return preferredTravelMode;
}