1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.gui.preferences;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import javax.swing.JLabel;
|
---|
7 | import javax.swing.JTextField;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.tools.GBC;
|
---|
11 |
|
---|
12 | public class CsvPreference implements PreferenceSetting {
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Comma seperated import string specifier or <code>null</code> if the first
|
---|
16 | * data line should be interpreted as one.
|
---|
17 | */
|
---|
18 | private JTextField csvImportString = new JTextField(20);
|
---|
19 |
|
---|
20 | public void addGui(PreferenceDialog gui) {
|
---|
21 | csvImportString.setText(Main.pref.get("csv.importstring"));
|
---|
22 | csvImportString.setToolTipText(tr("<html>Import string specification. lat/lon and time are imported.<br>" +
|
---|
23 | "<b>lat</b>: The latitude coordinate<br>" +
|
---|
24 | "<b>lon</b>: The longitude coordinate<br>" +
|
---|
25 | "<b>time</b>: The measured time as string<br>" +
|
---|
26 | "<b>ignore</b>: Skip this field<br>" +
|
---|
27 | "An example: \"ignore ignore lat lon\" will use ' ' as delimiter, skip the first two values and read then lat/lon.<br>" +
|
---|
28 | "Other example: \"lat,lon\" will just read lat/lon values comma seperated.</html>"));
|
---|
29 |
|
---|
30 | gui.connection.add(new JLabel(tr("CSV import specification (empty: read from first line in data)")), GBC.eol());
|
---|
31 | gui.connection.add(csvImportString, GBC.eop().fill(GBC.HORIZONTAL));
|
---|
32 | }
|
---|
33 |
|
---|
34 | public void ok() {
|
---|
35 | Main.pref.put("csv.importstring", csvImportString.getText());
|
---|
36 | }
|
---|
37 |
|
---|
38 | }
|
---|