Package slash.navigation.routing

Examples of slash.navigation.routing.RoutingService


*/

public class RoutingServiceListCellRenderer 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);
        RoutingService service = RoutingService.class.cast(value);
        label.setText(service.getName());
        return label;
    }
View Full Code Here


    public void insertAllWaypoints() {
        RouteConverter r = RouteConverter.getInstance();
        int[] selectedRows = r.getPositionsView().getSelectedRows();
        r.clearSelection();

        RoutingService routingService = r.getRoutingServiceFacade().getRoutingService();
        if (routingService instanceof GoogleDirections && r.isMapViewInitialized()) {
            ((GoogleDirections) routingService).insertAllWaypoints(selectedRows);
        } else
            insertWithRoutingService(routingService, selectedRows);
    }
View Full Code Here

    public void insertOnlyTurnpoints() {
        RouteConverter r = RouteConverter.getInstance();
        int[] selectedRows = r.getPositionsView().getSelectedRows();
        r.clearSelection();

        RoutingService routingService = r.getRoutingServiceFacade().getRoutingService();
        if (routingService instanceof GoogleDirections && r.isMapViewInitialized()) {
            ((GoogleDirections) routingService).insertOnlyTurnpoints(selectedRows);
        } else
            throw new UnsupportedOperationException();
    }
View Full Code Here

    public void addRoutingService(RoutingService routingService) {
        routingServices.add(0, routingService);
    }

    public RoutingService getRoutingService() {
        RoutingService firstRoutingService = getRoutingServices().size() > 0 ? getRoutingServices().get(0) : null;
        if (firstRoutingService == null)
            return null;

        String lookupServiceName = preferences.get(ROUTING_SERVICE_PREFERENCE, firstRoutingService.getName());

        for (RoutingService service : getRoutingServices()) {
            if (lookupServiceName.endsWith(service.getName()))
                return service;
        }
View Full Code Here

        comboBoxRoutingService.setRenderer(new RoutingServiceListCellRenderer());
        comboBoxRoutingService.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() != SELECTED)
                    return;
                RoutingService service = RoutingService.class.cast(e.getItem());
                r.getRoutingServiceFacade().setRoutingService(service);
                handleRoutingServiceUpdate();
            }
        });
View Full Code Here

        }, getKeyStroke(VK_ESCAPE, 0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    }

    private void handleRoutingServiceUpdate() {
        RoutingServiceFacade routingServiceFacade = RouteConverter.getInstance().getRoutingServiceFacade();
        RoutingService service = routingServiceFacade.getRoutingService();
        textFieldRoutingServicePath.setEnabled(service.isDownload());
        textFieldRoutingServicePath.setText(service.isDownload() ? service.getPath() : "");
        buttonChooseRoutingServicePath.setEnabled(service.isDownload());
        checkBoxAvoidFerries.setSelected(routingServiceFacade.isAvoidFerries());
        checkBoxAvoidHighways.setSelected(routingServiceFacade.isAvoidHighways());
        checkBoxAvoidTolls.setSelected(routingServiceFacade.isAvoidTolls());
        updateTravelModes();
    }
View Full Code Here

        updateTravelModes();
    }

    private void updateTravelModes() {
        RoutingServiceFacade serviceFacade = RouteConverter.getInstance().getRoutingServiceFacade();
        RoutingService service = serviceFacade.getRoutingService();

        MutableComboBoxModel<TravelMode> travelModeModel = new DefaultComboBoxModel<>();
        for (TravelMode travelMode : service.getAvailableTravelModes())
            travelModeModel.addElement(travelMode);
        travelModeModel.setSelectedItem(serviceFacade.getTravelMode());
        comboboxTravelMode.setModel(travelModeModel);
    }
View Full Code Here

TOP

Related Classes of slash.navigation.routing.RoutingService

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.