diff options
| author | Tobias Spitzer | 2014-08-25 14:53:14 +0200 |
|---|---|---|
| committer | Tobias Spitzer | 2014-08-25 14:53:14 +0200 |
| commit | 4717a283f45eb8433767d0d0ca71cfdda7fccf61 (patch) | |
| tree | 8e4a8315f0fa3a56cf6df7f97e7ef39e3ce0dbdb /Dozentenmodul/src/gui/image | |
| parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
| download | tutor-module-4717a283f45eb8433767d0d0ca71cfdda7fccf61.tar.gz tutor-module-4717a283f45eb8433767d0d0ca71cfdda7fccf61.tar.xz tutor-module-4717a283f45eb8433767d0d0ca71cfdda7fccf61.zip | |
Letzter Down- und Uploadpfad werden nun in die Konfig geschrieben
Diffstat (limited to 'Dozentenmodul/src/gui/image')
4 files changed, 137 insertions, 12 deletions
diff --git a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java index 2bea341d..d8ac09c2 100644 --- a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java @@ -76,6 +76,7 @@ public class FTPCreateUploader_GUI extends JFrame implements JLabel labelfilesize; JLabel labelZeit; JLabel labelverbleibend; + JFileChooser fc; long filesize; double speed; long bytesread; @@ -161,7 +162,21 @@ public class FTPCreateUploader_GUI extends JFrame implements JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); btnSpeicherortAuswhlen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); + try { + Wini ini = new Wini( + new File( + "C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + fc = new JFileChooser(ini.get("main", "Letzter Uploadpfad",String.class)); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.showOpenDialog(getParent()); diff --git a/Dozentenmodul/src/gui/image/FTPEditDownloader_GUI.java b/Dozentenmodul/src/gui/image/FTPEditDownloader_GUI.java index 8f7bb8ce..7a439934 100644 --- a/Dozentenmodul/src/gui/image/FTPEditDownloader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPEditDownloader_GUI.java @@ -72,6 +72,7 @@ public class FTPEditDownloader_GUI extends JFrame implements JLabel lblBytesread; JLabel lblNewLabel_3; JLabel labelVerbleibend; + JFileChooser fc; long filesize; double speed; int progress = 0; // progress of download @@ -154,10 +155,7 @@ public class FTPEditDownloader_GUI extends JFrame implements "Speicherort ausw\u00E4hlen"); btnSpeicherortAuswhlen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - fc.showOpenDialog(getParent()); try { Wini ini = new Wini( new File( @@ -165,7 +163,10 @@ public class FTPEditDownloader_GUI extends JFrame implements + System.getProperty("user.name") + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); System.out.println("FileChooser Pfad: "+ini.get("main", "Letzter Downloadpfad", String.class)); - fc.setCurrentDirectory(new File(ini.get("main", "Letzter Downloadpfad", String.class))); + fc = new JFileChooser(ini.get("main", "Letzter Downloadpfad", String.class)); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + fc.showOpenDialog(getParent()); } catch (InvalidFileFormatException e2) { // TODO Auto-generated catch block e2.printStackTrace(); @@ -173,6 +174,7 @@ public class FTPEditDownloader_GUI extends JFrame implements // TODO Auto-generated catch block e2.printStackTrace(); } + File dir = fc.getSelectedFile(); // check if directory is selected if (dir != null) { diff --git a/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java index de1f6ffe..b73e0723 100644 --- a/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java @@ -14,6 +14,7 @@ import java.awt.event.WindowEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; +import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.text.DateFormat; @@ -43,6 +44,8 @@ import models.SessionData; import models.person; import org.apache.thrift.TException; +import org.ini4j.InvalidFileFormatException; +import org.ini4j.Wini; import server.Server.Client; import thrift.ThriftConnection; @@ -73,6 +76,7 @@ public class FTPEditUploader_GUI extends JFrame implements JLabel labelfilesize; JLabel labelZeit; JLabel labelverbleibend; + JFileChooser fc; long filesize; double speed; long bytesread; @@ -153,14 +157,28 @@ public class FTPEditUploader_GUI extends JFrame implements btnSpeicherortAuswhlen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); + try { + Wini ini = new Wini( + new File( + "C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + fc = new JFileChooser(ini.get("main", "Letzter Uploadpfad",String.class)); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.showOpenDialog(getParent()); File file = fc.getSelectedFile(); // check if a file is selected and exists if (file != null) { - // file exists + // file selected uploadFile = file; filename = uploadFile.getName(); lblPath.setText(file.getAbsolutePath()); @@ -177,6 +195,20 @@ public class FTPEditUploader_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)); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } lblPath.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent arg0) { if (lblPath.getText().isEmpty()) { @@ -326,6 +358,21 @@ public class FTPEditUploader_GUI extends JFrame implements public void actionPerformed(ActionEvent e) { updateData(); + try { + Wini ini = new Wini( + new File( + "C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + ini.put("main", "Letzter Uploadpfad", lblPath.getText().substring(0, lblPath.getText().lastIndexOf("\\"))); + ini.store(); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } dispose(); MainMenue_GUI m = new MainMenue_GUI(); m.setVisible(true); diff --git a/Dozentenmodul/src/gui/image/FTPSearchDownloader_GUI.java b/Dozentenmodul/src/gui/image/FTPSearchDownloader_GUI.java index 8c372983..555dd9f6 100644 --- a/Dozentenmodul/src/gui/image/FTPSearchDownloader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPSearchDownloader_GUI.java @@ -14,6 +14,7 @@ import java.awt.event.WindowEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; +import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -39,6 +40,8 @@ import models.Links; import models.SessionData; import org.apache.thrift.TException; +import org.ini4j.InvalidFileFormatException; +import org.ini4j.Wini; import server.Server.Client; import server.User; @@ -68,6 +71,7 @@ public class FTPSearchDownloader_GUI extends JFrame implements JLabel lblBytesread; JLabel lblNewLabel_3; JLabel labelVerbleibend; + JFileChooser fc; long filesize; double speed; int progress = 0; // progress of download @@ -151,10 +155,25 @@ public class FTPSearchDownloader_GUI extends JFrame implements "Speicherort ausw\u00E4hlen"); btnSpeicherortAuswhlen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - JFileChooser fc = new JFileChooser(); - fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + try { + Wini ini = new Wini( + new File( + "C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + System.out.println("FileChooser Pfad: "+ini.get("main", "Letzter Downloadpfad", String.class)); + fc = new JFileChooser(ini.get("main", "Letzter Downloadpfad", String.class)); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + fc.showOpenDialog(getParent()); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } - fc.showOpenDialog(getParent()); File dir = fc.getSelectedFile(); // check if directory is selected if (dir != null) { @@ -173,6 +192,20 @@ public class FTPSearchDownloader_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 Downloadpfad",String.class)); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } lblPath.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent arg0) { if (lblPath.getText().isEmpty()) { @@ -419,7 +452,21 @@ public class FTPSearchDownloader_GUI extends JFrame implements JOptionPane.ERROR_MESSAGE); } } - + try { + Wini ini = new Wini( + new File( + "C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + ini.put("main", "Letzter Downloadpfad", lblPath.getText()); + ini.store(); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } SearchImage_GUI se = new SearchImage_GUI(); se.setVisible(true); dispose(); @@ -431,7 +478,21 @@ public class FTPSearchDownloader_GUI extends JFrame implements btnMainMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - + try { + Wini ini = new Wini( + new File( + "C:\\Users\\" + + System.getProperty("user.name") + + "\\AppData\\Roaming\\bwLehrpoolSuite\\config.ini")); + ini.put("main", "Letzter Downloadpfad", lblPath.getText()); + ini.store(); + } catch (InvalidFileFormatException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } catch (IOException e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } MainMenue_GUI mm = new MainMenue_GUI(); mm.setVisible(true); dispose(); |
