]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/function/gpsies/GenericDownloaderFunction.java
Version 15, March 2013
[GpsPrune.git] / tim / prune / function / gpsies / GenericDownloaderFunction.java
index 743becfcca16f8a62a823a65d9517b8341494b73..286ba1aae7bc677cd835e3855ea213d44e206b6d 100644 (file)
@@ -40,6 +40,8 @@ public abstract class GenericDownloaderFunction extends GenericFunction implemen
        protected JTable _trackTable = null;
        /** Cancelled flag */
        protected boolean _cancelled = false;
+       /** error message */
+       protected String _errorMessage = null;
        /** Status label */
        protected JLabel _statusLabel = null;
        /** Description box */
@@ -84,6 +86,7 @@ public abstract class GenericDownloaderFunction extends GenericFunction implemen
                _showButton.setEnabled(false);
                _cancelled = false;
                _descriptionBox.setText("");
+               _errorMessage = null;
                // Start new thread to load list asynchronously
                new Thread(this).start();
 
@@ -111,17 +114,17 @@ public abstract class GenericDownloaderFunction extends GenericFunction implemen
                        public void valueChanged(ListSelectionEvent e) {
                                if (!e.getValueIsAdjusting())
                                {
-                                       if (_trackTable.getSelectedRow() >= 0
-                                        && _trackTable.getSelectedRow() < _trackListModel.getRowCount())
+                                       final int numSelected = _trackTable.getSelectedRowCount();
+                                       if (numSelected > 0)
                                        {
-                                               _loadButton.setEnabled(true);
-                                               _showButton.setEnabled(true);
                                                setDescription(_trackListModel.getTrack(_trackTable.getSelectedRow()).getDescription());
                                                _descriptionBox.setCaretPosition(0);
                                        }
                                        else {
                                                _descriptionBox.setText("");
                                        }
+                                       _loadButton.setEnabled(numSelected > 0);
+                                       _showButton.setEnabled(numSelected == 1);
                                }
                        }
                });