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. 35
      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 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId> <groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId> <artifactId>web4rail</artifactId>
<version>0.11.7</version> <version>0.11.8</version>
<name>Web4Rail</name> <name>Web4Rail</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<description>Java Model Railway Control</description> <description>Java Model Railway Control</description>

1
resources/translations/Application.de.translation

@ -83,6 +83,7 @@ Properties of {} : Eigenschaften von {}
Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{}) Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{})
PushPullTrain : Wendezug PushPullTrain : Wendezug
Push-pull train : Wendezug Push-pull train : Wendezug
quit autopilot : Autopilot beenden
{} reached it`s destination! : {} ist am Ziel angekommen! {} reached it`s destination! : {} ist am Ziel angekommen!
Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren
Report Issue : Problem melden Report Issue : Problem melden

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

@ -245,6 +245,10 @@ public class Train extends BaseClass implements Comparable<Train> {
return train; return train;
} }
public Block currentBlock() {
return currentBlock;
}
public Block destination() { public Block destination() {
return destination; return destination;
} }
@ -468,8 +472,13 @@ public class Train extends BaseClass implements Comparable<Train> {
if (isSet(currentBlock)) { if (isSet(currentBlock)) {
link("li",Map.of(REALM,REALM_PLAN,ID,currentBlock.id(),ACTION,ACTION_CLICK),t("Current location: {}",currentBlock)).addTo(propList); 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); Tag actions = new Tag("li").clazz().content(t("Actions:")+NBSP);
props.put(ACTION, ACTION_START); if (isSet(route)) {
new Button(t("start"),props).addTo(actions); 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)) { if (isNull(autopilot)) {
props.put(ACTION, ACTION_AUTO); props.put(ACTION, ACTION_AUTO);
new Button(t("auto"),props).addTo(actions); new Button(t("auto"),props).addTo(actions);
@ -521,6 +530,10 @@ public class Train extends BaseClass implements Comparable<Train> {
} else return t("autopilot not active."); } else return t("autopilot not active.");
} }
public void removeFromTrace(Tile tile) {
trace.remove(tile);
}
private void reverseTrace() { private void reverseTrace() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@ -572,6 +585,10 @@ public class Train extends BaseClass implements Comparable<Train> {
this.speed = v; this.speed = v;
} }
public void setWaitTime(Range waitTime) {
if (autopilot != null) autopilot.waitTime = waitTime.random();
}
public void showTrace() { public void showTrace() {
int remainingLength = length(); int remainingLength = length();
if (remainingLength<1) remainingLength=1; if (remainingLength<1) remainingLength=1;
@ -662,16 +679,8 @@ public class Train extends BaseClass implements Comparable<Train> {
return this; return this;
} }
public void removeFromTrace(Tile tile) { public boolean usesAutopilot() {
trace.remove(tile); return isSet(autopilot);
}
public void setWaitTime(Range waitTime) {
if (autopilot != null) autopilot.waitTime = waitTime.random();
}
public Block currentBlock() {
return currentBlock;
} }
} }

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

@ -223,6 +223,14 @@ public abstract class Tile extends BaseClass{
props.put(ACTION, ACTION_START); props.put(ACTION, ACTION_START);
window.children().insertElementAt(new Button(t("start"),props), 1); 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(train.link("span"), 1);
window.children().insertElementAt(new Tag("h4").content(t("Train:")), 1); window.children().insertElementAt(new Tag("h4").content(t("Train:")), 1);
} }

Loading…
Cancel
Save