made tiles configurable
This commit is contained in:
@@ -3,6 +3,8 @@ package de.srsoftware.web4rail.tiles;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.tags.Form;
|
||||
@@ -11,6 +13,19 @@ public abstract class StretchableTile extends Tile {
|
||||
private static final String LENGTH = "length";
|
||||
public int length = 1;
|
||||
|
||||
@Override
|
||||
public JSONObject config() {
|
||||
JSONObject config = super.config();
|
||||
if (length != 1) config.put(LENGTH, length);
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(JSONObject config) {
|
||||
super.configure(config);
|
||||
if (config.has(LENGTH)) setLength(config.getInt(LENGTH));
|
||||
}
|
||||
|
||||
public Tag propMenu() {
|
||||
Window menu = new Window("tile-properties",t("Properties of {} @ ({},{})",getClass().getSimpleName(),x,y));
|
||||
Form form = new Form();
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -26,6 +27,12 @@ public abstract class Tile {
|
||||
classes.add(getClass().getSimpleName());
|
||||
}
|
||||
|
||||
public JSONObject config() {
|
||||
return new JSONObject();
|
||||
}
|
||||
|
||||
public void configure(JSONObject config) {}
|
||||
|
||||
public int height() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user