X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2Fgpsies%2FGenericDownloaderFunction.java;h=286ba1aae7bc677cd835e3855ea213d44e206b6d;hb=7f5ed2be62905bd37717376dc22d09e5ea7edb4d;hp=743becfcca16f8a62a823a65d9517b8341494b73;hpb=f35b6d628f68e3b5ef19965ad8988d0dd1eb8efa;p=GpsPrune.git diff --git a/tim/prune/function/gpsies/GenericDownloaderFunction.java b/tim/prune/function/gpsies/GenericDownloaderFunction.java index 743becf..286ba1a 100644 --- a/tim/prune/function/gpsies/GenericDownloaderFunction.java +++ b/tim/prune/function/gpsies/GenericDownloaderFunction.java @@ -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); } } });