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.java43
1 files changed, 21 insertions, 22 deletions
diff --git a/Dozentenmodul/src/GUI/FTPDownloader_GUI.java b/Dozentenmodul/src/GUI/FTPDownloader_GUI.java
index 60e509e2..94e1e05d 100644
--- a/Dozentenmodul/src/GUI/FTPDownloader_GUI.java
+++ b/Dozentenmodul/src/GUI/FTPDownloader_GUI.java
@@ -1,4 +1,4 @@
-package GUI;
+package gui;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -6,7 +6,6 @@ import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.io.File;
-import java.rmi.RemoteException;
import javax.swing.JButton;
import javax.swing.JFileChooser;
@@ -19,11 +18,8 @@ import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
-import Models.User;
+import ftp.DownloadTask;
-import rmi.RmiClientMethods;
-import server.ServerInterface;
-import downloader.DownloadTask;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
@@ -35,6 +31,12 @@ import java.awt.Font;
import javax.swing.JTextPane;
import javax.swing.JSeparator;
+import org.apache.thrift.TException;
+
+import server.Server.Client;
+import server.User;
+import thrift.ThriftConnection;
+
@SuppressWarnings("serial")
public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener {
@@ -61,8 +63,8 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
long bytesread;
JLabel labelZeit;
boolean taskrun=false;
- RmiClientMethods rmi=new RmiClientMethods();
- ServerInterface sint=rmi.getInterface();
+ ThriftConnection thrift=new ThriftConnection();
+ Client client=thrift.getThriftConnection();
/**
* Launch the application.
*/
@@ -89,8 +91,8 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
if(taskrun==true)
{
try {
- sint.DeleteFtpUser(user.getUsername());
- } catch (RemoteException e1) {
+ client.DeleteFtpUser(user.userName);
+ } catch (TException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
@@ -116,10 +118,9 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
setBackground(Color.WHITE);
setTitle("Dozentenmodul *Prototyp*");
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- int top=(screenSize.height - 603) / 2;
- int left=(screenSize.width - 722) / 2;
+ int top=(screenSize.height - 722) / 2;
+ int left=(screenSize.width - 603) / 2;
setBounds(left, top, 603, 722);
- //setBounds(100, 100, 603, 250);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBackground(SystemColor.menu);
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
@@ -265,8 +266,8 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
{
task.cancel(true);
try {
- sint.DeleteFtpUser(user.getUsername());
- } catch (RemoteException e1) {
+ client.DeleteFtpUser(user.userName);
+ } catch (TException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
@@ -291,16 +292,14 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener
progressBar.setValue(0);
try {
- user=sint.getFtpUser();
- downloadPath=sint.getPathOfImage(filename);
- } catch (RemoteException e) {
+ user=client.getFtpUser();
+ //downloadPath=client.getPathOfImage(filename);
+ } catch (TException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- System.out.println(user.getUsername()+"Pass:"+user.getPass());
-
- task = new DownloadTask(host, port, user.getUsername(), user.getPass(),downloadPath+filename+".vmdk", lblNewLabel.getText(), this);
- System.out.println(downloadPath+filename);
+
+ task = new DownloadTask(host, port, user.userName, user.password,user.path+filename+".vmdk", lblNewLabel.getText(), this);
task.addPropertyChangeListener(this);
task.execute();
taskrun=true;