diff options
Diffstat (limited to 'Dozentenmodul/src/gui/image/FTPDownloader_GUI.java')
| -rw-r--r-- | Dozentenmodul/src/gui/image/FTPDownloader_GUI.java | 83 |
1 files changed, 70 insertions, 13 deletions
diff --git a/Dozentenmodul/src/gui/image/FTPDownloader_GUI.java b/Dozentenmodul/src/gui/image/FTPDownloader_GUI.java index ec92396b..97a29849 100644 --- a/Dozentenmodul/src/gui/image/FTPDownloader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPDownloader_GUI.java @@ -6,6 +6,8 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Toolkit; import java.io.File; +import java.io.IOException; + import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; @@ -31,10 +33,18 @@ import java.awt.Font; import javax.swing.JTextPane; import javax.swing.JSeparator; import models.Image; +import models.Links; +import models.SessionData; + import org.apache.thrift.TException; import server.Server.Client; import server.User; import thrift.ThriftConnection; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; @SuppressWarnings("serial") public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener { @@ -46,7 +56,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener JLabel downspeed; User user; JProgressBar progressBar; - String host = "141.79.128.102"; + String host = SessionData.session.getServerAdress(); int port = 21; String downloadFile = ""; static String arg = ""; @@ -60,8 +70,8 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener long bytesread; JLabel labelZeit; boolean taskrun = false; - ThriftConnection thrift = new ThriftConnection(); - Client client = thrift.getThriftConnection(); + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); JButton btnZurck = new JButton("Zur\u00FCck"); JButton btnDownloadStarten = new JButton("Download starten"); JButton btnMainMenu = new JButton("Hauptmen\u00FC"); @@ -77,7 +87,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener if (taskrun == true) { try { client.DeleteFtpUser(user.userName); - thrift.closeThriftConnection(); + con.closeThriftConnection(); } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -217,7 +227,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener JPanel panel = new JPanel(); panel.setLayout(null); panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); + panel.setBounds(10, 24, 577, 57); contentPanel.add(panel); JLabel lblImageDownloader = new JLabel("Image Downloader"); @@ -233,29 +243,29 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener panel.add(txtpnWhlenSieEinen); JSeparator separator = new JSeparator(); - separator.setBounds(0, 79, 597, 2); + separator.setBounds(0, 88, 597, 2); contentPanel.add(separator); JLabel label_1 = new JLabel("Hauptmen\u00FC"); label_1.setForeground(Color.BLUE); - label_1.setBounds(20, 88, 61, 20); + label_1.setBounds(20, 92, 61, 20); contentPanel.add(label_1); JLabel label_2 = new JLabel(">"); - label_2.setBounds(80, 91, 14, 14); + label_2.setBounds(80, 95, 14, 14); contentPanel.add(label_2); JLabel label_3 = new JLabel("VL-Image"); label_3.setForeground(Color.BLUE); - label_3.setBounds(91, 88, 46, 20); + label_3.setBounds(91, 92, 46, 20); contentPanel.add(label_3); JLabel label_4 = new JLabel(">"); - label_4.setBounds(139, 91, 14, 14); + label_4.setBounds(139, 95, 14, 14); contentPanel.add(label_4); JLabel label_5 = new JLabel("Neu/Bearbeiten"); - label_5.setBounds(149, 91, 108, 14); + label_5.setBounds(149, 95, 108, 14); contentPanel.add(label_5); JSeparator separator_1 = new JSeparator(); @@ -278,6 +288,53 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener "Klicken Sie auf \"Fertigstellen\"."); lblKlickenSieAuf.setBounds(98, 423, 241, 14); contentPanel.add(lblKlickenSieAuf); + + JMenuBar menuBar = new JMenuBar(); + menuBar.setBounds(0, 0, 597, 21); + contentPanel.add(menuBar); + + JMenu menu = new JMenu("Hilfe"); + menuBar.add(menu); + + JMenuItem menuItem = new JMenuItem("FAQ"); + menuItem.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + String faq; + + faq = Links.getFAQ(); + + try { + Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + faq ); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + + menu.add(menuItem); + + JMenuItem menuItem_1 = new JMenuItem("OTRS"); + menuItem_1.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + String otrs; + + otrs = Links.getOTRS(); + + try { + Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + otrs ); + } catch (IOException f) { + // TODO Auto-generated catch block + f.printStackTrace(); + } + + } + }); + + menu.add(menuItem_1); { JPanel buttonPane = new JPanel(); buttonPane.setBackground(UIManager.getColor("Button.background")); @@ -298,7 +355,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener "Debug-Message", JOptionPane.ERROR_MESSAGE); } } - thrift.closeThriftConnection(); + SearchEditImage_GUI se = new SearchEditImage_GUI(); se.setVisible(true); dispose(); @@ -311,7 +368,7 @@ public class FTPDownloader_GUI extends JFrame implements PropertyChangeListener btnMainMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - thrift.closeThriftConnection(); + MainMenue_GUI mm = new MainMenue_GUI(); mm.setVisible(true); dispose(); |
