summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java
diff options
context:
space:
mode:
authorJonathan Bauer2015-03-03 19:02:48 +0100
committerJonathan Bauer2015-03-03 19:02:48 +0100
commit0447841f3a08890bf746625d0f17976adada6ac8 (patch)
treef63bd9f2ac8d77f4732b70cac8e5c0497f4d3a45 /dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java
parentwarnings fix (diff)
downloadtutor-module-0447841f3a08890bf746625d0f17976adada6ac8.tar.gz
tutor-module-0447841f3a08890bf746625d0f17976adada6ac8.tar.xz
tutor-module-0447841f3a08890bf746625d0f17976adada6ac8.zip
bwIDM - Shibboleth login working for Freiburg's SP - more to come
rework GUI classes to work with GuiManager: use GuiManager.show(<GUI to show>) and GuiManager.openPopup(<popup like About_GUI or ListAllOtherUsers_GUI>) only! static openlinks class (models/links.java deleted). There are keywords to open links, e.g. OpenLinks.openWebpage("faq"). Please see the class.
Diffstat (limited to 'dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java')
-rw-r--r--dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java173
1 files changed, 64 insertions, 109 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java
index d201d3b7..88bc1cc8 100644
--- a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java
+++ b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java
@@ -10,13 +10,9 @@ 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 java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -24,6 +20,7 @@ import java.util.Date;
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;
@@ -37,10 +34,11 @@ 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 javax.swing.filechooser.FileNameExtensionFilter;
import models.Image;
-import models.Links;
import models.RightsManagement;
import models.SessionData;
import models.person;
@@ -50,6 +48,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.UploadTask;
@@ -58,7 +57,7 @@ import gui.intro.MainMenue_GUI;
import gui.lecture.CreateLectureAllgemein_GUI;
@SuppressWarnings("serial")
-public class FTPCreateUploader_GUI extends JFrame implements
+public class FTPCreateUploader_GUI extends JInternalFrame implements
PropertyChangeListener {
/**
@@ -101,7 +100,7 @@ public class FTPCreateUploader_GUI extends JFrame implements
private boolean isAborted = false; // down- or upload was manually aborted
private String uuid;
- private static final String HELP_MESSAGE = "<html><div align = \"center\">"
+ public static final String HELP_MESSAGE = "<html><div align = \"center\">"
+ "Laden Sie hier Ihre .vmdk-Datei hoch, die dann als virtuelles Labor geladen werden kann.<br />"
+ "Wichtig ist, dass Sie zum Schluss auf \"Fertigstellen\" klicken, damit die Daten übernommen werden.<br />"
+ "Wenn Sie die Datei hochgeladen haben, dann aber auf \"zurück\" klicken, oder die Anwendung beenden,<br />"
@@ -111,7 +110,7 @@ public class FTPCreateUploader_GUI extends JFrame implements
/**
* Create the frame.
*/
- public FTPCreateUploader_GUI(Component formerGUI) {
+ public FTPCreateUploader_GUI() {
final Object[] options = { "Beenden", "Abbrechen" };
@@ -123,12 +122,9 @@ public class FTPCreateUploader_GUI extends JFrame implements
e1.printStackTrace();
}
-
- addWindowListener(new WindowAdapter() {
-
+ addInternalFrameListener(new InternalFrameAdapter() {
@Override
- public void windowClosing(WindowEvent arg0) {
-
+ public void internalFrameClosing(InternalFrameEvent arg0) {
if (taskrun == true) {
// check if user wants to quit.
int choice = JOptionPane
@@ -158,20 +154,58 @@ public class FTPCreateUploader_GUI extends JFrame implements
}
System.exit(0);
}// end if choice
- } else {
- // no upload running, close window
-
- try {
- ThriftManager.getSatClient().setSessionInvalid(SessionData.session
- .getAuthToken());
- } catch (TException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- System.exit(0);
- }
- }// end if taskrun
- }// end window closing
+ }
+ }
});
+
+// addWindowListener(new WindowAdapter() {
+//
+// @Override
+// public void windowClosing(WindowEvent arg0) {
+//
+// if (taskrun == true) {
+// // check if user wants to quit.
+// int choice = JOptionPane
+// .showOptionDialog(
+// c,
+// "Aktuell ist ein Upload 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());
+// } catch (TException e1) {
+//
+// e1.printStackTrace();
+// }
+// task.cancel(true);
+// try {
+// ThriftManager.getSatClient().setSessionInvalid(SessionData.session
+// .getAuthToken());
+// } catch (TException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// System.exit(0);
+// }// end if choice
+// } else {
+// // no upload running, close window
+//
+// try {
+// ThriftManager.getSatClient().setSessionInvalid(SessionData.session
+// .getAuthToken());
+// } catch (TException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// System.exit(0);
+// }
+// }// end if taskrun
+// }// end window closing
+// });
setResizable(false);
try {
@@ -193,7 +227,6 @@ public class FTPCreateUploader_GUI extends JFrame implements
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setBounds(0, 0, 603, 722);
- setLocationRelativeTo(formerGUI);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBackground(SystemColor.menu);
@@ -346,10 +379,7 @@ public class FTPCreateUploader_GUI extends JFrame implements
@Override
public void mouseClicked(MouseEvent arg0) {
// oeffnet das Hauptmenue
-
- FTPCreateUploader_GUI.this.dispose();
- MainMenue_GUI main = new MainMenue_GUI(c);
- main.setVisible(true);
+ GuiManager.show(new MainMenue_GUI());
}
});
@@ -460,9 +490,6 @@ public class FTPCreateUploader_GUI extends JFrame implements
// save configuration
Config.store();
- // dispose();
- // MainMenue_GUI m = new MainMenue_GUI(c);
- // m.setVisible(true);
if (taskrun == true) {
try {
@@ -496,16 +523,10 @@ public class FTPCreateUploader_GUI extends JFrame implements
// 0=New Lecture, 1=Main Menu
if (choice == 0) {
- dispose();
- CreateLectureAllgemein_GUI cl = new CreateLectureAllgemein_GUI(
- c);
- cl.setVisible(true);
+ GuiManager.show(new CreateLectureAllgemein_GUI());
} else {
- dispose();
- MainMenue_GUI m = new MainMenue_GUI(c);
- m.setVisible(true);
+ GuiManager.show(new MainMenue_GUI());
}
-
}
});
@@ -545,12 +566,7 @@ public class FTPCreateUploader_GUI extends JFrame implements
if (selectedOption == JOptionPane.YES_OPTION) {
// System.out.println("CreateUploader X:"+formerGUI.getLocation().getX());
// System.out.println("CreateUploader X:"+formerGUI.getLocation().getY());
- PermissionCreateImage_GUI m = new PermissionCreateImage_GUI(
- c);
- // m.setLocationRelativeTo(formerGUI);
- m.setVisible(true);
- dispose();
-
+ GuiManager.show(new PermissionCreateImage_GUI());
} else {
// for actions if "no" is selected. tbd.
}
@@ -565,68 +581,7 @@ public class FTPCreateUploader_GUI extends JFrame implements
}
}
- JMenuBar menuBar = new JMenuBar();
- setJMenuBar(menuBar);
-
- JMenu menu = new JMenu("Hilfe");
- menuBar.add(menu);
-
- JMenuItem menuItem = new JMenuItem("FAQ");
- menuItem.addMouseListener(new MouseAdapter() {
- @Override
- public void mousePressed(MouseEvent arg0) {
- // OpenLinks open = new OpenLinks();
- URI windows;
- try {
- windows = new URI(Links.getFAQ());
- OpenLinks.openWebpage(windows);
- } catch (URISyntaxException e) {
-
- 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) {
-
- 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);
- setVisible(true);
-
- 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;
}
private void buttonUploadActionPerformed(ActionEvent event) {