Browse Source

UI work

lookup-tables
Stephan Richter 5 years ago
parent
commit
d12ddf66ad
  1. 2
      pom.xml
  2. 1
      resources/translations/Application.de.translation
  3. 29
      src/main/java/de/srsoftware/web4rail/moving/Train.java
  4. 8
      src/main/java/de/srsoftware/web4rail/tiles/Tile.java

2
pom.xml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId>
<version>0.11.7</version>
<version>0.11.8</version>
<name>Web4Rail</name>
<packaging>jar</packaging>
<description>Java Model Railway Control</description>

1
resources/translations/Application.de.translation

@ -83,6 +83,7 @@ Properties of {} : Eigenschaften von {} @@ -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

29
src/main/java/de/srsoftware/web4rail/moving/Train.java

@ -245,6 +245,10 @@ public class Train extends BaseClass implements Comparable<Train> { @@ -245,6 +245,10 @@ public class Train extends BaseClass implements Comparable<Train> {
return train;
}
public Block currentBlock() {
return currentBlock;
}
public Block destination() {
return destination;
}
@ -468,8 +472,13 @@ public class Train extends BaseClass implements Comparable<Train> { @@ -468,8 +472,13 @@ public class Train extends BaseClass implements Comparable<Train> {
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);
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<Train> { @@ -521,6 +530,10 @@ public class Train extends BaseClass implements Comparable<Train> {
} 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<Train> { @@ -572,6 +585,10 @@ public class Train extends BaseClass implements Comparable<Train> {
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;
@ -663,15 +680,7 @@ public class Train extends BaseClass implements Comparable<Train> { @@ -663,15 +680,7 @@ public class Train extends BaseClass implements Comparable<Train> {
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);
}
}

8
src/main/java/de/srsoftware/web4rail/tiles/Tile.java

@ -223,6 +223,14 @@ public abstract class Tile extends BaseClass{ @@ -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);
}

Loading…
Cancel
Save