summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/ftp/DownloadTask.java
diff options
context:
space:
mode:
authorMichael Wilson2014-08-25 14:36:11 +0200
committerMichael Wilson2014-08-25 14:36:11 +0200
commitc867e3b0292ae63605cd4fcc11fd4c1a9bb954c9 (patch)
tree6d0f6ee7468cc3336487417f63dfebc9c45226ea /Dozentenmodul/src/ftp/DownloadTask.java
parentSchrift angepasst (diff)
downloadtutor-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.java13
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);
}
}