diff --git a/pom.xml b/pom.xml index 7ea7045..7ebf240 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 de.srsoftware web4rail - 0.11.7 + 0.11.8 Web4Rail jar Java Model Railway Control diff --git a/resources/translations/Application.de.translation b/resources/translations/Application.de.translation index 2b699b9..fb9da9d 100644 --- a/resources/translations/Application.de.translation +++ b/resources/translations/Application.de.translation @@ -83,6 +83,7 @@ Properties of {} : Eigenschaften von {} Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{}) PushPullTrain : Wendezug Push-pull train : Wendezug +quit autopilot : Autopilot beenden {} reached it`s destination! : {} ist am Ziel angekommen! Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren Report Issue : Problem melden diff --git a/src/main/java/de/srsoftware/web4rail/moving/Train.java b/src/main/java/de/srsoftware/web4rail/moving/Train.java index 7c9af38..13968ce 100644 --- a/src/main/java/de/srsoftware/web4rail/moving/Train.java +++ b/src/main/java/de/srsoftware/web4rail/moving/Train.java @@ -245,6 +245,10 @@ public class Train extends BaseClass implements Comparable { return train; } + public Block currentBlock() { + return currentBlock; + } + public Block destination() { return destination; } @@ -468,8 +472,13 @@ public class Train extends BaseClass implements Comparable { if (isSet(currentBlock)) { link("li",Map.of(REALM,REALM_PLAN,ID,currentBlock.id(),ACTION,ACTION_CLICK),t("Current location: {}",currentBlock)).addTo(propList); Tag actions = new Tag("li").clazz().content(t("Actions:")+NBSP); - props.put(ACTION, ACTION_START); - new Button(t("start"),props).addTo(actions); + if (isSet(route)) { + props.put(ACTION, ACTION_STOP); + new Button(t("stop"),props).addTo(actions); + } else { + props.put(ACTION, ACTION_START); + new Button(t("start"),props).addTo(actions); + } if (isNull(autopilot)) { props.put(ACTION, ACTION_AUTO); new Button(t("auto"),props).addTo(actions); @@ -521,6 +530,10 @@ public class Train extends BaseClass implements Comparable { } else return t("autopilot not active."); } + public void removeFromTrace(Tile tile) { + trace.remove(tile); + } + private void reverseTrace() { // TODO Auto-generated method stub } @@ -572,6 +585,10 @@ public class Train extends BaseClass implements Comparable { this.speed = v; } + public void setWaitTime(Range waitTime) { + if (autopilot != null) autopilot.waitTime = waitTime.random(); + } + public void showTrace() { int remainingLength = length(); if (remainingLength<1) remainingLength=1; @@ -662,16 +679,8 @@ public class Train extends BaseClass implements Comparable { return this; } - - public void removeFromTrace(Tile tile) { - trace.remove(tile); - } - - public void setWaitTime(Range waitTime) { - if (autopilot != null) autopilot.waitTime = waitTime.random(); - } - - public Block currentBlock() { - return currentBlock; + + public boolean usesAutopilot() { + return isSet(autopilot); } } diff --git a/src/main/java/de/srsoftware/web4rail/tiles/Tile.java b/src/main/java/de/srsoftware/web4rail/tiles/Tile.java index 4c45704..a55e706 100644 --- a/src/main/java/de/srsoftware/web4rail/tiles/Tile.java +++ b/src/main/java/de/srsoftware/web4rail/tiles/Tile.java @@ -223,6 +223,14 @@ public abstract class Tile extends BaseClass{ props.put(ACTION, ACTION_START); window.children().insertElementAt(new Button(t("start"),props), 1); } + if (train.usesAutopilot()) { + props.put(ACTION, ACTION_QUIT); + window.children().insertElementAt(new Button(t("quit autopilot"),props),2); + } else { + props.put(ACTION, ACTION_AUTO); + window.children().insertElementAt(new Button(t("auto"),props),2); + } + window.children().insertElementAt(train.link("span"), 1); window.children().insertElementAt(new Tag("h4").content(t("Train:")), 1); }