improved window tiling

This commit is contained in:
Stephan Richter
2020-10-11 12:06:14 +02:00
parent 3dc11c18e1
commit 8e747cb2a0
9 changed files with 154 additions and 111 deletions

View File

@@ -54,6 +54,18 @@ public class Car implements Constants {
}
this.id = id;
cars.put(id, this);
}
public static Object action(HashMap<String, String> params) throws IOException {
Car car = Car.get(params.get(Car.ID));
if (car == null) return t("No car with id {} found!",params.get(Car.ID));
switch (params.get(ACTION)) {
case ACTION_UPDATE:
return car.update(params);
case ACTION_PROPS:
return car.properties();
}
return t("Unknown action: {}",params.get(ACTION));
}
protected Tag cockpit(String realm) {
@@ -177,10 +189,10 @@ public class Car implements Constants {
this.train = train;
}
public Object update(HashMap<String, String> params) {
public Car update(HashMap<String, String> params) {
if (params.containsKey(NAME)) name = params.get(NAME);
if (params.containsKey(STOCK_ID)) stockId = params.get(STOCK_ID);
if (params.containsKey(LENGTH)) length = Integer.parseInt(params.get(LENGTH));
return null;
return this;
}
}