diff options
| author | Michael Wilson | 2014-08-25 14:36:11 +0200 |
|---|---|---|
| committer | Michael Wilson | 2014-08-25 14:36:11 +0200 |
| commit | c867e3b0292ae63605cd4fcc11fd4c1a9bb954c9 (patch) | |
| tree | 6d0f6ee7468cc3336487417f63dfebc9c45226ea /Dozentenmodul/src/ftp/DownloadTask.java | |
| parent | Schrift angepasst (diff) | |
| download | tutor-module-c867e3b0292ae63605cd4fcc11fd4c1a9bb954c9.tar.gz tutor-module-c867e3b0292ae63605cd4fcc11fd4c1a9bb954c9.tar.xz tutor-module-c867e3b0292ae63605cd4fcc11fd4c1a9bb954c9.zip | |
falsche FTP Erfolgsmeldung entfernt
Diffstat (limited to 'Dozentenmodul/src/ftp/DownloadTask.java')
| -rw-r--r-- | Dozentenmodul/src/ftp/DownloadTask.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Dozentenmodul/src/ftp/DownloadTask.java b/Dozentenmodul/src/ftp/DownloadTask.java index 74b55e37..a71556e7 100644 --- a/Dozentenmodul/src/ftp/DownloadTask.java +++ b/Dozentenmodul/src/ftp/DownloadTask.java @@ -25,6 +25,7 @@ public class DownloadTask extends SwingWorker<Void, Void> { private String password; private String downloadPath; private String saveDir; + private int percentCompleted; public DownloadTask(String host, int port, String username, String password, String downloadPath, String saveDir) { @@ -49,7 +50,7 @@ public class DownloadTask extends SwingWorker<Void, Void> { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; long totalBytesRead = 0; - int percentCompleted = 0; + percentCompleted = 0; long start = System.nanoTime(); final double NANOS_PER_SECOND = 1000000000.0; final double BYTES_PER_MIB = 1024 * 1024; @@ -101,9 +102,15 @@ public class DownloadTask extends SwingWorker<Void, Void> { */ @Override protected void done() { - if (!isCancelled()) { + if (!isCancelled() && percentCompleted==100) { + System.out.println("Datei erfolgreich heruntergeladen"); JOptionPane.showMessageDialog(null, - "File has been downloaded successfully!", "Message", + "Datei erfolgreich heruntergeladen.", "Message", + JOptionPane.INFORMATION_MESSAGE); + } else if(!isCancelled() && percentCompleted != 100){ + System.out.println("Datein wurde unvollständig heruntergeladen"); + JOptionPane.showMessageDialog(null, + "Datein wurde unvollständig heruntergeladen. Bitte wiederholen.", "Message", JOptionPane.INFORMATION_MESSAGE); } } |
