summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/GUI/FTPDownloader_GUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'Dozentenmodul/src/GUI/FTPDownloader_GUI.java')
-rw-r--r--Dozentenmodul/src/GUI/FTPDownloader_GUI.java44
1 files changed, 20 insertions, 24 deletions
diff --git a/Dozentenmodul/src/GUI/FTPDownloader_GUI.java b/Dozentenmodul/src/GUI/FTPDownloader_GUI.java
index b36f0818..cb53fc3d 100644
--- a/Dozentenmodul/src/GUI/FTPDownloader_GUI.java
+++ b/Dozentenmodul/src/GUI/FTPDownloader_GUI.java
@@ -31,6 +31,8 @@ import java.awt.Font;
import javax.swing.JTextPane;
import javax.swing.JSeparator;
+import models.Image;
+
import org.apache.thrift.TException;
import server.Server.Client;
@@ -51,7 +53,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
int port = 21;
String username = "openslx";
String password = "openslx-ng";
- String downloadPath = "";
+ String downloadFile = "";
static String arg = "";
DownloadTask task;
JLabel bytesreadlbl;
@@ -64,7 +66,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
boolean taskrun = false;
ThriftConnection thrift = new ThriftConnection();
Client client = thrift.getThriftConnection();
- JButton continueButton = new JButton("Fertigstellen");
+ JButton buttonback = new JButton("Zur\u00FCck");
/**
* Launch the application.
@@ -86,6 +88,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
if (taskrun == true) {
try {
client.DeleteFtpUser(user.userName);
+ thrift.closeThriftConnection();
} catch (TException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
@@ -108,7 +111,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
e.printStackTrace();
}
- // filename=name;
+
setBackground(Color.WHITE);
setTitle("Dozentenmodul *Prototyp*");
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
@@ -263,8 +266,8 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
- continueButton.setEnabled(false);
- continueButton.addActionListener(new ActionListener() {
+ buttonback.setEnabled(false);
+ buttonback.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (taskrun == true) {
task.cancel(true);
@@ -275,24 +278,14 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
e1.printStackTrace();
}
}
+ thrift.closeThriftConnection();
+ SearchEditImage_GUI se=new SearchEditImage_GUI();
+ se.setVisible(true);
dispose();
}
});
-
- JButton cancelButton = new JButton("Zur\u00FCck");
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
-
- dispose();
- MainMenue_GUI m = new MainMenue_GUI();
- m.setVisible(true);
-
- }
- });
- cancelButton.setActionCommand("Cancel");
- buttonPane.add(cancelButton);
- continueButton.setActionCommand("Cancel");
- buttonPane.add(continueButton);
+ buttonback.setActionCommand("Cancel");
+ buttonPane.add(buttonback);
}
}
setVisible(true);
@@ -305,14 +298,16 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
try {
user = client.getFtpUser();
- // downloadPath=client.getPathOfImage(filename);
+
+ downloadFile=client.getPathOfImage(Image.image.getImageId(),Image.image.getVersion());
+
} catch (TException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
task = new DownloadTask(host, port, user.userName, user.password,
- user.path, lblNewLabel.getText(), this);
+ downloadFile, lblNewLabel.getText(), this);
task.addPropertyChangeListener(this);
task.execute();
taskrun = true;
@@ -326,9 +321,10 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
progress = (Integer) arg0.getNewValue();
progressBar.setValue(progress);
if (progress == 100) {
- continueButton.setEnabled(true);
+ buttonback.setEnabled(true);
}
}
+
if ("speed" == arg0.getPropertyName()) {
speed = (double) arg0.getNewValue();
// if(speed<=1){