From d39c936281894a9380587731bdc4b7e2d24724cf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Apr 2014 14:23:59 +0200 Subject: Klassenname geändert zu "FTPCreateUploader" --- .../bin/gui/image/CreateImageTechnisch_GUI$4.class | Bin 1655 -> 1667 bytes .../bin/gui/image/EditImageTechnisch_GUI$1.class | Bin 746 -> 746 bytes .../bin/gui/image/EditImageTechnisch_GUI$2.class | Bin 835 -> 835 bytes .../bin/gui/image/EditImageTechnisch_GUI$3.class | Bin 1663 -> 1691 bytes .../bin/gui/image/EditImageTechnisch_GUI$4.class | Bin 1653 -> 1685 bytes .../bin/gui/image/EditImageTechnisch_GUI.class | Bin 8443 -> 8511 bytes .../bin/gui/image/FTPCreateUploader_GUI$1.class | Bin 0 -> 792 bytes .../bin/gui/image/FTPCreateUploader_GUI$2.class | Bin 0 -> 1313 bytes .../bin/gui/image/FTPCreateUploader_GUI$3.class | Bin 0 -> 1626 bytes .../bin/gui/image/FTPCreateUploader_GUI$4.class | Bin 0 -> 1198 bytes .../bin/gui/image/FTPCreateUploader_GUI$5.class | Bin 0 -> 813 bytes .../bin/gui/image/FTPCreateUploader_GUI$6.class | Bin 0 -> 1707 bytes .../bin/gui/image/FTPCreateUploader_GUI$7.class | Bin 0 -> 1652 bytes .../bin/gui/image/FTPCreateUploader_GUI$8.class | Bin 0 -> 890 bytes .../bin/gui/image/FTPCreateUploader_GUI.class | Bin 0 -> 12258 bytes .../bin/gui/image/FTPUploader_GUI$1.class | Bin 762 -> 0 bytes .../bin/gui/image/FTPUploader_GUI$2.class | Bin 1277 -> 0 bytes .../bin/gui/image/FTPUploader_GUI$3.class | Bin 1590 -> 0 bytes .../bin/gui/image/FTPUploader_GUI$4.class | Bin 1162 -> 0 bytes .../bin/gui/image/FTPUploader_GUI$5.class | Bin 771 -> 0 bytes .../bin/gui/image/FTPUploader_GUI$6.class | Bin 1671 -> 0 bytes .../bin/gui/image/FTPUploader_GUI$7.class | Bin 1616 -> 0 bytes .../bin/gui/image/FTPUploader_GUI$8.class | Bin 854 -> 0 bytes Dozentenmodul/bin/gui/image/FTPUploader_GUI.class | Bin 12180 -> 0 bytes .../lecture/ExtendedSearchForImages_GUI$3.class | Bin 919 -> 931 bytes .../src/gui/image/CreateImageTechnisch_GUI.java | 2 +- .../src/gui/image/FTPCreateUploader_GUI.java | 485 +++++++++++++++++++++ Dozentenmodul/src/gui/image/FTPUploader_GUI.java | 485 --------------------- .../gui/lecture/ExtendedSearchForImages_GUI.java | 4 +- 29 files changed, 488 insertions(+), 488 deletions(-) create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$1.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$2.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$3.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$4.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$5.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$8.class create mode 100644 Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$1.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$2.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$3.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$4.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$5.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$6.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$7.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI$8.class delete mode 100644 Dozentenmodul/bin/gui/image/FTPUploader_GUI.class create mode 100644 Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java delete mode 100644 Dozentenmodul/src/gui/image/FTPUploader_GUI.java (limited to 'Dozentenmodul') diff --git a/Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI$4.class b/Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI$4.class index 54d32a3f..ac331f22 100644 Binary files a/Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI$4.class and b/Dozentenmodul/bin/gui/image/CreateImageTechnisch_GUI$4.class differ diff --git a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$1.class b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$1.class index b6e700d1..216e48c4 100644 Binary files a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$1.class and b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$1.class differ diff --git a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$2.class b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$2.class index 00451da1..d22c246d 100644 Binary files a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$2.class and b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$2.class differ diff --git a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$3.class b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$3.class index 5dcf5a40..4edb101c 100644 Binary files a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$3.class and b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$3.class differ diff --git a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$4.class b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$4.class index ccf62925..b31208f2 100644 Binary files a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$4.class and b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI$4.class differ diff --git a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class index 84957fcf..edcd12d8 100644 Binary files a/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class and b/Dozentenmodul/bin/gui/image/EditImageTechnisch_GUI.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$1.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$1.class new file mode 100644 index 00000000..f8f17cdd Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$1.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$2.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$2.class new file mode 100644 index 00000000..5bf673b1 Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$2.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$3.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$3.class new file mode 100644 index 00000000..6f66b19e Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$3.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$4.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$4.class new file mode 100644 index 00000000..1c95b480 Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$4.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$5.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$5.class new file mode 100644 index 00000000..215b47fe Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$5.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class new file mode 100644 index 00000000..b0c2904f Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class new file mode 100644 index 00000000..a5045e6e Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$8.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$8.class new file mode 100644 index 00000000..47662324 Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$8.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class new file mode 100644 index 00000000..0e42153a Binary files /dev/null and b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$1.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$1.class deleted file mode 100644 index 8459bd28..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$1.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$2.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$2.class deleted file mode 100644 index cc009734..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$2.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$3.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$3.class deleted file mode 100644 index 836abc27..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$3.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$4.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$4.class deleted file mode 100644 index a06a172b..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$4.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$5.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$5.class deleted file mode 100644 index a3f4459b..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$5.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$6.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$6.class deleted file mode 100644 index b4a9fbbf..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$6.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$7.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$7.class deleted file mode 100644 index ea3b93d2..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$7.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$8.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI$8.class deleted file mode 100644 index be1705d0..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI$8.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/image/FTPUploader_GUI.class b/Dozentenmodul/bin/gui/image/FTPUploader_GUI.class deleted file mode 100644 index 49b56187..00000000 Binary files a/Dozentenmodul/bin/gui/image/FTPUploader_GUI.class and /dev/null differ diff --git a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class b/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class index 9392da27..b6c8be8f 100644 Binary files a/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class and b/Dozentenmodul/bin/gui/lecture/ExtendedSearchForImages_GUI$3.class differ diff --git a/Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java b/Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java index f72a4f84..e9d2d91a 100644 --- a/Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java +++ b/Dozentenmodul/src/gui/image/CreateImageTechnisch_GUI.java @@ -324,7 +324,7 @@ public class CreateImageTechnisch_GUI extends JFrame { } Image.image.setCpu(Integer.valueOf(spinnerCPU.getValue().toString()).intValue()); Image.image.setRam(Integer.valueOf(spinnerRam.getValue().toString()).intValue()); - FTPUploader_GUI ea=new FTPUploader_GUI(); + FTPCreateUploader_GUI ea=new FTPCreateUploader_GUI(); ea.setVisible(true); dispose(); diff --git a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java new file mode 100644 index 00000000..d34db8f0 --- /dev/null +++ b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java @@ -0,0 +1,485 @@ +package gui.image; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +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 models.Image; +import models.person; +import org.apache.thrift.TException; +import server.Server.Client; +import thrift.ThriftConnection; +//import util.XMLCreator; +import ftp.UploadTask; +import gui.intro.MainMenue_GUI; + +@SuppressWarnings("serial") +public class FTPCreateUploader_GUI extends JFrame implements PropertyChangeListener { + + @SuppressWarnings("unused") + private JPanel contentPane; + private final JPanel contentPanel = new JPanel(); + JLabel lblPath; + JProgressBar progressBar; + String host = "141.79.128.121"; + int port = 21; + server.User user; + String filename = ""; + File uploadFile; + static String arg = ""; + UploadTask task; + JLabel UpSpeed; + JLabel labelfertig; + JLabel labelfilesize; + JLabel labelZeit; + JLabel labelverbleibend; + long filesize; + double speed; + long bytesread; + boolean taskrun = false; + ThriftConnection thrift = new ThriftConnection(); + Client client = thrift.getThriftConnection(); + JButton finishButton = new JButton("Fertigstellen"); + JButton btnUploadStarten = new JButton("Upload auf Server starten"); + JButton btnZurck = new JButton("Zur\u00FCck"); + int progress = 0; // progress of upload + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + FTPCreateUploader_GUI frame = new FTPCreateUploader_GUI(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public FTPCreateUploader_GUI() { + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + if (taskrun == true) { + try { + client.DeleteFtpUser(user.userName); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + task.cancel(true); + } + System.exit(0); + }//end window closing + }); + setResizable(false); + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + // filename=name; + setBackground(Color.WHITE); + setTitle("Dozentenmodul *Prototyp*"); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + 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)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + contentPanel.setLayout(null); + { + JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); + btnSpeicherortAuswhlen.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JFileChooser fc = new JFileChooser(); + fc.setFileSelectionMode(JFileChooser.FILES_ONLY); + + fc.showOpenDialog(getParent()); + File file = fc.getSelectedFile(); + // check if a file is selected and exists + if (file != null) { + System.out.println("File to upload exists"); + uploadFile = file; + filename = uploadFile.getName(); + lblPath.setText(file.getAbsolutePath()); + } else { + System.out.println("No file selected"); + lblPath.setText(""); + }// end if + } + }); + + btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); + btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); + contentPanel.add(btnSpeicherortAuswhlen); + } + + lblPath = new JLabel(""); + lblPath.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent arg0) { + if (lblPath.getText().isEmpty()) { + // wenn leer, dann upload button nicht freigeben + btnUploadStarten.setEnabled(false); + btnUploadStarten.setText("Bitte warten"); + } else { + // wenn leer, dann upload button nicht freigeben + btnUploadStarten.setEnabled(true); + btnUploadStarten.setText("Upload auf Server starten"); + } + } + }); + lblPath.setHorizontalAlignment(SwingConstants.LEFT); + lblPath.setBounds(102, 158, 485, 23); + contentPanel.add(lblPath); + + btnUploadStarten.setEnabled(false); + btnUploadStarten.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + buttonUploadActionPerformed(arg0); + + } + }); + + btnUploadStarten.setBounds(102, 200, 173, 23); + contentPanel.add(btnUploadStarten); + + progressBar = new JProgressBar(0, 100); + progressBar.setStringPainted(true); + + progressBar.setBounds(102, 234, 485, 30); + contentPanel.add(progressBar); + + JLabel lblUploadgeschwindigkeit = new JLabel("Uploadgeschwindigkeit:"); + lblUploadgeschwindigkeit.setBounds(102, 275, 141, 14); + contentPanel.add(lblUploadgeschwindigkeit); + + JLabel label_1 = new JLabel("Fertig:"); + label_1.setBounds(102, 325, 46, 14); + contentPanel.add(label_1); + + labelfertig = new JLabel("0"); + labelfertig.setHorizontalAlignment(SwingConstants.LEFT); + labelfertig.setBounds(183, 325, 108, 14); + contentPanel.add(labelfertig); + + UpSpeed = new JLabel("0"); + UpSpeed.setHorizontalAlignment(SwingConstants.LEFT); + UpSpeed.setBounds(374, 275, 117, 14); + contentPanel.add(UpSpeed); + + JLabel label_4 = new JLabel("von:"); + label_4.setBounds(318, 325, 46, 14); + contentPanel.add(label_4); + + labelfilesize = new JLabel("0"); + labelfilesize.setHorizontalAlignment(SwingConstants.LEFT); + labelfilesize.setBounds(374, 325, 117, 14); + contentPanel.add(labelfilesize); + + JLabel label_6 = new JLabel("Verbleibend:"); + label_6.setBounds(102, 350, 71, 14); + contentPanel.add(label_6); + + JLabel label_7 = new JLabel("Gesch\u00E4tzte Verbleibende Zeit:"); + label_7.setBounds(102, 300, 150, 14); + contentPanel.add(label_7); + + labelZeit = new JLabel("0"); + labelZeit.setHorizontalAlignment(SwingConstants.LEFT); + labelZeit.setBounds(374, 300, 117, 14); + contentPanel.add(labelZeit); + + labelverbleibend = new JLabel("0"); + labelverbleibend.setHorizontalAlignment(SwingConstants.LEFT); + labelverbleibend.setBounds(183, 350, 108, 14); + contentPanel.add(labelverbleibend); + + JPanel panel = new JPanel(); + panel.setLayout(null); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 577, 57); + contentPanel.add(panel); + + JLabel lblUploadIhresImage = new JLabel("Upload Ihres Image"); + lblUploadIhresImage.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblUploadIhresImage.setBounds(10, 11, 509, 22); + panel.add(lblUploadIhresImage); + + JTextPane txtpnFhreSieBitte = new JTextPane(); + txtpnFhreSieBitte + .setText("F\u00FChre Sie bitte die folgenden 3 Schritte aus um Ihr Image auf unseren Server zu laden."); + txtpnFhreSieBitte.setEditable(false); + txtpnFhreSieBitte.setBackground(SystemColor.menu); + txtpnFhreSieBitte.setBounds(10, 36, 509, 32); + panel.add(txtpnFhreSieBitte); + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 79, 597, 2); + contentPanel.add(separator); + + JLabel lblNewLabel_1 = new JLabel("Hauptmen\u00FC"); + lblNewLabel_1.setForeground(Color.BLUE); + lblNewLabel_1.setBounds(20, 88, 61, 20); + contentPanel.add(lblNewLabel_1); + + JLabel label_3 = new JLabel(">"); + label_3.setBounds(80, 91, 14, 14); + contentPanel.add(label_3); + + JLabel lblVlimage = new JLabel("VL-Image"); + lblVlimage.setForeground(Color.BLUE); + lblVlimage.setBounds(91, 88, 46, 20); + contentPanel.add(lblVlimage); + + JLabel label_5 = new JLabel(">"); + label_5.setBounds(139, 91, 14, 14); + contentPanel.add(label_5); + + JLabel lblNeubearbeiten = new JLabel("Neu/Bearbeiten"); + lblNeubearbeiten.setBounds(149, 91, 108, 14); + contentPanel.add(lblNeubearbeiten); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 627, 597, 2); + contentPanel.add(separator_1); + + JButton btnCopyFileTo = new JButton("Copy File to Prod"); + btnCopyFileTo.setEnabled(false); + btnCopyFileTo.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + System.out.println("Copying file to " + user.path + "/" + + uploadFile.getName()); + client.startFileCopy(user.path + "/" + uploadFile.getName()); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); + btnCopyFileTo.setBounds(102, 375, 173, 23); + contentPanel.add(btnCopyFileTo); + + JLabel lblSchritt_1 = new JLabel("Schritt 1:"); + lblSchritt_1.setBounds(24, 128, 57, 14); + contentPanel.add(lblSchritt_1); + + JLabel lblSchritt_2 = new JLabel("Schritt 2:"); + lblSchritt_2.setBounds(24, 204, 57, 14); + contentPanel.add(lblSchritt_2); + + JLabel lblSchritt_3 = new JLabel("Schritt 3:"); + lblSchritt_3.setBounds(20, 423, 57, 14); + contentPanel.add(lblSchritt_3); + + JLabel lblKlickenSieAuf = new JLabel( + "Klicken Sie auf \"Fertigstellen\"."); + lblKlickenSieAuf.setBounds(98, 423, 241, 14); + contentPanel.add(lblKlickenSieAuf); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBackground(UIManager.getColor("Button.background")); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + finishButton.setEnabled(false); + finishButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + writeData(); + dispose(); + MainMenue_GUI m = new MainMenue_GUI(); + m.setVisible(true); + if (taskrun == true) { + try { + client.DeleteFtpUser(user.userName); + thrift.closeThriftConnection(); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + task.cancel(true); + } + + } + }); + + btnZurck.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + dispose(); + CreateImageTechnisch_GUI m = new CreateImageTechnisch_GUI(); + m.setVisible(true); + } + }); + btnZurck.setActionCommand("Cancel"); + buttonPane.add(btnZurck); + finishButton.setActionCommand("Cancel"); + buttonPane.add(finishButton); + } + } + + JMenuBar menuBar = new JMenuBar(); + setJMenuBar(menuBar); + + JMenu mnHillfe = new JMenu("Hillfe"); + menuBar.add(mnHillfe); + setVisible(true); + + } + + private void buttonUploadActionPerformed(ActionEvent event) { + + progressBar.setValue(0); + btnUploadStarten.setEnabled(false); //verhindert einen weiteren klick + btnUploadStarten.setText("Bitte warten"); + + try { + user = client.getFtpUser(); + System.out.println("name" + user.userName); + System.out.println("path" + user.path); + System.out.println("pass" + user.password); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); + + System.out.println(formatter.format(new Date()) + "_" + + person.verantwortlicher.getHochschule() + "_" + + person.verantwortlicher.getUsername() + "_" + + Image.image.getImagename() + ".vmdk"); + Image.image.setNewName(formatter.format(new Date()) + "_" + + person.verantwortlicher.getHochschule() + "_" + + person.verantwortlicher.getUsername() + "_" + + Image.image.getImagename() + ".vmdk"); + task = new UploadTask(host, port, user.userName, user.password, + user.path, uploadFile); + + task.addPropertyChangeListener(this); + task.execute(); + taskrun = true; + + } + + public void propertyChange(PropertyChangeEvent arg0) { + progress = 0; + if ("progress" == arg0.getPropertyName()) { + progress = (Integer) arg0.getNewValue(); + progressBar.setValue(progress); + + + //if (progress == 100) { + // finishButton.setEnabled(true); + //} + // Button zum Fertigstellen freischalten, wenn 100% erreicht sind + if (progress == 0 || progress == 100) { + // not uploading currently + btnZurck.setEnabled(true); + } else { + // currently uploading, don't let user interact + btnZurck.setEnabled(false); + } + + } + + if ("speed" == arg0.getPropertyName()) { + speed = (double) arg0.getNewValue(); + // if(speed<=1){ + + UpSpeed.setText(String.valueOf(speed).substring(0, + String.valueOf(speed).lastIndexOf(".") + 3) + + " MB/s"); + + } + if ("bytesread" == arg0.getPropertyName()) { + bytesread = (long) arg0.getNewValue(); + labelfertig.setText((bytesread / 1024 / 1024) + " MB"); + labelverbleibend + .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) + + " MB"); + + labelZeit + .setText(String + .valueOf( + ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) + .substring( + 0, + String.valueOf( + (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + .lastIndexOf(".")) + + " Minuten"); + + } + if ("filesize" == arg0.getPropertyName()) { + filesize = (long) arg0.getNewValue(); + labelfilesize.setText((filesize / 1024 / 1024) + " MB"); + + } + + } + + public boolean writeData() { + + try { + + client.writeVLdata(Image.image.getImagename(), + person.verantwortlicher.getVorname(), + person.verantwortlicher.getName(), + person.verantwortlicher.getHochschule(), + person.verantwortlicher.getEMail(), + person.verantwortlicher.getTel(), + person.verantwortlicher.getFakultät(), + Image.image.isLicensed(), Image.image.isInternet(), + Image.image.getRam(), Image.image.getCpu(), + "/srv/openslx/nfs/temp/" + Image.image.getNewName()); + } catch (TException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return false; + } + return true; + + } +} \ No newline at end of file diff --git a/Dozentenmodul/src/gui/image/FTPUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPUploader_GUI.java deleted file mode 100644 index 588657c8..00000000 --- a/Dozentenmodul/src/gui/image/FTPUploader_GUI.java +++ /dev/null @@ -1,485 +0,0 @@ -package gui.image; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.EventQueue; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.File; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JPanel; -import javax.swing.JProgressBar; -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 models.Image; -import models.person; -import org.apache.thrift.TException; -import server.Server.Client; -import thrift.ThriftConnection; -//import util.XMLCreator; -import ftp.UploadTask; -import gui.intro.MainMenue_GUI; - -@SuppressWarnings("serial") -public class FTPUploader_GUI extends JFrame implements PropertyChangeListener { - - @SuppressWarnings("unused") - private JPanel contentPane; - private final JPanel contentPanel = new JPanel(); - JLabel lblPath; - JProgressBar progressBar; - String host = "141.79.128.121"; - int port = 21; - server.User user; - String filename = ""; - File uploadFile; - static String arg = ""; - UploadTask task; - JLabel UpSpeed; - JLabel labelfertig; - JLabel labelfilesize; - JLabel labelZeit; - JLabel labelverbleibend; - long filesize; - double speed; - long bytesread; - boolean taskrun = false; - ThriftConnection thrift = new ThriftConnection(); - Client client = thrift.getThriftConnection(); - JButton finishButton = new JButton("Fertigstellen"); - JButton btnUploadStarten = new JButton("Upload auf Server starten"); - JButton btnZurck = new JButton("Zur\u00FCck"); - int progress = 0; // progress of upload - - /** - * Launch the application. - */ - public static void main(String[] args) { - EventQueue.invokeLater(new Runnable() { - public void run() { - try { - FTPUploader_GUI frame = new FTPUploader_GUI(); - frame.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - } - - /** - * Create the frame. - */ - public FTPUploader_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - if (taskrun == true) { - try { - client.DeleteFtpUser(user.userName); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - task.cancel(true); - } - System.exit(0); - }//end window closing - }); - setResizable(false); - - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - // filename=name; - setBackground(Color.WHITE); - setTitle("Dozentenmodul *Prototyp*"); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - 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)); - getContentPane().add(contentPanel, BorderLayout.CENTER); - contentPanel.setLayout(null); - { - JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); - btnSpeicherortAuswhlen.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.FILES_ONLY); - - fc.showOpenDialog(getParent()); - File file = fc.getSelectedFile(); - // check if a file is selected and exists - if (file != null) { - System.out.println("File to upload exists"); - uploadFile = file; - filename = uploadFile.getName(); - lblPath.setText(file.getAbsolutePath()); - } else { - System.out.println("No file selected"); - lblPath.setText(""); - }// end if - } - }); - - btnSpeicherortAuswhlen.setBounds(102, 124, 173, 23); - btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); - contentPanel.add(btnSpeicherortAuswhlen); - } - - lblPath = new JLabel(""); - lblPath.addPropertyChangeListener(new PropertyChangeListener() { - public void propertyChange(PropertyChangeEvent arg0) { - if (lblPath.getText().isEmpty()) { - // wenn leer, dann upload button nicht freigeben - btnUploadStarten.setEnabled(false); - btnUploadStarten.setText("Bitte warten"); - } else { - // wenn leer, dann upload button nicht freigeben - btnUploadStarten.setEnabled(true); - btnUploadStarten.setText("Upload auf Server starten"); - } - } - }); - lblPath.setHorizontalAlignment(SwingConstants.LEFT); - lblPath.setBounds(102, 158, 485, 23); - contentPanel.add(lblPath); - - btnUploadStarten.setEnabled(false); - btnUploadStarten.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - buttonUploadActionPerformed(arg0); - - } - }); - - btnUploadStarten.setBounds(102, 200, 173, 23); - contentPanel.add(btnUploadStarten); - - progressBar = new JProgressBar(0, 100); - progressBar.setStringPainted(true); - - progressBar.setBounds(102, 234, 485, 30); - contentPanel.add(progressBar); - - JLabel lblUploadgeschwindigkeit = new JLabel("Uploadgeschwindigkeit:"); - lblUploadgeschwindigkeit.setBounds(102, 275, 141, 14); - contentPanel.add(lblUploadgeschwindigkeit); - - JLabel label_1 = new JLabel("Fertig:"); - label_1.setBounds(102, 325, 46, 14); - contentPanel.add(label_1); - - labelfertig = new JLabel("0"); - labelfertig.setHorizontalAlignment(SwingConstants.LEFT); - labelfertig.setBounds(183, 325, 108, 14); - contentPanel.add(labelfertig); - - UpSpeed = new JLabel("0"); - UpSpeed.setHorizontalAlignment(SwingConstants.LEFT); - UpSpeed.setBounds(374, 275, 117, 14); - contentPanel.add(UpSpeed); - - JLabel label_4 = new JLabel("von:"); - label_4.setBounds(318, 325, 46, 14); - contentPanel.add(label_4); - - labelfilesize = new JLabel("0"); - labelfilesize.setHorizontalAlignment(SwingConstants.LEFT); - labelfilesize.setBounds(374, 325, 117, 14); - contentPanel.add(labelfilesize); - - JLabel label_6 = new JLabel("Verbleibend:"); - label_6.setBounds(102, 350, 71, 14); - contentPanel.add(label_6); - - JLabel label_7 = new JLabel("Gesch\u00E4tzte Verbleibende Zeit:"); - label_7.setBounds(102, 300, 150, 14); - contentPanel.add(label_7); - - labelZeit = new JLabel("0"); - labelZeit.setHorizontalAlignment(SwingConstants.LEFT); - labelZeit.setBounds(374, 300, 117, 14); - contentPanel.add(labelZeit); - - labelverbleibend = new JLabel("0"); - labelverbleibend.setHorizontalAlignment(SwingConstants.LEFT); - labelverbleibend.setBounds(183, 350, 108, 14); - contentPanel.add(labelverbleibend); - - JPanel panel = new JPanel(); - panel.setLayout(null); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - contentPanel.add(panel); - - JLabel lblUploadIhresImage = new JLabel("Upload Ihres Image"); - lblUploadIhresImage.setFont(new Font("Tahoma", Font.BOLD, 18)); - lblUploadIhresImage.setBounds(10, 11, 509, 22); - panel.add(lblUploadIhresImage); - - JTextPane txtpnFhreSieBitte = new JTextPane(); - txtpnFhreSieBitte - .setText("F\u00FChre Sie bitte die folgenden 3 Schritte aus um Ihr Image auf unseren Server zu laden."); - txtpnFhreSieBitte.setEditable(false); - txtpnFhreSieBitte.setBackground(SystemColor.menu); - txtpnFhreSieBitte.setBounds(10, 36, 509, 32); - panel.add(txtpnFhreSieBitte); - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 79, 597, 2); - contentPanel.add(separator); - - JLabel lblNewLabel_1 = new JLabel("Hauptmen\u00FC"); - lblNewLabel_1.setForeground(Color.BLUE); - lblNewLabel_1.setBounds(20, 88, 61, 20); - contentPanel.add(lblNewLabel_1); - - JLabel label_3 = new JLabel(">"); - label_3.setBounds(80, 91, 14, 14); - contentPanel.add(label_3); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(91, 88, 46, 20); - contentPanel.add(lblVlimage); - - JLabel label_5 = new JLabel(">"); - label_5.setBounds(139, 91, 14, 14); - contentPanel.add(label_5); - - JLabel lblNeubearbeiten = new JLabel("Neu/Bearbeiten"); - lblNeubearbeiten.setBounds(149, 91, 108, 14); - contentPanel.add(lblNeubearbeiten); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - contentPanel.add(separator_1); - - JButton btnCopyFileTo = new JButton("Copy File to Prod"); - btnCopyFileTo.setEnabled(false); - btnCopyFileTo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - try { - System.out.println("Copying file to " + user.path + "/" - + uploadFile.getName()); - client.startFileCopy(user.path + "/" + uploadFile.getName()); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - }); - btnCopyFileTo.setBounds(102, 375, 173, 23); - contentPanel.add(btnCopyFileTo); - - JLabel lblSchritt_1 = new JLabel("Schritt 1:"); - lblSchritt_1.setBounds(24, 128, 57, 14); - contentPanel.add(lblSchritt_1); - - JLabel lblSchritt_2 = new JLabel("Schritt 2:"); - lblSchritt_2.setBounds(24, 204, 57, 14); - contentPanel.add(lblSchritt_2); - - JLabel lblSchritt_3 = new JLabel("Schritt 3:"); - lblSchritt_3.setBounds(20, 423, 57, 14); - contentPanel.add(lblSchritt_3); - - JLabel lblKlickenSieAuf = new JLabel( - "Klicken Sie auf \"Fertigstellen\"."); - lblKlickenSieAuf.setBounds(98, 423, 241, 14); - contentPanel.add(lblKlickenSieAuf); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBackground(UIManager.getColor("Button.background")); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane, BorderLayout.SOUTH); - { - finishButton.setEnabled(false); - finishButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - writeData(); - dispose(); - MainMenue_GUI m = new MainMenue_GUI(); - m.setVisible(true); - if (taskrun == true) { - try { - client.DeleteFtpUser(user.userName); - thrift.closeThriftConnection(); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - task.cancel(true); - } - - } - }); - - btnZurck.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - dispose(); - CreateImageTechnisch_GUI m = new CreateImageTechnisch_GUI(); - m.setVisible(true); - } - }); - btnZurck.setActionCommand("Cancel"); - buttonPane.add(btnZurck); - finishButton.setActionCommand("Cancel"); - buttonPane.add(finishButton); - } - } - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnHillfe = new JMenu("Hillfe"); - menuBar.add(mnHillfe); - setVisible(true); - - } - - private void buttonUploadActionPerformed(ActionEvent event) { - - progressBar.setValue(0); - btnUploadStarten.setEnabled(false); //verhindert einen weiteren klick - btnUploadStarten.setText("Bitte warten"); - - try { - user = client.getFtpUser(); - System.out.println("name" + user.userName); - System.out.println("path" + user.path); - System.out.println("pass" + user.password); - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - DateFormat formatter = new SimpleDateFormat("yyyMMddhhmmss"); - - System.out.println(formatter.format(new Date()) + "_" - + person.verantwortlicher.getHochschule() + "_" - + person.verantwortlicher.getUsername() + "_" - + Image.image.getImagename() + ".vmdk"); - Image.image.setNewName(formatter.format(new Date()) + "_" - + person.verantwortlicher.getHochschule() + "_" - + person.verantwortlicher.getUsername() + "_" - + Image.image.getImagename() + ".vmdk"); - task = new UploadTask(host, port, user.userName, user.password, - user.path, uploadFile); - - task.addPropertyChangeListener(this); - task.execute(); - taskrun = true; - - } - - public void propertyChange(PropertyChangeEvent arg0) { - progress = 0; - if ("progress" == arg0.getPropertyName()) { - progress = (Integer) arg0.getNewValue(); - progressBar.setValue(progress); - - - //if (progress == 100) { - // finishButton.setEnabled(true); - //} - // Button zum Fertigstellen freischalten, wenn 100% erreicht sind - if (progress == 0 || progress == 100) { - // not uploading currently - btnZurck.setEnabled(true); - } else { - // currently uploading, don't let user interact - btnZurck.setEnabled(false); - } - - } - - if ("speed" == arg0.getPropertyName()) { - speed = (double) arg0.getNewValue(); - // if(speed<=1){ - - UpSpeed.setText(String.valueOf(speed).substring(0, - String.valueOf(speed).lastIndexOf(".") + 3) - + " MB/s"); - - } - if ("bytesread" == arg0.getPropertyName()) { - bytesread = (long) arg0.getNewValue(); - labelfertig.setText((bytesread / 1024 / 1024) + " MB"); - labelverbleibend - .setText(((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) - + " MB"); - - labelZeit - .setText(String - .valueOf( - ((((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) + 1) - .substring( - 0, - String.valueOf( - (((filesize / 1024 / 1024) - (bytesread / 1024 / 1024)) / speed) / 60) - .lastIndexOf(".")) - + " Minuten"); - - } - if ("filesize" == arg0.getPropertyName()) { - filesize = (long) arg0.getNewValue(); - labelfilesize.setText((filesize / 1024 / 1024) + " MB"); - - } - - } - - public boolean writeData() { - - try { - - client.writeVLdata(Image.image.getImagename(), - person.verantwortlicher.getVorname(), - person.verantwortlicher.getName(), - person.verantwortlicher.getHochschule(), - person.verantwortlicher.getEMail(), - person.verantwortlicher.getTel(), - person.verantwortlicher.getFakultät(), - Image.image.isLicensed(), Image.image.isInternet(), - Image.image.getRam(), Image.image.getCpu(), - "/srv/openslx/nfs/temp/" + Image.image.getNewName()); - } catch (TException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return false; - } - return true; - - } -} \ No newline at end of file diff --git a/Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java b/Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java index 9aa07a4b..3fc4b7f6 100644 --- a/Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java +++ b/Dozentenmodul/src/gui/lecture/ExtendedSearchForImages_GUI.java @@ -2,7 +2,7 @@ package gui.lecture; import gui.image.CreateImageAllgemein_GUI; -import gui.image.FTPUploader_GUI; +import gui.image.FTPCreateUploader_GUI; import java.awt.Dimension; import java.awt.FlowLayout; @@ -196,7 +196,7 @@ public class ExtendedSearchForImages_GUI extends JFrame { public void actionPerformed(ActionEvent e) { - FTPUploader_GUI ea=new FTPUploader_GUI(); + FTPCreateUploader_GUI ea=new FTPCreateUploader_GUI(); ea.setVisible(true); dispose(); -- cgit v1.2.3-55-g7522