diff options
author | Jonathan Bauer | 2014-09-12 15:30:55 +0200 |
---|---|---|
committer | Jonathan Bauer | 2014-09-12 15:30:55 +0200 |
commit | 0cdabcb40bc8d0a3aad8a927a53bd85a95627b8d (patch) | |
tree | 726498f1ca711763e9f61b9b0feb8db8c239ae40 /dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java | |
parent | [client] Show automatically generated version string (diff) | |
download | tutor-module-0cdabcb40bc8d0a3aad8a927a53bd85a95627b8d.tar.gz tutor-module-0cdabcb40bc8d0a3aad8a927a53bd85a95627b8d.tar.xz tutor-module-0cdabcb40bc8d0a3aad8a927a53bd85a95627b8d.zip |
use new Config stuff for reading download/upload paths
Diffstat (limited to 'dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java')
-rw-r--r-- | dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java | 96 |
1 files changed, 13 insertions, 83 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java index c3041e41..00ba595d 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java @@ -51,6 +51,7 @@ import util.OpenLinks; import ftp.DownloadTask; import gui.intro.About_GUI; import gui.intro.MainMenue_GUI; +import config.Config; @SuppressWarnings("serial") public class FTPSearchDownloader_GUI extends JFrame implements @@ -154,27 +155,9 @@ public class FTPSearchDownloader_GUI extends JFrame implements "Speicherort ausw\u00E4hlen"); btnSpeicherortAuswhlen.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")); - 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 = new JFileChooser(Config.getString("main", "Letzter Downloadpfad", System.getProperty("user.home"))); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + fc.showOpenDialog(getParent()); File dir = fc.getSelectedFile(); // check if directory is selected @@ -193,20 +176,10 @@ public class FTPSearchDownloader_GUI extends JFrame implements contentPanel.add(btnSpeicherortAuswhlen); } + // read last download path from config 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.setText(Config.getString("main", "Letzter Downloadpfad", System.getProperty("user.home"))); + lblPath.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent arg0) { if (lblPath.getText() == null) { @@ -457,22 +430,6 @@ public class FTPSearchDownloader_GUI extends JFrame implements // TODO Auto-generated catch block e1.printStackTrace(); } - 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(); - } // go back one page SearchImage_GUI si = new SearchImage_GUI(); si.setVisible(true); @@ -480,28 +437,14 @@ public class FTPSearchDownloader_GUI extends JFrame implements }// end choice } else { - - 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(); - } // go back one page SearchImage_GUI si = new SearchImage_GUI(); si.setVisible(true); dispose(); }// end else + // save config in any case + Config.setString("main", "Letzter Downloadpfad", lblPath.getText()); + Config.store(); }//end action }); btnZurck.setActionCommand("Cancel"); @@ -510,22 +453,9 @@ 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(); - } + Config.setString("main", "Letzter Downloadpfad", lblPath.getText()); + Config.store(); + MainMenue_GUI mm = new MainMenue_GUI(); mm.setVisible(true); dispose(); |