overhauling save and load routines

This commit is contained in:
Stephan Richter
2020-09-21 12:07:10 +02:00
parent 72858b4aba
commit 09a7c9f5b7
10 changed files with 257 additions and 159 deletions

View File

@@ -1,5 +1,6 @@
package de.srsoftware.web4rail.tiles;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map.Entry;
@@ -19,9 +20,17 @@ public abstract class StretchableTile extends Tile {
}
@Override
public void configure(JSONObject config) {
super.configure(config);
if (config.has(LENGTH)) setLength(config.getInt(LENGTH));
public JSONObject json() {
JSONObject json = super.json();
if (length > 1) json.put(LENGTH, length);
return json;
}
@Override
protected Tile load(JSONObject json) throws IOException {
super.load(json);
if (json.has(LENGTH)) length = json.getInt(LENGTH);
return this;
}
@Override