Browse Source

minor improvements

lookup-tables
Stephan Richter 4 years ago
parent
commit
4969b32dd8
  1. 2
      pom.xml
  2. 6
      src/main/java/de/srsoftware/web4rail/moving/Locomotive.java
  3. 10
      src/main/java/de/srsoftware/web4rail/moving/Train.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>1.3.33</version>
<version>1.3.34</version>
<name>Web4Rail</name>
<packaging>jar</packaging>
<description>Java Model Railway Control</description>

6
src/main/java/de/srsoftware/web4rail/moving/Locomotive.java

@ -369,6 +369,7 @@ public class Locomotive extends Car implements Constants,Device{ @@ -369,6 +369,7 @@ public class Locomotive extends Car implements Constants,Device{
private Locomotive setAddress(int newAddress) {
address = newAddress;
cvs.put(CV_ADDR, newAddress);
init = false;
return this;
}
@ -464,10 +465,7 @@ public class Locomotive extends Car implements Constants,Device{ @@ -464,10 +465,7 @@ public class Locomotive extends Car implements Constants,Device{
if (params.containsKey(PROTOCOL)) proto = Protocol.valueOf(params.get(PROTOCOL));
if (params.containsKey(ADDRESS)) {
int newAddress = Integer.parseInt(params.get(ADDRESS));
if (newAddress != address) {
init = false;
setAddress(newAddress);
}
if (newAddress != address) setAddress(newAddress);
}
String error = null;
if (params.get(ACTION).equals(ACTION_PROGRAM)) try {

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

@ -310,7 +310,15 @@ public class Train extends BaseClass implements Comparable<Train> { @@ -310,7 +310,15 @@ public class Train extends BaseClass implements Comparable<Train> {
new Input(ACTION, ACTION_ADD).hideIn(addCarForm);
new Input(ID,id).hideIn(addCarForm);
Select select = new Select(CAR_ID);
for (Car car : cars) select.addOption(car.id(), car+(car.stockId.isEmpty()?"":" ("+car.stockId+")"));
for (Car car : cars) {
String caption = null;
if (!car.stockId.isEmpty()) caption = car.stockId;
if (!car.tags().isEmpty()) caption = (isSet(caption) ? caption+" / " :"") + String.join(" ",car.tags());
caption = car.toString() + (isNull(caption) ? "" : " ("+caption+")");
select.addOption(car.id(), caption);
}
select.addTo(addCarForm);
new Button(t("add"),addCarForm).addTo(addCarForm);
carList.addRow(t("add car"),addCarForm);

Loading…
Cancel
Save