summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java')
-rw-r--r--dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java177
1 files changed, 66 insertions, 111 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java
index 0cb63429..482abcc6 100644
--- a/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java
@@ -10,17 +10,14 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
@@ -34,9 +31,10 @@ import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
import models.Image;
-import models.Links;
import models.SessionData;
import models.person;
@@ -45,6 +43,7 @@ import org.apache.thrift.TException;
import org.openslx.sat.thrift.iface.User;
import thrift.ThriftManager;
+import util.GuiManager;
import util.OpenLinks;
import config.Config;
import ftp.DownloadTask;
@@ -52,7 +51,7 @@ import gui.intro.About_GUI;
import gui.intro.MainMenue_GUI;
@SuppressWarnings("serial")
-public class FTPSearchDownloader_GUI extends JFrame implements
+public class FTPSearchDownloader_GUI extends JInternalFrame implements
PropertyChangeListener {
private final static Logger LOGGER = Logger
@@ -89,7 +88,7 @@ public class FTPSearchDownloader_GUI extends JFrame implements
private boolean isCurrentlyLoading = false; // currently up or downloading
// file
private boolean isAborted = false; // down- or upload was manually aborted
- private static final String HELP_MESSAGE = "<html><div align=\"center\">" +
+ public static final String HELP_MESSAGE = "<html><div align=\"center\">" +
"Hier können Sie Images herunterladen.<br />" +
"Klicken Sie anschließend auf \"Zurück\" oder \"Hauptmenü\", um zu Ihrer vorherigen Auswahl oder zum Menü zurückzugelangen.<br />" +
"</div></html>";
@@ -97,14 +96,13 @@ public class FTPSearchDownloader_GUI extends JFrame implements
/**
* Create the frame.
*/
- public FTPSearchDownloader_GUI(Component formerGUI) {
+ public FTPSearchDownloader_GUI() {
final Object[] options = { "Beenden", "Abbrechen" };
-
- addWindowListener(new WindowAdapter() {
+ addInternalFrameListener(new InternalFrameAdapter() {
@Override
- public void windowClosing(WindowEvent e) {
+ public void internalFrameClosing(InternalFrameEvent arg0) {
if (taskrun == true) {
// check if user wants to quit.
int choice = JOptionPane
@@ -140,18 +138,59 @@ public class FTPSearchDownloader_GUI extends JFrame implements
System.exit(0);
}// end if choice
- } else {
- // no download running, close window
- try {
- ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken());
- } catch (TException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- System.exit(0);
- }// end if taskrun
- }// end window closing
+ }
+ }
});
+// addWindowListener(new WindowAdapter() {
+// @Override
+// public void windowClosing(WindowEvent e) {
+// if (taskrun == true) {
+// // check if user wants to quit.
+// int choice = JOptionPane
+// .showOptionDialog(
+// c,
+// "Aktuell ist ein Download aktiv. Wollen Sie diesen Abbrechen und das Programm beenden?",
+// "Upload aktiv",
+// JOptionPane.YES_NO_CANCEL_OPTION,
+// JOptionPane.QUESTION_MESSAGE, null,
+// options, options[1]);
+// // 0=beenden, 1=abbrechen
+// if (choice == 0) {
+//
+// try {
+// ThriftManager.getSatClient().DeleteFtpUser(user.userName,SessionData.session.getAuthToken());
+// try {
+// ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken());
+// } catch (TException e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
+// try {
+// ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken());
+// } catch (TException e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
+// } catch (TException e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
+// task.cancel(true);
+//
+// System.exit(0);
+// }// end if choice
+// } else {
+// // no download running, close window
+// try {
+// ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken());
+// } catch (TException e1) {
+// // TODO Auto-generated catch block
+// e1.printStackTrace();
+// }
+// System.exit(0);
+// }// end if taskrun
+// }// end window closing
+// });
setResizable(false);
try {
@@ -167,7 +206,6 @@ public class FTPSearchDownloader_GUI extends JFrame implements
// Aktion die beim Schliessen durchgefuehrt werden soll
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setBounds(0, 0, 603, 722);
- setLocationRelativeTo(formerGUI);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBackground(SystemColor.menu);
@@ -346,79 +384,14 @@ public class FTPSearchDownloader_GUI extends JFrame implements
"Klicken Sie auf \"Zurück\" oder \"Hauptmenü\".");
lblKlickenSieAuf.setBounds(102, 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) {
-
- URI windows;
- try {
- windows = new URI(Links.getFAQ());
-
- OpenLinks.openWebpage(windows);
-
- } catch (URISyntaxException 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) {
-
- URI windows;
- try {
- windows = new URI(Links.getOTRS());
-
- OpenLinks.openWebpage(windows);
-
- } catch (URISyntaxException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
- });
-
- menu.add(menuItem_1);
-
- JMenuItem mntmAbout = new JMenuItem("About");
- mntmAbout.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- About_GUI ab = new About_GUI();
- ab.setVisible(true);
- }
- });
- menu.add(mntmAbout);
-
+
lblAnleitung = new JLabel(
"<HTML><U>Anleitung zum erstellen einer virtuellen Maschine herunterladen</U></HTML>");
lblAnleitung.setForeground(Color.BLUE);
lblAnleitung.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
- URI anleitung;
- try {
- anleitung = new URI(Links.getAnleitungVMDK());
- OpenLinks.openWebpage(anleitung);
- } catch (URISyntaxException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ OpenLinks.openWebpage("vmware");
}
});
lblAnleitung.setBounds(102, 448, 311, 14);
@@ -474,16 +447,12 @@ public class FTPSearchDownloader_GUI extends JFrame implements
e1.printStackTrace();
}
// go back one page
- SearchImage_GUI si = new SearchImage_GUI(c);
- si.setVisible(true);
- dispose();
+ GuiManager.show(new SearchImage_GUI());
}// end choice
} else {
// go back one page
- SearchImage_GUI si = new SearchImage_GUI(c);
- si.setVisible(true);
- dispose();
+ GuiManager.show(new SearchImage_GUI());
}// end else
// save config in any case
Config.setLastDownloadPath(lblPath.getText().trim());
@@ -499,26 +468,12 @@ public class FTPSearchDownloader_GUI extends JFrame implements
Config.setLastDownloadPath(lblPath.getText().trim());
Config.store();
- MainMenue_GUI mm = new MainMenue_GUI(c);
- mm.setVisible(true);
- dispose();
+ GuiManager.show(new MainMenue_GUI());
}
});
btnMainMenu.setActionCommand("Cancel");
buttonPane.add(btnMainMenu);
}
-
- JMenu mnNewMenu_Info = new JMenu("Info");
- mnNewMenu_Info.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent arg0) {
- JOptionPane.showMessageDialog(c, HELP_MESSAGE, "Hilfe zu dieser Oberfläche", JOptionPane.INFORMATION_MESSAGE);
- }
- });
- menuBar.add(mnNewMenu_Info);
-
- c = this;
- setVisible(true);
}