summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java')
-rw-r--r--dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java110
1 files changed, 26 insertions, 84 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java
index ba6c056c..b7b0a9f4 100644
--- a/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/FTPEditDownloader_GUI.java
@@ -2,7 +2,6 @@ package gui.image;
import java.awt.BorderLayout;
import java.awt.Color;
-import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.SystemColor;
@@ -19,7 +18,6 @@ import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
-import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@@ -28,7 +26,6 @@ import javax.swing.JSeparator;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
-import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
@@ -58,33 +55,29 @@ public class FTPEditDownloader_GUI extends JInternalFrame implements
private final static Logger LOGGER = Logger
.getLogger(FTPEditDownloader_GUI.class);
- @SuppressWarnings("unused")
- private JPanel contentPane;
private final JPanel contentPanel = new JPanel();
- JLabel lblPath;
- JLabel lblDownSpeed;
- User user;
- JProgressBar progressBar;
- String host = SessionData.serverAdress;
- int port = 21;
- String downloadFile = "";
- static String arg = "";
- DownloadTask task;
- JLabel lblFertig;
- JLabel lblFilesize;
- JLabel lblVerbleibend;
- JFileChooser fc;
- long filesize;
- double speed;
- int progress = 0; // progress of download
- long bytesread;
- JLabel lblZeit;
- boolean taskrun = false;
- JButton btnZurck = new JButton("Zurück");
- JButton btnDownloadStarten = new JButton("Download starten");
- JButton btnDownloadStoppen = new JButton("Download abbrechen");
+ private JLabel lblPath;
+ private JLabel lblDownSpeed;
+ private User user;
+ private JProgressBar progressBar;
+ private String host = SessionData.serverAdress;
+ private int port = 21;
+ private String downloadFile = "";
+ private DownloadTask task;
+ private JLabel lblFertig;
+ private JLabel lblFilesize;
+ private JLabel lblVerbleibend;
+ private JFileChooser fc;
+ private long filesize;
+ private double speed;
+ private int progress = 0; // progress of download
+ private long bytesread;
+ private JLabel lblZeit;
+ private boolean taskrun = false;
+ private JButton btnZurck = new JButton("Zurück");
+ private JButton btnDownloadStarten = new JButton("Download starten");
+ private JButton btnDownloadStoppen = new JButton("Download abbrechen");
private JLabel lblAnleitung;
- Component c = null;
private boolean isCurrentlyLoading = false; // currently up or downloading
// file
private boolean isAborted = false; // down- or upload was manually aborted
@@ -107,7 +100,7 @@ public class FTPEditDownloader_GUI extends JInternalFrame implements
// check if user wants to quit.
int choice = JOptionPane
.showOptionDialog(
- c,
+ null,
"Aktuell ist ein Download aktiv. Wollen Sie diesen Abbrechen und das Programm beenden?",
"Upload aktiv",
JOptionPane.YES_NO_CANCEL_OPTION,
@@ -133,56 +126,7 @@ public class FTPEditDownloader_GUI extends JInternalFrame implements
}
}
});
-// addWindowListener(new WindowAdapter() {
-// @Override
-// public void windowClosing(WindowEvent e) {
-// if (taskrun == true) {
-// // check if user wants to quit.
-// int choice = JOptionPane
-// .showOptionDialog(
-// c,
-// "Aktuell ist ein Download aktiv. Wollen Sie diesen Abbrechen und das Programm beenden?",
-// "Upload aktiv",
-// JOptionPane.YES_NO_CANCEL_OPTION,
-// JOptionPane.QUESTION_MESSAGE, null,
-// options, options[1]);
-// // 0=beenden, 1=abbrechen
-// if (choice == 0) {
-// try {
-// ThriftManager.getSatClient().DeleteFtpUser(user.userName,SessionData.AuthToken);
-// try {
-// ThriftManager.getSatClient().setSessionInvalid(SessionData.AuthToken);
-// } catch (TException e1) {
-// // TODO Auto-generated catch block
-// e1.printStackTrace();
-// }
-// } catch (TException e1) {
-//
-// e1.printStackTrace();
-// }
-// task.cancel(true);
-// System.exit(0);
-// }// end if coice
-// } else {
-// // no download running, close window
-// try {
-// ThriftManager.getSatClient().setSessionInvalid(SessionData.AuthToken);
-// } catch (TException e1) {
-// // TODO Auto-generated catch block
-// e1.printStackTrace();
-// }
-// System.exit(0);
-// }// end if taskrun
-// }// end window closing
-// });
setResizable(false);
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (ClassNotFoundException | InstantiationException
- | IllegalAccessException | UnsupportedLookAndFeelException e) {
-
- e.printStackTrace();
- }
setBackground(Color.WHITE);
setTitle("Dozentenmodul - Image herunterladen - "+person.verantwortlicher.getUserID());
@@ -425,7 +369,7 @@ public class FTPEditDownloader_GUI extends JInternalFrame implements
if (isCurrentlyLoading() == true) {
int choice = JOptionPane
.showOptionDialog(
- c,
+ null,
"Nicht abgeschlossene Uploads werden beendet. Trotzdem zurück gehen?",
"Warnung",
JOptionPane.YES_NO_CANCEL_OPTION,
@@ -484,13 +428,13 @@ public class FTPEditDownloader_GUI extends JInternalFrame implements
downloadFile = user.path
+ "/"
- + ThriftManager.getSatClient().getPathOfImage(Image.image.getImageId(),
- Image.image.getVersion(),SessionData.authToken);
+ + ThriftManager.getSatClient().getPathOfImage(Image.ImageId,
+ Image.Version,SessionData.authToken);
} catch (TException e) {
e.printStackTrace();
- JOptionPane.showMessageDialog(c,
+ JOptionPane.showMessageDialog(null,
e.getCause() + "\n" + e.getStackTrace(), "Debug-Message",
JOptionPane.ERROR_MESSAGE);
}
@@ -524,7 +468,6 @@ public class FTPEditDownloader_GUI extends JInternalFrame implements
if (isCurrentlyLoading() == false
|| progressBar.getPercentComplete() == 1.0) {
// no download
- // LOGGER.info("finished downloading file");
btnDownloadStoppen.setEnabled(false);
} else {
// currently uploading, don't let user interact
@@ -580,7 +523,6 @@ public class FTPEditDownloader_GUI extends JInternalFrame implements
}// end resetValues
public void resetButtons() {
- // btnFinish.setEnabled(false);
btnDownloadStarten.setEnabled(true);
btnDownloadStarten.setText("Download starten");
btnDownloadStoppen.setEnabled(false);