implemented tables for locos, trains and cars

This commit is contained in:
Stephan Richter
2020-11-19 00:04:58 +01:00
parent 591d9d26f5
commit 5182cfb144
8 changed files with 128 additions and 26 deletions

View File

@@ -179,6 +179,19 @@ public abstract class Block extends StretchableTile implements Comparable<Block>
return json;
}
/**
* If arguments are given, the first is taken as content, the second as tag type.
* If no content is supplied, name is set as content.
* If no type is supplied, "span" is preset.
* @param args
* @return
*/
public Tag link(String...args) {
String tx = args.length<1 ? name+NBSP : args[0];
String type = args.length<2 ? "span" : args[1];
return link(type, Map.of(REALM,REALM_PLAN,ID,id(),ACTION,ACTION_CLICK), tx);
}
@Override
protected Tile load(JSONObject json) throws IOException {
super.load(json);

View File

@@ -146,6 +146,20 @@ public abstract class Tile extends BaseClass{
return this;
}
/**
* If arguments are given, the first is taken as content, the second as tag type.
* If no content is supplied, id() is set as content.
* If no type is supplied, "span" is preset.
* @param args
* @return
*/
public Tag link(String...args) {
String tx = args.length<1 ? id()+NBSP : args[0];
String type = args.length<2 ? "span" : args[1];
return link(type, Map.of(REALM,REALM_PLAN,ID,id(),ACTION,ACTION_CLICK), tx);
}
public static void loadAll(String filename, Plan plan) throws IOException {
BufferedReader file = new BufferedReader(new FileReader(filename));
String line = file.readLine();