From c867e3b0292ae63605cd4fcc11fd4c1a9bb954c9 Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Mon, 25 Aug 2014 14:36:11 +0200 Subject: falsche FTP Erfolgsmeldung entfernt --- Dozentenmodul/src/ftp/DownloadTask.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Dozentenmodul/src/ftp/DownloadTask.java') 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 { 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 { 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 { */ @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); } } -- cgit v1.2.3-55-g7522