implementing train actions
This commit is contained in:
@@ -42,6 +42,18 @@ public abstract class Block extends StretchableTile{
|
||||
return form;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag propMenu() {
|
||||
Tag window = super.propMenu();
|
||||
|
||||
if (train != null) {
|
||||
new Tag("h4").content(t("Train:")).addTo(window);
|
||||
new Tag("span").clazz("link").attr("onclick","train("+x+","+y+",'show')").content(train.name()).addTo(window);
|
||||
new Tag("span").clazz("link").attr("onclick","train("+x+","+y+",'start')").content(" - "+t("start")).addTo(window);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag tag(Map<String, Object> replacements) throws IOException {
|
||||
if (replacements == null) replacements = new HashMap<String, Object>();
|
||||
@@ -64,4 +76,8 @@ public abstract class Block extends StretchableTile{
|
||||
public void setTrain(Train train) {
|
||||
this.train = train;
|
||||
}
|
||||
|
||||
public Train train() {
|
||||
return train;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,29 +70,29 @@ public abstract class Tile {
|
||||
new Tag("input").attr("type", "hidden").attr("name","action").attr("value", "update").addTo(form);
|
||||
new Tag("input").attr("type", "hidden").attr("name","x").attr("value", x).addTo(form);
|
||||
new Tag("input").attr("type", "hidden").attr("name","y").attr("value", y).addTo(form);
|
||||
|
||||
if (!routes.isEmpty()) {
|
||||
new Tag("h4").content(t("Routes using this tile:")).addTo(form);
|
||||
Tag routeList = new Tag("ul");
|
||||
for (Route route : routes) {
|
||||
new Tag("li").clazz("link").attr("onclick","openRoute('"+route.id()+"')").content(route.name()).addTo(routeList);
|
||||
}
|
||||
routeList.addTo(form);
|
||||
}
|
||||
|
||||
return form;
|
||||
}
|
||||
|
||||
public Tag propMenu() {
|
||||
Window menu = new Window("tile-properties",t("Properties of {} @ ({},{})",getClass().getSimpleName(),x,y));
|
||||
Window window = new Window("tile-properties",t("Properties of {} @ ({},{})",getClass().getSimpleName(),x,y));
|
||||
Tag form = propForm();
|
||||
if (form!=null) {
|
||||
if (form!=null && form.children().size()>3) {
|
||||
new Tag("button").attr("type", "submit").content(t("save")).addTo(form);
|
||||
form.addTo(menu);
|
||||
form.addTo(window);
|
||||
} else {
|
||||
menu.content(t("This tile ({}) has no properties",getClass().getSimpleName()));
|
||||
window.content(t("This tile ({}) has no properties",getClass().getSimpleName()));
|
||||
}
|
||||
return menu;
|
||||
|
||||
if (!routes.isEmpty()) {
|
||||
new Tag("h4").content(t("Routes using this tile:")).addTo(window);
|
||||
Tag routeList = new Tag("ul");
|
||||
for (Route route : routes) {
|
||||
new Tag("li").clazz("link").attr("onclick","openRoute('"+route.id()+"')").content(route.name()).addTo(routeList);
|
||||
}
|
||||
routeList.addTo(window);
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
public Tag tag(Map<String,Object> replacements) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user