summaryrefslogtreecommitdiff
path: root/sources/simulator/VSSimulatorFrame.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-06-01 19:28:00 +0000
committerPaul Buetow <paul@buetow.org>2008-06-01 19:28:00 +0000
commit00120474f64906e34fa79ce6ac8eede521c320d5 (patch)
tree88146a9507716ba40f10b01d55e14670a364f605 /sources/simulator/VSSimulatorFrame.java
parent9a0fc6463ac1bca1ec05056fb4f84163d1e9fc26 (diff)
initial complete serialization support
Diffstat (limited to 'sources/simulator/VSSimulatorFrame.java')
-rw-r--r--sources/simulator/VSSimulatorFrame.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/sources/simulator/VSSimulatorFrame.java b/sources/simulator/VSSimulatorFrame.java
index 890eb28..f5ef5af 100644
--- a/sources/simulator/VSSimulatorFrame.java
+++ b/sources/simulator/VSSimulatorFrame.java
@@ -25,6 +25,7 @@ package simulator;
import java.awt.*;
import java.awt.event.*;
+import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
@@ -41,7 +42,7 @@ import utils.*;
*
* @author Paul C. Buetow
*/
-public class VSSimulatorFrame extends VSFrame {
+public class VSSimulatorFrame extends VSFrame implements Serializable {
/** The serial version uid */
private static final long serialVersionUID = 1L;
@@ -507,4 +508,39 @@ public class VSSimulatorFrame extends VSFrame {
return new ImageIcon(imageURL, descr);
}
+
+ /**
+ * Write object.
+ *
+ * @param objectOutputStream the object output stream
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ public synchronized void writeObject(ObjectOutputStream objectOutputStream)
+ throws IOException {
+ objectOutputStream.writeObject(currentSimulator);
+ }
+
+ /**
+ * Read object.
+ *
+ * @param objectInputStream the object input stream
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws ClassNotFoundException the class not found exception
+ */
+ @SuppressWarnings("unchecked")
+ public synchronized void readObject(ObjectInputStream objectInputStream)
+ throws IOException, ClassNotFoundException {
+ if (VSDeserializationHelper.DEBUG)
+ System.out.println("Deserializing: VSSimulatorFrame");
+
+ VSDeserializationHelper.init();
+ VSDeserializationHelper.setObject("simulatorFrame", this);
+
+ currentSimulator = (VSSimulator) objectInputStream.readObject();
+
+ VSDeserializationHelper.destroy();
+ addSimulator(currentSimulator);
+ }
}