public void changedUpdate(DocumentEvent e) {
insertUpdate(e);
}
});
textFieldBabelPath.setText(BabelFormat.getBabelPathPreference());
buttonChooseBabelPath.addActionListener(new FrameAction() {
public void run() {
chooseBabelPath();
}
});
new CheckBoxPreferencesSynchronizer(checkBoxAutomaticUpdateCheck, getPreferences(), AUTOMATIC_UPDATE_CHECK_PREFERENCE, true);
new CheckBoxPreferencesSynchronizer(checkBoxRecenterAfterZooming, getPreferences(), RECENTER_AFTER_ZOOMING_PREFERENCE, false);
checkBoxRecenterAfterZooming.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
r.setRecenterAfterZooming(checkBoxRecenterAfterZooming.isSelected());
}
});
new CheckBoxPreferencesSynchronizer(checkBoxShowCoordinates, getPreferences(), SHOW_COORDINATES_PREFERENCE, false);
checkBoxShowCoordinates.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
r.setShowCoordinates(checkBoxShowCoordinates.isSelected());
}
});
new CheckBoxPreferencesSynchronizer(checkBoxShowWaypointDescription, getPreferences(), SHOW_WAYPOINT_DESCRIPTION_PREFERENCE, false);
checkBoxShowWaypointDescription.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
r.setShowWaypointDescription(checkBoxShowWaypointDescription.isSelected());
}
});
DefaultComboBoxModel<RoutingService> routingServiceModel = new DefaultComboBoxModel<>();
for (RoutingService service : r.getRoutingServiceFacade().getRoutingServices())
routingServiceModel.addElement(service);
routingServiceModel.setSelectedItem(r.getRoutingServiceFacade().getRoutingService());
comboBoxRoutingService.setModel(routingServiceModel);
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();
}
});
textFieldRoutingServicePath.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
r.getRoutingServiceFacade().getRoutingService().setPath(textFieldRoutingServicePath.getText());
}
public void removeUpdate(DocumentEvent e) {
insertUpdate(e);
}
public void changedUpdate(DocumentEvent e) {
insertUpdate(e);
}
});
buttonChooseRoutingServicePath.addActionListener(new FrameAction() {
public void run() {
chooseRoutingServicePath();
}
});
handleRoutingServiceUpdate();
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) {
r.getRoutingServiceFacade().setAvoidFerries(checkBoxAvoidFerries.isSelected());
}
});
checkBoxAvoidHighways.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
r.getRoutingServiceFacade().setAvoidHighways(checkBoxAvoidHighways.isSelected());
}
});
checkBoxAvoidTolls.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
r.getRoutingServiceFacade().setAvoidTolls(checkBoxAvoidTolls.isSelected());
}
});
ComboBoxModel<NumberPattern> numberPatternModel = new DefaultComboBoxModel<>(new NumberPattern[]{
Description_Only, Number_Only, Number_Directly_Followed_By_Description, Number_Space_Then_Description
});
numberPatternModel.setSelectedItem(r.getNumberPatternPreference());
comboboxNumberPattern.setModel(numberPatternModel);
comboboxNumberPattern.setRenderer(new NumberPatternListCellRenderer());
comboboxNumberPattern.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() != SELECTED)
return;
NumberPattern numberPattern = NumberPattern.class.cast(e.getItem());
r.setNumberPatternPreference(numberPattern);
}
});
DefaultComboBoxModel<ElevationService> elevationServiceModel = new DefaultComboBoxModel<>();
for (ElevationService service : r.getElevationServiceFacade().getElevationServices())
elevationServiceModel.addElement(service);
elevationServiceModel.setSelectedItem(r.getElevationServiceFacade().getElevationService());
comboBoxElevationService.setModel(elevationServiceModel);
comboBoxElevationService.setRenderer(new ElevationServiceListCellRenderer());
comboBoxElevationService.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() != SELECTED)
return;
ElevationService service = ElevationService.class.cast(e.getItem());
r.getElevationServiceFacade().setElevationService(service);
handleElevationServiceUpdate();
}
});
textFieldElevationServicePath.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
r.getElevationServiceFacade().getElevationService().setPath(textFieldElevationServicePath.getText());
}
public void removeUpdate(DocumentEvent e) {
insertUpdate(e);
}
public void changedUpdate(DocumentEvent e) {
insertUpdate(e);
}
});
buttonChooseElevationServicePath.addActionListener(new FrameAction() {
public void run() {
chooseElevationServicePath();
}
});
handleElevationServiceUpdate();