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.java96
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();