X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fsave%2FFileSaver.java;h=45af83e0a7cac09286848f55be8508b3d2e87c9e;hb=92dad5df664287acb51728e9ea599f150765d34a;hp=f5f92bcc91af9ba6aec94e26877400b0bc4598c2;hpb=d3679d647d57c2ee7376ddbf6def2d5b23c04307;p=GpsPrune.git diff --git a/tim/prune/save/FileSaver.java b/tim/prune/save/FileSaver.java index f5f92bc..45af83e 100644 --- a/tim/prune/save/FileSaver.java +++ b/tim/prune/save/FileSaver.java @@ -25,29 +25,36 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; +import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.ListSelectionModel; +import javax.swing.table.TableModel; import tim.prune.App; import tim.prune.I18nManager; -import tim.prune.data.Altitude; +import tim.prune.UpdateMessageBroker; +import tim.prune.config.Config; import tim.prune.data.Coordinate; import tim.prune.data.DataPoint; import tim.prune.data.Field; import tim.prune.data.FieldList; +import tim.prune.data.RecentFile; +import tim.prune.data.Timestamp; import tim.prune.data.Track; +import tim.prune.data.Unit; +import tim.prune.data.UnitSetLibrary; +import tim.prune.load.GenericFileFilter; import tim.prune.load.OneCharDocument; /** * Class to manage the saving of track data - * into a user-specified file + * as text into a user-specified file */ public class FileSaver { private App _app = null; private JFrame _parentFrame = null; - private Track _track = null; private JDialog _dialog = null; private JFileChooser _fileChooser = null; private JPanel _cards = null; @@ -55,27 +62,30 @@ public class FileSaver private JTable _table = null; private FieldSelectionTableModel _model = null; private JButton _moveUpButton = null, _moveDownButton = null; + private UpDownToggler _toggler = null; private JRadioButton[] _delimiterRadios = null; private JTextField _otherDelimiterText = null; private JCheckBox _headerRowCheckbox = null; + private PointTypeSelector _pointTypeSelector = null; private JRadioButton[] _coordUnitsRadios = null; private JRadioButton[] _altitudeUnitsRadios = null; + private JRadioButton[] _timestampUnitsRadios = null; + private static final int[] FORMAT_COORDS = {Coordinate.FORMAT_NONE, Coordinate.FORMAT_DEG_MIN_SEC, Coordinate.FORMAT_DEG_MIN, Coordinate.FORMAT_DEG}; - private static final int[] FORMAT_ALTS = {Altitude.FORMAT_NONE, Altitude.FORMAT_METRES, Altitude.FORMAT_FEET}; + private static final Unit[] UNIT_ALTS = {null, UnitSetLibrary.UNITS_METRES, UnitSetLibrary.UNITS_FEET}; + private static final Timestamp.Format[] FORMAT_TIMES = {Timestamp.Format.ORIGINAL, Timestamp.Format.LOCALE, Timestamp.Format.ISO8601}; /** * Constructor * @param inApp application object to inform of success * @param inParentFrame parent frame - * @param inTrack track object to save */ - public FileSaver(App inApp, JFrame inParentFrame, Track inTrack) + public FileSaver(App inApp, JFrame inParentFrame) { _app = inApp; _parentFrame = inParentFrame; - _track = inTrack; } @@ -85,31 +95,43 @@ public class FileSaver */ public void showDialog(char inDefaultDelimiter) { - _dialog = new JDialog(_parentFrame, I18nManager.getText("dialog.saveoptions.title"), true); - _dialog.setLocationRelativeTo(_parentFrame); + if (_dialog == null) + { + _dialog = new JDialog(_parentFrame, I18nManager.getText("dialog.saveoptions.title"), true); + _dialog.setLocationRelativeTo(_parentFrame); + _dialog.getContentPane().add(makeDialogComponents()); + _dialog.pack(); + } + // Has the track got media? + final boolean hasMedia = _app.getTrackInfo().getPhotoList().hasCorrelatedPhotos() + || _app.getTrackInfo().getAudioList().hasCorrelatedAudios(); // Check field list - FieldList fieldList = _track.getFieldList(); + Track track = _app.getTrackInfo().getTrack(); + FieldList fieldList = track.getFieldList(); int numFields = fieldList.getNumFields(); - _model = new FieldSelectionTableModel(numFields); + _model = new FieldSelectionTableModel(numFields + (hasMedia ? 1 : 0)); for (int i=0; i=selStart && p<=selEnd)); + if (!savePoint) {continue;} + numSaved++; + firstField = true; + buffer = new StringBuffer(); + for (int f=0; f