minor improvements

This commit is contained in:
Stephan Richter
2021-01-28 17:49:59 +01:00
parent a55265c6db
commit 4969b32dd8
3 changed files with 12 additions and 6 deletions

View File

@@ -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>

View File

@@ -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{
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 {

View File

@@ -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);