Implement save and load functionality to persist and restore drawings.
Current State
Export to HTML and SVG exists (HTMLExporter, SVGExporter)
No serialization of full model state
No persistence
Implementation Plan
1. Serialization format
Use JSON for human-readable format
Or use Java Serialization for binary format
Store all shape data: type, position, size, attributes
2. Data structure
3. Save operation
Menu item: File > Save / Save As
Serialize SCollection to file
Use file chooser dialog
Default extension: .shapes or .json
4. Load operation
Menu item: File > Open
Deserialize from file
Replace current model contents
Clear selection
Reset view
5. Error handling
Invalid format: show error dialog
Missing shapes: log warning, continue
Version mismatch: migration or error
Files to create/modify
Create: persistence/ShapeSerializer.java
Create: persistence/ShapeDeserializer.java
Modify: App.java - add File menu items
Modify: SCollection.java - add serialization support if needed
Edge cases
Loading fails: keep current drawing, show error
Save to existing file: confirm overwrite
Empty drawing: save empty file (valid)
Forward compatibility: warn on newer versions
## Overview
Implement save and load functionality to persist and restore drawings.
## Current State
- Export to HTML and SVG exists (HTMLExporter, SVGExporter)
- No serialization of full model state
- No persistence
## Implementation Plan
### 1. Serialization format
- Use JSON for human-readable format
- Or use Java Serialization for binary format
- Store all shape data: type, position, size, attributes
### 2. Data structure
### 3. Save operation
- Menu item: File > Save / Save As
- Serialize SCollection to file
- Use file chooser dialog
- Default extension: .shapes or .json
### 4. Load operation
- Menu item: File > Open
- Deserialize from file
- Replace current model contents
- Clear selection
- Reset view
### 5. Error handling
- Invalid format: show error dialog
- Missing shapes: log warning, continue
- Version mismatch: migration or error
## Files to create/modify
- Create: persistence/ShapeSerializer.java
- Create: persistence/ShapeDeserializer.java
- Modify: App.java - add File menu items
- Modify: SCollection.java - add serialization support if needed
## Edge cases
- Loading fails: keep current drawing, show error
- Save to existing file: confirm overwrite
- Empty drawing: save empty file (valid)
- Forward compatibility: warn on newer versions
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Overview
Implement save and load functionality to persist and restore drawings.
Current State
Implementation Plan
1. Serialization format
2. Data structure
3. Save operation
4. Load operation
5. Error handling
Files to create/modify
Edge cases