further improvement of train management

This commit is contained in:
Stephan Richter
2020-11-14 15:49:43 +01:00
parent 94dd803a4e
commit 9be9d922f2
3 changed files with 4 additions and 11 deletions

View File

@@ -103,7 +103,7 @@ public class Car extends BaseClass implements Comparable<Car>{
}
public Tag link(String tagClass) {
return link(tagClass, Map.of(REALM,REALM_CAR,ID,id,ACTION,ACTION_PROPS), name());
return link(tagClass, Map.of(REALM,REALM_CAR,ID,id,ACTION,ACTION_PROPS), name()+(stockId.isEmpty()?"":" "+t("(id: {}, length: {})",stockId,length)));
}
static Vector<Car> list() {
@@ -143,11 +143,7 @@ public class Car extends BaseClass implements Comparable<Car>{
new Tag("h4").content(t("known cars")).addTo(win);
Tag list = new Tag("ul");
for (Car car : new TreeSet<Car>(cars.values())) {
if (!(car instanceof Locomotive)) {
Tag tag = car.link("li");
if (isSet(car.stockId) && !car.stockId.isEmpty()) tag.content(NBSP+t("(id: {}, length: {})",car.stockId,car.length));
tag.addTo(list);
}
if (!(car instanceof Locomotive)) car.link("li").addTo(list);
}
list.addTo(win);

View File

@@ -209,10 +209,7 @@ public class Locomotive extends Car implements Constants,Device{
for (Car car : new TreeSet<Car>(cars.values())) {
if (car instanceof Locomotive) {
Locomotive loco = (Locomotive) car;
Tag tag = loco.link("li");
if (isSet(loco.stockId) && !loco.stockId.isEmpty()) tag.content(NBSP+t("(id: {}, length: {})",loco.stockId,loco.length));
tag.addTo(list);
loco.link("li").addTo(list);
}
}
list.addTo(win);