Package slash.navigation.routing

Examples of slash.navigation.routing.TravelMode


*/

public class TravelModeListCellRenderer extends DefaultListCellRenderer {
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        TravelMode travelMode = TravelMode.class.cast(value);
        String text;
        try {
            text = RouteConverter.getBundle().getString("travel-mode-" + travelMode.getName().toLowerCase());
        } catch (MissingResourceException e) {
            text = travelMode.getName();
        }
        label.setText(text);
        return label;
    }
View Full Code Here


                lal.add(asLongitudeAndLatitude(position));
            }
            routingService.downloadRoutingDataFor(lal);
        }

        TravelMode travelMode = r.getRoutingServiceFacade().getTravelMode();
        for (int i = 0; i < selectedPositions.size(); i++) {
            // skip the very last position without successor
            if (i == r.getPositionsModel().getRowCount() - 1 || i == selectedPositions.size() - 1)
                continue;
View Full Code Here

        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;
    }
View Full Code Here

        comboboxTravelMode.setRenderer(new TravelModeListCellRenderer());
        comboboxTravelMode.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() != SELECTED)
                    return;
                TravelMode travelMode = (TravelMode) e.getItem();
                r.getRoutingServiceFacade().setTravelMode(travelMode);
            }
        });
        checkBoxAvoidFerries.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
View Full Code Here

TOP

Related Classes of slash.navigation.routing.TravelMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.