Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
GeolocationSettingsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.geolocation;
20 
21 import java.awt.Color;
22 import java.io.File;
23 import java.sql.SQLException;
24 import java.util.Arrays;
25 import java.util.logging.Level;
26 import javax.swing.JFileChooser;
27 import javax.swing.JOptionPane;
28 import org.apache.commons.validator.routines.UrlValidator;
29 import org.jxmapviewer.OSMTileFactoryInfo;
30 import org.jxmapviewer.viewer.TileFactoryInfo;
31 import org.jxmapviewer.viewer.util.GeoUtil;
32 import org.netbeans.spi.options.OptionsPanelController;
33 import org.openide.util.NbBundle.Messages;
38 
44 final class GeolocationSettingsPanel extends javax.swing.JPanel implements OptionsPanel {
45 
46  private static final long serialVersionUID = 1L;
47 
48  private static final Logger logger = Logger.getLogger(GeolocationSettingsPanel.class.getName());
49 
53  GeolocationSettingsPanel() {
54  initComponents();
55  updateControlState();
56  }
57 
58  @Override
59  public void store() {
60  UserPreferences.setGeolocationTileOption(getDataSourceOption().getValue());
61  UserPreferences.setGeolocationOsmZipPath(zipFilePathField.getText());
62  UserPreferences.setGeolocationOsmServerAddress(osmServerAddressField.getText());
63  UserPreferences.setGeolocationMBTilesFilePath(mbtileFileField.getText());
64  }
65 
66  @Override
67  public void load() {
68  osmServerAddressField.setText(UserPreferences.getGeolocationOsmServerAddress());
69  zipFilePathField.setText(UserPreferences.getGeolocationOsmZipPath());
70  mbtileFileField.setText(UserPreferences.getGeolocationMBTilesFilePath());
71  switch (GeolocationDataSourceType.getOptionForValue(UserPreferences.getGeolocationtTileOption())) {
72  case ONLINE_USER_DEFINED_OSM_SERVER:
73  osmServerRBnt.setSelected(true);
74  break;
75  case OFFLINE_OSM_ZIP:
76  zipFileRBnt.setSelected(true);
77  break;
78  case OFFILE_MBTILES_FILE:
79  mbtilesRBtn.setSelected(true);
80  break;
81  default:
82  defaultDataSource.setSelected(true);
83  break;
84  }
85 
86  updateControlState();
87  }
88 
93  private void updateControlState() {
94  osmServerAddressField.setEnabled(osmServerRBnt.isSelected());
95  serverTestBtn.setEnabled(osmServerRBnt.isSelected());
96  zipFilePathField.setEnabled(zipFileRBnt.isSelected());
97  zipFileBrowseBnt.setEnabled(zipFileRBnt.isSelected());
98  mbtileFileField.setEnabled(mbtilesRBtn.isSelected());
99  mbtilesBrowseBtn.setEnabled(mbtilesRBtn.isSelected());
100  mbtileTestBtn.setEnabled(mbtilesRBtn.isSelected());
101  }
102 
109  private GeolocationDataSourceType getDataSourceOption() {
110  if (osmServerRBnt.isSelected()) {
111  return GeolocationDataSourceType.ONLINE_USER_DEFINED_OSM_SERVER;
112  } else if (zipFileRBnt.isSelected()) {
113  return GeolocationDataSourceType.OFFLINE_OSM_ZIP;
114  } else if (mbtilesRBtn.isSelected()) {
115  return GeolocationDataSourceType.OFFILE_MBTILES_FILE;
116  }
117  return GeolocationDataSourceType.ONLINE_DEFAULT_SERVER;
118  }
119 
132  private boolean testOSMServer(String url) {
133  TileFactoryInfo info = new OSMTileFactoryInfo("User Defined Server", url); //NON-NLS
134  return GeoUtil.isValidTile(1, 1, 1, info);
135  }
136 
137  void cancelChanges() {
138  load();
139  }
140 
146  @SuppressWarnings("unchecked")
147  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
148  private void initComponents() {
149  java.awt.GridBagConstraints gridBagConstraints;
150 
151  javax.swing.ButtonGroup buttonGroup = new javax.swing.ButtonGroup();
152  javax.swing.JPanel tilePane = new javax.swing.JPanel();
153  defaultDataSource = new javax.swing.JRadioButton();
154  osmServerRBnt = new javax.swing.JRadioButton();
155  osmServerAddressField = new javax.swing.JTextField();
156  zipFileRBnt = new javax.swing.JRadioButton();
157  zipFilePathField = new javax.swing.JTextField();
158  zipFileBrowseBnt = new javax.swing.JButton();
159  serverTestBtn = new javax.swing.JButton();
160  mbtilesRBtn = new javax.swing.JRadioButton();
161  mbtileFileField = new javax.swing.JTextField();
162  javax.swing.JPanel MBTilesBtnPanel = new javax.swing.JPanel();
163  mbtilesBrowseBtn = new javax.swing.JButton();
164  mbtileTestBtn = new javax.swing.JButton();
165 
166  setLayout(new java.awt.GridBagLayout());
167 
168  tilePane.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.tilePane.border.title"))); // NOI18N
169  tilePane.setLayout(new java.awt.GridBagLayout());
170 
171  buttonGroup.add(defaultDataSource);
172  defaultDataSource.setSelected(true);
173  org.openide.awt.Mnemonics.setLocalizedText(defaultDataSource, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.defaultDataSource.text")); // NOI18N
174  defaultDataSource.addActionListener(new java.awt.event.ActionListener() {
175  public void actionPerformed(java.awt.event.ActionEvent evt) {
176  defaultDataSourceActionPerformed(evt);
177  }
178  });
179  gridBagConstraints = new java.awt.GridBagConstraints();
180  gridBagConstraints.gridx = 0;
181  gridBagConstraints.gridy = 0;
182  gridBagConstraints.gridwidth = 4;
183  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
184  gridBagConstraints.weightx = 1.0;
185  gridBagConstraints.insets = new java.awt.Insets(9, 0, 9, 0);
186  tilePane.add(defaultDataSource, gridBagConstraints);
187 
188  buttonGroup.add(osmServerRBnt);
189  org.openide.awt.Mnemonics.setLocalizedText(osmServerRBnt, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.osmServerRBnt.text")); // NOI18N
190  osmServerRBnt.addActionListener(new java.awt.event.ActionListener() {
191  public void actionPerformed(java.awt.event.ActionEvent evt) {
192  osmServerRBntActionPerformed(evt);
193  }
194  });
195  gridBagConstraints = new java.awt.GridBagConstraints();
196  gridBagConstraints.gridx = 0;
197  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
198  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
199  tilePane.add(osmServerRBnt, gridBagConstraints);
200 
201  osmServerAddressField.setText(org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.osmServerAddressField.text")); // NOI18N
202  osmServerAddressField.setPreferredSize(new java.awt.Dimension(300, 26));
203  gridBagConstraints = new java.awt.GridBagConstraints();
204  gridBagConstraints.gridx = 1;
205  gridBagConstraints.gridy = 1;
206  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
207  tilePane.add(osmServerAddressField, gridBagConstraints);
208 
209  buttonGroup.add(zipFileRBnt);
210  org.openide.awt.Mnemonics.setLocalizedText(zipFileRBnt, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.zipFileRBnt.text")); // NOI18N
211  zipFileRBnt.setActionCommand(org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.zipFileRBnt.actionCommand")); // NOI18N
212  zipFileRBnt.addActionListener(new java.awt.event.ActionListener() {
213  public void actionPerformed(java.awt.event.ActionEvent evt) {
214  zipFileRBntActionPerformed(evt);
215  }
216  });
217  gridBagConstraints = new java.awt.GridBagConstraints();
218  gridBagConstraints.gridx = 0;
219  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
220  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
221  tilePane.add(zipFileRBnt, gridBagConstraints);
222 
223  zipFilePathField.setText(org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.zipFilePathField.text")); // NOI18N
224  zipFilePathField.setPreferredSize(new java.awt.Dimension(300, 26));
225  gridBagConstraints = new java.awt.GridBagConstraints();
226  gridBagConstraints.gridx = 1;
227  gridBagConstraints.gridy = 2;
228  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
229  tilePane.add(zipFilePathField, gridBagConstraints);
230 
231  org.openide.awt.Mnemonics.setLocalizedText(zipFileBrowseBnt, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.zipFileBrowseBnt.text")); // NOI18N
232  zipFileBrowseBnt.addActionListener(new java.awt.event.ActionListener() {
233  public void actionPerformed(java.awt.event.ActionEvent evt) {
234  zipFileBrowseBntActionPerformed(evt);
235  }
236  });
237  gridBagConstraints = new java.awt.GridBagConstraints();
238  gridBagConstraints.gridx = 2;
239  gridBagConstraints.gridy = 2;
240  gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
241  gridBagConstraints.insets = new java.awt.Insets(0, 9, 9, 9);
242  tilePane.add(zipFileBrowseBnt, gridBagConstraints);
243 
244  org.openide.awt.Mnemonics.setLocalizedText(serverTestBtn, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.serverTestBtn.text")); // NOI18N
245  serverTestBtn.addActionListener(new java.awt.event.ActionListener() {
246  public void actionPerformed(java.awt.event.ActionEvent evt) {
247  serverTestBtnActionPerformed(evt);
248  }
249  });
250  gridBagConstraints = new java.awt.GridBagConstraints();
251  gridBagConstraints.gridx = 2;
252  gridBagConstraints.gridy = 1;
253  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
254  gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
255  gridBagConstraints.insets = new java.awt.Insets(0, 9, 9, 9);
256  tilePane.add(serverTestBtn, gridBagConstraints);
257 
258  buttonGroup.add(mbtilesRBtn);
259  org.openide.awt.Mnemonics.setLocalizedText(mbtilesRBtn, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.mbtilesRBtn.text")); // NOI18N
260  mbtilesRBtn.addActionListener(new java.awt.event.ActionListener() {
261  public void actionPerformed(java.awt.event.ActionEvent evt) {
262  mbtilesRBtnActionPerformed(evt);
263  }
264  });
265  gridBagConstraints = new java.awt.GridBagConstraints();
266  gridBagConstraints.gridx = 0;
267  gridBagConstraints.gridy = 3;
268  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
269  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
270  tilePane.add(mbtilesRBtn, gridBagConstraints);
271 
272  mbtileFileField.setText(org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.mbtileFileField.text")); // NOI18N
273  mbtileFileField.setToolTipText(org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.mbtileFileField.toolTipText")); // NOI18N
274  mbtileFileField.setPreferredSize(new java.awt.Dimension(300, 26));
275  gridBagConstraints = new java.awt.GridBagConstraints();
276  gridBagConstraints.gridx = 1;
277  gridBagConstraints.gridy = 3;
278  gridBagConstraints.insets = new java.awt.Insets(0, 0, 9, 0);
279  tilePane.add(mbtileFileField, gridBagConstraints);
280 
281  MBTilesBtnPanel.setLayout(new java.awt.GridLayout(1, 0, 5, 0));
282 
283  org.openide.awt.Mnemonics.setLocalizedText(mbtilesBrowseBtn, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.mbtilesBrowseBtn.text")); // NOI18N
284  mbtilesBrowseBtn.addActionListener(new java.awt.event.ActionListener() {
285  public void actionPerformed(java.awt.event.ActionEvent evt) {
286  mbtilesBrowseBtnActionPerformed(evt);
287  }
288  });
289  MBTilesBtnPanel.add(mbtilesBrowseBtn);
290 
291  org.openide.awt.Mnemonics.setLocalizedText(mbtileTestBtn, org.openide.util.NbBundle.getMessage(GeolocationSettingsPanel.class, "GeolocationSettingsPanel.mbtileTestBtn.text")); // NOI18N
292  mbtileTestBtn.addActionListener(new java.awt.event.ActionListener() {
293  public void actionPerformed(java.awt.event.ActionEvent evt) {
294  mbtileTestBtnActionPerformed(evt);
295  }
296  });
297  MBTilesBtnPanel.add(mbtileTestBtn);
298 
299  gridBagConstraints = new java.awt.GridBagConstraints();
300  gridBagConstraints.gridx = 2;
301  gridBagConstraints.gridy = 3;
302  gridBagConstraints.gridwidth = 2;
303  gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
304  gridBagConstraints.insets = new java.awt.Insets(0, 9, 9, 9);
305  tilePane.add(MBTilesBtnPanel, gridBagConstraints);
306 
307  gridBagConstraints = new java.awt.GridBagConstraints();
308  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
309  gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
310  gridBagConstraints.weightx = 1.0;
311  gridBagConstraints.weighty = 1.0;
312  add(tilePane, gridBagConstraints);
313  }// </editor-fold>//GEN-END:initComponents
314 
315  private void zipFileBrowseBntActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zipFileBrowseBntActionPerformed
316  JFileChooser fileWindow = new JFileChooser();
317  fileWindow.setFileSelectionMode(JFileChooser.FILES_ONLY);
318  GeneralFilter fileFilter = new GeneralFilter(Arrays.asList(".zip"), "Zips (*.zip)"); //NON-NLS
319  fileWindow.setDragEnabled(false);
320  fileWindow.setFileFilter(fileFilter);
321  fileWindow.setMultiSelectionEnabled(false);
322  int returnVal = fileWindow.showSaveDialog(this);
323  if (returnVal == JFileChooser.APPROVE_OPTION) {
324  File zipFile = fileWindow.getSelectedFile();
325  zipFilePathField.setForeground(Color.BLACK);
326  zipFilePathField.setText(zipFile.getAbsolutePath());
327  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
328  }
329  }//GEN-LAST:event_zipFileBrowseBntActionPerformed
330 
331  private void defaultDataSourceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultDataSourceActionPerformed
332  updateControlState();
333  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
334  }//GEN-LAST:event_defaultDataSourceActionPerformed
335 
336  private void osmServerRBntActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_osmServerRBntActionPerformed
337  updateControlState();
338  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
339  }//GEN-LAST:event_osmServerRBntActionPerformed
340 
341  private void zipFileRBntActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zipFileRBntActionPerformed
342  updateControlState();
343  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
344  }//GEN-LAST:event_zipFileRBntActionPerformed
345 
346  @Messages({
347  "GeolocationSettingsPanel_malformed_url_message=The supplied OSM tile server address is invalid.\nPlease supply a well formed url prefixed with http://",
348  "GeolocationSettingsPanel_malformed_url_message_tile=Malformed URL",
349  "GeolocationSettingsPanel_osm_server_test_fail_message=OSM tile server test failed.\nUnable to connect to server.",
350  "GeolocationSettingsPanel_osm_server_test_fail_message_title=Error",
351  "GeolocationSettingsPanel_osm_server_test_success_message=The provided OSM tile server address is valid.",
352  "GeolocationSettingsPanel_osm_server_test_success_message_title=Success",})
353  private void serverTestBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serverTestBtnActionPerformed
354  String address = osmServerAddressField.getText();
355  String message = Bundle.GeolocationSettingsPanel_osm_server_test_fail_message();
356  String title = Bundle.GeolocationSettingsPanel_osm_server_test_fail_message_title();
357 
358  String[] schemes = {"http", "https"}; //NON-NLS
359  UrlValidator urlValidator = new UrlValidator(schemes);
360  if (!urlValidator.isValid(address)) {
361  message = Bundle.GeolocationSettingsPanel_malformed_url_message();
362  title = Bundle.GeolocationSettingsPanel_malformed_url_message_tile();
363  } else if (testOSMServer(address)) {
364  message = Bundle.GeolocationSettingsPanel_osm_server_test_success_message();
365  title = Bundle.GeolocationSettingsPanel_osm_server_test_success_message_title();
366  }
367 
368  JOptionPane.showMessageDialog(this, message, title, JOptionPane.INFORMATION_MESSAGE);
369  }//GEN-LAST:event_serverTestBtnActionPerformed
370 
371  private void mbtilesRBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mbtilesRBtnActionPerformed
372  updateControlState();
373  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
374  }//GEN-LAST:event_mbtilesRBtnActionPerformed
375 
376  private void mbtilesBrowseBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mbtilesBrowseBtnActionPerformed
377  JFileChooser fileWindow = new JFileChooser();
378  fileWindow.setFileSelectionMode(JFileChooser.FILES_ONLY);
379  GeneralFilter fileFilter = new GeneralFilter(Arrays.asList(".mbtiles"), "MBTiles (*.mbtiles)"); //NON-NLS
380  fileWindow.setDragEnabled(false);
381  fileWindow.setFileFilter(fileFilter);
382  fileWindow.setMultiSelectionEnabled(false);
383  int returnVal = fileWindow.showSaveDialog(this);
384  if (returnVal == JFileChooser.APPROVE_OPTION) {
385  File zipFile = fileWindow.getSelectedFile();
386  mbtileFileField.setForeground(Color.BLACK);
387  mbtileFileField.setText(zipFile.getAbsolutePath());
388  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
389  }
390  }//GEN-LAST:event_mbtilesBrowseBtnActionPerformed
391 
392  @Messages({
393  "GeolocationSettings_mbtile_does_not_exist_message=The file supplied does not exist.\nPlease verify that the file exists and try again.",
394  "GeolocationSettings_mbtile_does_not_exist_title=File Not Found",
395  "GeolocationSettings_mbtile_not_valid_message=The supplied file is not a raster tile file.",
396  "GeolocationSettings_mbtile_not_valid_title=File Not Valid",
397  "GeolocationSettings_path_not_valid_message=The supplied file path is empty.\nPlease supply a valid file path.",
398  "GeolocationSettings_path_not_valid_title=File Not Valid",
399  "GeolocationSettings_mbtile_test_success_message=The supplied file is a valid mbtile raster file.",
400  "GeolocationSettings_mbtile_test_success_title=Success",
401  })
402  private void mbtileTestBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mbtileTestBtnActionPerformed
403  String mbtilePath = mbtileFileField.getText();
404 
405  if(mbtilePath.isEmpty()) {
406  JOptionPane.showMessageDialog(this, Bundle.GeolocationSettings_path_not_valid_message(), Bundle.GeolocationSettings_path_not_valid_title(), JOptionPane.ERROR_MESSAGE);
407  return;
408  }
409 
410  File file = new File(mbtilePath);
411  if(!file.exists()) {
412  JOptionPane.showMessageDialog(this, Bundle.GeolocationSettings_mbtile_does_not_exist_message(), Bundle.GeolocationSettings_mbtile_does_not_exist_title(), JOptionPane.ERROR_MESSAGE);
413  return;
414  }
415 
416  try {
417  if(!MBTilesFileConnector.isValidMBTileRasterFile(mbtilePath)) {
418  JOptionPane.showMessageDialog(this, Bundle.GeolocationSettings_mbtile_not_valid_message(), Bundle.GeolocationSettings_mbtile_not_valid_title(), JOptionPane.ERROR_MESSAGE);
419  return;
420  }
421  } catch (SQLException ex) {
422  JOptionPane.showMessageDialog(this, Bundle.GeolocationSettings_mbtile_not_valid_message(), Bundle.GeolocationSettings_mbtile_not_valid_title(), JOptionPane.ERROR_MESSAGE);
423  logger.log(Level.WARNING, String.format("Exception thrown while testing mbtile file %s", mbtilePath), ex);
424  return;
425  }
426 
427  JOptionPane.showMessageDialog(this, Bundle.GeolocationSettings_mbtile_test_success_message(), Bundle.GeolocationSettings_mbtile_test_success_title(), JOptionPane.INFORMATION_MESSAGE);
428  }//GEN-LAST:event_mbtileTestBtnActionPerformed
429 
430 
431  // Variables declaration - do not modify//GEN-BEGIN:variables
432  private javax.swing.JRadioButton defaultDataSource;
433  private javax.swing.JTextField mbtileFileField;
434  private javax.swing.JButton mbtileTestBtn;
435  private javax.swing.JButton mbtilesBrowseBtn;
436  private javax.swing.JRadioButton mbtilesRBtn;
437  private javax.swing.JTextField osmServerAddressField;
438  private javax.swing.JRadioButton osmServerRBnt;
439  private javax.swing.JButton serverTestBtn;
440  private javax.swing.JButton zipFileBrowseBnt;
441  private javax.swing.JTextField zipFilePathField;
442  private javax.swing.JRadioButton zipFileRBnt;
443  // End of variables declaration//GEN-END:variables
444 
449  enum GeolocationDataSourceType{
450  ONLINE_DEFAULT_SERVER(0),
451  ONLINE_USER_DEFINED_OSM_SERVER(1),
452  OFFLINE_OSM_ZIP(2),
453  OFFILE_MBTILES_FILE(3);
454 
455  private final int value;
456 
457  GeolocationDataSourceType(int value) {
458  this.value = value;
459  }
460 
461  int getValue() {
462  return value;
463  }
464 
465  static GeolocationDataSourceType getOptionForValue(int value) {
466  for (GeolocationDataSourceType option : GeolocationDataSourceType.values()) {
467  if (option.getValue() == value) {
468  return option;
469  }
470  }
471 
472  return ONLINE_DEFAULT_SERVER;
473  }
474  }
475 
476 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.