summaryrefslogtreecommitdiff
path: root/sources/serialize
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-06-03 16:41:37 +0000
committerPaul Buetow <paul@buetow.org>2008-06-03 16:41:37 +0000
commit11af1c9fa7fe66e10de0a92878311b4e22befb0f (patch)
tree8dfc7af2ec18eb5889327426bc6fdb7379a3feba /sources/serialize
parentf7bdf8a7f6ebd43bfacc22eeeda3eb52bf50efd7 (diff)
made future serialized class versions backwards compatible.
Diffstat (limited to 'sources/serialize')
-rw-r--r--sources/serialize/VSSerialize.java76
1 files changed, 38 insertions, 38 deletions
diff --git a/sources/serialize/VSSerialize.java b/sources/serialize/VSSerialize.java
index 7591ea1..0d44d31 100644
--- a/sources/serialize/VSSerialize.java
+++ b/sources/serialize/VSSerialize.java
@@ -159,12 +159,12 @@ public final class VSSerialize {
* @param simulator The simulator
*/
public void saveSimulator(String filename, VSSimulator simulator) {
- if (filename == null) {
- saveSimulator(simulator);
- return;
- }
+ if (filename == null) {
+ saveSimulator(simulator);
+ return;
+ }
- LAST_FILENAME = filename;
+ LAST_FILENAME = filename;
try {
FileOutputStream fileOutputStream =
@@ -177,7 +177,7 @@ public final class VSSerialize {
simulator.serialize(this, objectOutputStream);
} catch (IOException e) {
- e.printStackTrace();
+ //e.printStackTrace();
} finally {
//objectOutputStream.close();
@@ -190,17 +190,17 @@ public final class VSSerialize {
* @param simulator The simulator
*/
public void saveSimulator(VSSimulator simulator) {
- VSPrefs prefs = simulator.getPrefs();
- VSSimulatorFrame simulatorFrame = simulator.getSimulatorFrame();
+ VSPrefs prefs = simulator.getPrefs();
+ VSSimulatorFrame simulatorFrame = simulator.getSimulatorFrame();
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setMultiSelectionEnabled(false);
- fileChooser.addChoosableFileFilter(createFileFilter(prefs));
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setMultiSelectionEnabled(false);
+ fileChooser.addChoosableFileFilter(createFileFilter(prefs));
- if (fileChooser.showOpenDialog(simulatorFrame) ==
- JFileChooser.APPROVE_OPTION)
- saveSimulator(fileChooser.getSelectedFile().getName(),
- simulator);
+ if (fileChooser.showOpenDialog(simulatorFrame) ==
+ JFileChooser.APPROVE_OPTION)
+ saveSimulator(fileChooser.getSelectedFile().getName(),
+ simulator);
}
/**
@@ -230,7 +230,7 @@ public final class VSSerialize {
simulator.deserialize(this, objectInputStream);
} catch (Exception e) {
- e.printStackTrace();
+ //e.printStackTrace();
} finally {
//objectInputStream.close();
@@ -247,38 +247,38 @@ public final class VSSerialize {
* @return The simulator object, and null if no success
*/
public VSSimulator openSimulator(VSSimulatorFrame simulatorFrame) {
- VSPrefs prefs = simulatorFrame.getPrefs();
+ VSPrefs prefs = simulatorFrame.getPrefs();
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setMultiSelectionEnabled(false);
- fileChooser.addChoosableFileFilter(createFileFilter(prefs));
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setMultiSelectionEnabled(false);
+ fileChooser.addChoosableFileFilter(createFileFilter(prefs));
- if (fileChooser.showOpenDialog(simulatorFrame) ==
- JFileChooser.APPROVE_OPTION)
- return openSimulator(fileChooser.getSelectedFile().getName(),
- simulatorFrame);
+ if (fileChooser.showOpenDialog(simulatorFrame) ==
+ JFileChooser.APPROVE_OPTION)
+ return openSimulator(fileChooser.getSelectedFile().getName(),
+ simulatorFrame);
return null;
}
/**
* Creates a file filter for the file choosers
- *
- * @param prefs The default prefs
+ *
+ * @param prefs The default prefs
*/
private javax.swing.filechooser.FileFilter createFileFilter(
- final VSPrefs prefs) {
- return new javax.swing.filechooser.FileFilter() {
- public boolean accept(File file) {
- if (file.isDirectory())
- return true;
- return file.getName().toLowerCase().endsWith(".dat");
- }
-
- public String getDescription() {
- return prefs.getString("lang.dat");
- }
- };
+ final VSPrefs prefs) {
+ return new javax.swing.filechooser.FileFilter() {
+ public boolean accept(File file) {
+ if (file.isDirectory())
+ return true;
+ return file.getName().toLowerCase().endsWith(".dat");
+ }
+
+ public String getDescription() {
+ return prefs.getString("lang.dat");
+ }
+ };
}
}