summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-11-25 12:49:11 +0100
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-11-25 12:49:11 +0100
commit90ece7977ad726fc8406b4b61cc0bd12679a2a73 (patch)
treeb011f1788e3a33eb50283ec312b7c2a77588e338
parent438df11d280a31481aa8b5bf7dfe4bae2ee8e3bc (diff)
downloadNotepad---90ece7977ad726fc8406b4b61cc0bd12679a2a73.tar.gz
Notepad---90ece7977ad726fc8406b4b61cc0bd12679a2a73.zip
Rework file handling
-rw-r--r--src/de/fhswf/in/inf/se/notepadMinusMinus/Main.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/de/fhswf/in/inf/se/notepadMinusMinus/Main.java b/src/de/fhswf/in/inf/se/notepadMinusMinus/Main.java
index 0c8c4eb..da0e06d 100644
--- a/src/de/fhswf/in/inf/se/notepadMinusMinus/Main.java
+++ b/src/de/fhswf/in/inf/se/notepadMinusMinus/Main.java
@@ -27,6 +27,8 @@ public class Main extends Application
private Stage primaryStage;
+ private File openFile;
+
@Override
public void start(Stage primaryStage)
{
@@ -63,6 +65,21 @@ public class Main extends Application
return gradeList;
}
+ public Stage getPrimaryStage()
+ {
+ return primaryStage;
+ }
+
+ public File getOpenFile()
+ {
+ return openFile;
+ }
+
+ public void setOpenFile(File openFile)
+ {
+ this.openFile = openFile;
+ }
+
public File getGradesFilePath()
{
Preferences prefs = Preferences.userNodeForPackage(Main.class);
@@ -112,6 +129,8 @@ public class Main extends Application
// Save the file path to the registry.
setGradesFilePath(file);
+ // Save file in use.
+ setOpenFile(file);
}
catch (Exception e)
{ // catches ANY exception
@@ -141,6 +160,9 @@ public class Main extends Application
// Marshalling and saving XML to the file.
m.marshal(wrapper, file);
+
+ // Save the file path to the registry.
+ setGradesFilePath(file);
}
catch (Exception e)
{ // catches ANY exception
@@ -155,9 +177,4 @@ public class Main extends Application
alert.showAndWait();
}
}
-
- public void saveGradesToFile()
- {
- saveGradesToFile(getGradesFilePath());
- }
}