From e3c9858f878eb84ec3b56f9221ca29932364fc96 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Apr 2014 14:11:50 +0200 Subject: GUI etwas verstellt + Check ob schon fertig hochgeladen, bevor man Fertigstellen kann --- Dozentenmodul/src/gui/FTPUploader_GUI.java | 113 +++++++++++++++++------------ 1 file changed, 68 insertions(+), 45 deletions(-) (limited to 'Dozentenmodul') diff --git a/Dozentenmodul/src/gui/FTPUploader_GUI.java b/Dozentenmodul/src/gui/FTPUploader_GUI.java index d6bc1742..14cb40f5 100644 --- a/Dozentenmodul/src/gui/FTPUploader_GUI.java +++ b/Dozentenmodul/src/gui/FTPUploader_GUI.java @@ -18,7 +18,6 @@ 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; @@ -33,15 +32,12 @@ 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 util.XMLCreator; import ftp.UploadTask; @SuppressWarnings("serial") @@ -70,6 +66,7 @@ public class FTPUploader_GUI extends JFrame implements PropertyChangeListener { boolean taskrun = false; ThriftConnection thrift = new ThriftConnection(); Client client = thrift.getThriftConnection(); + JButton finishButton = new JButton("Fertigstellen"); /** * Launch the application. @@ -145,71 +142,71 @@ public class FTPUploader_GUI extends JFrame implements PropertyChangeListener { } }); - btnSpeicherortAuswhlen.setBounds(10, 124, 141, 23); + btnSpeicherortAuswhlen.setBounds(57, 124, 117, 23); btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP); btnSpeicherortAuswhlen.setHorizontalAlignment(SwingConstants.LEFT); contentPanel.add(btnSpeicherortAuswhlen); } lblNewLabel = new JLabel(""); - lblNewLabel.setBounds(184, 124, 255, 23); + lblNewLabel.setBounds(191, 124, 255, 23); contentPanel.add(lblNewLabel); - JButton btnDownloadStarten = new JButton("Upload starten"); - btnDownloadStarten.addActionListener(new ActionListener() { + JButton btnUploadStarten = new JButton("Upload starten"); + btnUploadStarten.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { buttonUploadActionPerformed(arg0); } }); - btnDownloadStarten.setBounds(10, 330, 141, 23); - contentPanel.add(btnDownloadStarten); + btnUploadStarten.setBounds(57, 168, 141, 23); + contentPanel.add(btnUploadStarten); progressBar = new JProgressBar(0, 100); progressBar.setStringPainted(true); - progressBar.setBounds(10, 158, 577, 30); + progressBar.setBounds(57, 202, 497, 30); contentPanel.add(progressBar); JLabel label = new JLabel("Downloadgeschwindigkeit:"); - label.setBounds(10, 199, 141, 14); + label.setBounds(57, 243, 141, 14); contentPanel.add(label); JLabel label_1 = new JLabel("Fertig:"); - label_1.setBounds(10, 249, 46, 14); + label_1.setBounds(57, 293, 46, 14); contentPanel.add(label_1); labelfertig = new JLabel("0"); - labelfertig.setBounds(66, 249, 108, 14); + labelfertig.setBounds(113, 293, 71, 14); contentPanel.add(labelfertig); UpSpeed = new JLabel("0"); - UpSpeed.setBounds(329, 199, 95, 14); + UpSpeed.setBounds(329, 243, 95, 14); contentPanel.add(UpSpeed); JLabel label_4 = new JLabel("von:"); - label_4.setBounds(184, 249, 46, 14); + label_4.setBounds(184, 293, 46, 14); contentPanel.add(label_4); labelfilesize = new JLabel("0"); - labelfilesize.setBounds(240, 249, 108, 14); + labelfilesize.setBounds(240, 293, 108, 14); contentPanel.add(labelfilesize); JLabel label_6 = new JLabel("Verbleibend:"); - label_6.setBounds(10, 274, 71, 14); + label_6.setBounds(57, 318, 71, 14); contentPanel.add(label_6); JLabel label_7 = new JLabel("Gesch\u00E4tzte Verbleibende Zeit:"); - label_7.setBounds(10, 224, 150, 14); + label_7.setBounds(57, 268, 150, 14); contentPanel.add(label_7); labelZeit = new JLabel("0"); - labelZeit.setBounds(329, 224, 117, 14); + labelZeit.setBounds(329, 268, 117, 14); contentPanel.add(labelZeit); labelverbleibend = new JLabel("0"); - labelverbleibend.setBounds(91, 274, 108, 14); + labelverbleibend.setBounds(138, 318, 108, 14); contentPanel.add(labelverbleibend); JPanel panel = new JPanel(); @@ -218,17 +215,17 @@ public class FTPUploader_GUI extends JFrame implements PropertyChangeListener { panel.setBounds(10, 11, 577, 57); contentPanel.add(panel); - JLabel label_2 = new JLabel("Eingabe Ihrer Daten"); - label_2.setFont(new Font("Tahoma", Font.BOLD, 18)); - label_2.setBounds(10, 11, 509, 22); - panel.add(label_2); + 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 textPane = new JTextPane(); - textPane.setText("Geben Sie hier bitte einen sprechenden Imagename sowie Ihre Kontaktdaten an"); - textPane.setEditable(false); - textPane.setBackground(SystemColor.menu); - textPane.setBounds(10, 36, 509, 32); - panel.add(textPane); + 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); @@ -271,17 +268,35 @@ public class FTPUploader_GUI extends JFrame implements PropertyChangeListener { } } }); - btnCopyFileTo.setBounds(10, 375, 264, 23); + btnCopyFileTo.setBounds(57, 343, 217, 23); contentPanel.add(btnCopyFileTo); + + JLabel label_8 = new JLabel("1."); + label_8.setBounds(24, 128, 23, 14); + contentPanel.add(label_8); + + JLabel label_9 = new JLabel("2."); + label_9.setBounds(24, 172, 23, 14); + contentPanel.add(label_9); + + JLabel label_10 = new JLabel("3."); + label_10.setBounds(20, 391, 23, 14); + contentPanel.add(label_10); + + JLabel lblKlickenSieAuf = new JLabel( + "Klicken Sie auf \"Fertigstellen\"."); + lblKlickenSieAuf.setBounds(53, 391, 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); { - //Button for starting upload - JButton ButtonReady = new JButton("Fertigstellen"); - ButtonReady.addActionListener(new ActionListener() { + // Button for starting upload + // JButton finishButton = new JButton("Fertigstellen"); + finishButton.setEnabled(false); + finishButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { writeData(); dispose(); @@ -301,20 +316,20 @@ public class FTPUploader_GUI extends JFrame implements PropertyChangeListener { } }); - //Button for going back to Main Menu - JButton buttonCancel = new JButton("Hauptmen\u00FC"); - buttonCancel.addActionListener(new ActionListener() { + // Button for going back to Main Menu + JButton cancelButton = new JButton("Hauptmen\u00FC"); + cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { dispose(); MainMenue_GUI m = new MainMenue_GUI(); m.setVisible(true); } }); - - buttonCancel.setActionCommand("Cancel"); - buttonPane.add(buttonCancel); - ButtonReady.setActionCommand("Cancel"); - buttonPane.add(ButtonReady); + + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + finishButton.setActionCommand("Cancel"); + buttonPane.add(finishButton); } } @@ -380,10 +395,18 @@ public class FTPUploader_GUI extends JFrame implements PropertyChangeListener { } public void propertyChange(PropertyChangeEvent arg0) { + int progress = 0; if ("progress" == arg0.getPropertyName()) { - int progress = (Integer) arg0.getNewValue(); + progress = (Integer) arg0.getNewValue(); progressBar.setValue(progress); + + // Button zum Fertigstellen freischalten + if (progress == 100) { + finishButton.setEnabled(true); + } + } + if ("speed" == arg0.getPropertyName()) { speed = (double) arg0.getNewValue(); // if(speed<=1){ -- cgit v1.2.3-55-g7522