preparing menus for editing cars and trains

This commit is contained in:
Stephan Richter
2020-09-21 19:12:33 +02:00
parent fa58c33938
commit 7acbf567e8
7 changed files with 85 additions and 28 deletions

View File

@@ -2,6 +2,9 @@ package de.srsoftware.web4rail.moving;
import org.json.JSONObject;
import de.srsoftware.tools.Tag;
import de.srsoftware.web4rail.Window;
public class Locomotive extends Car {
private static final String REVERSE = "reverse";
@@ -30,8 +33,23 @@ public class Locomotive extends Car {
super.load(json);
if (json.has(REVERSE)) reverse = json.getBoolean(REVERSE);
}
public void setSpeed(int v) {
// TODO Auto-generated method stub
}
public static Object manager() {
Window win = new Window("loco-manager", t("Locomotive manager"));
new Tag("h4").content(t("known locomotives")).addTo(win);
Tag list = new Tag("ul");
for (Car car : cars.values()) {
if (car instanceof Locomotive) {
Locomotive loco = (Locomotive) car;
loco.link("li").addTo(list);
}
}
list.addTo(win);
return win;
}
}