diff options
| author | Tobias Spitzer | 2014-08-26 07:42:14 +0200 |
|---|---|---|
| committer | Tobias Spitzer | 2014-08-26 07:42:14 +0200 |
| commit | 4fcc347e9b95c5dbf7ab2df310e66892c8da4380 (patch) | |
| tree | a270ce5b3735ebe99b8b2df1efe9eb56d04f9296 /Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java | |
| parent | sfda (diff) | |
| parent | date geändert (diff) | |
| download | tutor-module-4fcc347e9b95c5dbf7ab2df310e66892c8da4380.tar.gz tutor-module-4fcc347e9b95c5dbf7ab2df310e66892c8da4380.tar.xz tutor-module-4fcc347e9b95c5dbf7ab2df310e66892c8da4380.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tutor-module
Conflicts:
Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class
fsad
Diffstat (limited to 'Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java')
| -rw-r--r-- | Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java | 90 |
1 files changed, 67 insertions, 23 deletions
diff --git a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java index 62ea2a0c..a0d679fb 100644 --- a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java @@ -87,6 +87,7 @@ public class FTPCreateUploader_GUI extends JFrame implements JButton btnUploadStarten = new JButton("Upload auf Server starten"); JButton btnZurck = new JButton("Zur\u00FCck"); int progress = 0; // progress of upload + private boolean isCurrentlyLoading = false; // currently up or downloading file /** * Create the frame. @@ -99,7 +100,7 @@ public class FTPCreateUploader_GUI extends JFrame implements @Override public void windowClosing(WindowEvent arg0) { - + if (taskrun == true) { // check if user wants to quit. int choice = JOptionPane @@ -117,18 +118,15 @@ public class FTPCreateUploader_GUI extends JFrame implements } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); - JOptionPane.showMessageDialog(null, e1.getCause() - + "\n" + e1.getStackTrace(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); } task.cancel(true); con.closeThriftConnection(); System.exit(0); - }//end if choice + }// end if choice } else { - //no upload running, close window + // no upload running, close window System.exit(0); - }//end if taskrun + }// end if taskrun }// end window closing }); setResizable(false); @@ -200,12 +198,10 @@ public class FTPCreateUploader_GUI extends JFrame implements } lblPath = new JLabel(""); try { - Wini ini = new Wini( - new File( - "C:\\Users\\" - + System.getProperty("user.name") - + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); - lblPath.setText(ini.get("main", "Letzter Uploadpfad",String.class)); + Wini ini = new Wini(new File("C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + lblPath.setText(ini.get("main", "Letzter Uploadpfad", String.class)); } catch (InvalidFileFormatException e2) { // TODO Auto-generated catch block e2.printStackTrace(); @@ -213,10 +209,10 @@ public class FTPCreateUploader_GUI extends JFrame implements // TODO Auto-generated catch block e2.printStackTrace(); } - + lblPath.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent arg0) { - if (lblPath.getText()==null) { + if (lblPath.getText() == null) { // wenn leer, dann upload button nicht freigeben btnUploadStarten.setEnabled(false); btnUploadStarten.setText("Bitte warten"); @@ -374,7 +370,13 @@ public class FTPCreateUploader_GUI extends JFrame implements "C:\\Users\\" + System.getProperty("user.name") + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); - ini.put("main", "Letzter Uploadpfad", lblPath.getText().substring(0, lblPath.getText().lastIndexOf("\\"))); + ini.put("main", + "Letzter Uploadpfad", + lblPath.getText() + .substring( + 0, + lblPath.getText() + .lastIndexOf("\\"))); ini.store(); } catch (InvalidFileFormatException e2) { // TODO Auto-generated catch block @@ -408,10 +410,38 @@ public class FTPCreateUploader_GUI extends JFrame implements btnZurck.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - dispose(); + // check if loading file or not + if (isCurrentlyLoading() == true) { + int choice = JOptionPane + .showOptionDialog( + null, + "Nicht abgeschlossene Uploads werden beendet. Trotzdem zurück gehen?", + "Warnung", + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE, null, + options, options[1]); + // 0=beenden, 1=abbrechen + if (choice == 0) { + try { + client.DeleteFtpUser(user.userName); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + task.cancel(true); + // not loading files, go back one page + dispose(); + + PermissionCreateImage_GUI m = new PermissionCreateImage_GUI(); + m.setVisible(true); - PermissionCreateImage_GUI m = new PermissionCreateImage_GUI(); - m.setVisible(true); + } + } else { + dispose(); + + PermissionCreateImage_GUI m = new PermissionCreateImage_GUI(); + m.setVisible(true); + } } }); btnZurck.setActionCommand("Cancel"); @@ -533,14 +563,15 @@ public class FTPCreateUploader_GUI extends JFrame implements // Button zum Fertigstellen freischalten, wenn 100% erreicht sind if (progress == 0 || progress == 100) { // not uploading currently - btnZurck.setEnabled(true); + // btnZurck.setEnabled(true); } else { // currently uploading, don't let user interact - btnZurck.setEnabled(false); + // btnZurck.setEnabled(false); } // Fertigstellen erlauben wenn upload abgeschlossen if (progress == 100) { + isCurrentlyLoading(); finishButton.setEnabled(true); } else { @@ -625,5 +656,18 @@ public class FTPCreateUploader_GUI extends JFrame implements } return true; - } -}
\ No newline at end of file + }// end writeData() + + public boolean isCurrentlyLoading() { + isCurrentlyLoading = false; + + if (labelverbleibend.getText().equals("0")) { + isCurrentlyLoading = false; + } else { + isCurrentlyLoading = true; + } + System.out.println("isCurrentlyLoading"+isCurrentlyLoading); + return isCurrentlyLoading; + }// end isCurrentlyLoading() + +}// end class |
