added device table

This commit is contained in:
Stephan Richter
2020-11-29 20:23:12 +01:00
parent 1df8bfb822
commit e61891da43
8 changed files with 51 additions and 1 deletions

View File

@@ -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>1.1.8</version> <version>1.1.9</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>

View File

@@ -288,6 +288,7 @@ fieldset.notes textarea{
min-width: 100%; min-width: 100%;
} }
table.turnouts,
table.brake-times{ table.brake-times{
border-collapse: collapse; border-collapse: collapse;
} }
@@ -302,4 +303,10 @@ table.brake-times tr > *{
table.brake-times th{ table.brake-times th{
border-width: 0 1px 1px; border-width: 0 1px 1px;
}
.turnouts .group > *{
border-color: black;
border-style: solid;
border-width: 1px 0 0;
} }

View File

@@ -14,6 +14,7 @@ add new car : neuen Waggon anlegen
add new locomotive : neue Lok anlegen add new locomotive : neue Lok anlegen
add new train : neuen Zug anlegen add new train : neuen Zug anlegen
Add tile : Kachel hinzufügen Add tile : Kachel hinzufügen
Address : Adresse
Address\: : Adresse: Address\: : Adresse:
Analyze : analysieren Analyze : analysieren
Apply : Übernehmen Apply : Übernehmen
@@ -70,6 +71,7 @@ Drop : Verwerfen
Dropped destination of {}. : Ziel von {} verworfen. Dropped destination of {}. : Ziel von {} verworfen.
1) Duration between 5 {} steps during brake process. : 1) Zeit zwischen 5 {}-Schritten beim Bremsvorgang. 1) Duration between 5 {} steps during brake process. : 1) Zeit zwischen 5 {}-Schritten beim Bremsvorgang.
EAST : Osten EAST : Osten
Editable properties : veränderliche Eigenschaften
editable train properties : veränderliche Zug-Eigenschaften editable train properties : veränderliche Zug-Eigenschaften
Emergency : Notfall Emergency : Notfall
Faster (10 {}) : 10 {} schneller Faster (10 {}) : 10 {} schneller
@@ -94,6 +96,7 @@ Length : Länge
length\: : Länge: length\: : Länge:
length\: {} : Länge: {} length\: {} : Länge: {}
Length unit : Längeneinheit Length unit : Längeneinheit
Locked by {} : Durch {} besetzt
Locomotive manager : Lok-Verwaltung Locomotive manager : Lok-Verwaltung
Locomotives\: : Lokomotiven: Locomotives\: : Lokomotiven:
Manage cars : Waggons verwalten Manage cars : Waggons verwalten
@@ -129,6 +132,7 @@ PushPullTrain : Wendezug
Push-pull train : Wendezug Push-pull train : Wendezug
quit autopilot : Autopilot beenden quit autopilot : Autopilot beenden
{} reached it`s destination! : {} ist am Ziel angekommen! {} reached it`s destination! : {} ist am Ziel angekommen!
Relay/Turnout : Relais/Weiche
Report Issue : Problem melden Report Issue : Problem melden
RIGHT : rechts RIGHT : rechts
Right port\: : Port für rechts Right port\: : Port für rechts
@@ -198,6 +202,11 @@ TriggerContact : Kontakt auslösen
Turn : Richtung wechseln Turn : Richtung wechseln
Turn allowed : Wenden erlaubt Turn allowed : Wenden erlaubt
{} turned. : {} gewendet. {} turned. : {} gewendet.
Turnout : Weiche
TurnoutLE : WeicheLE
TurnoutLW : WeicheLW
TurnoutRE : WeicheRE
TurnoutRW : WeicheRW
Turnouts : Weichen Turnouts : Weichen
TurnTrain : Fahrtrichtung umkehren TurnTrain : Fahrtrichtung umkehren
turn within train : innerhalb des Zugs drehen turn within train : innerhalb des Zugs drehen

View File

@@ -4,4 +4,6 @@ public interface Device {
public static final String ADDRESS = "address"; public static final String ADDRESS = "address";
public static final String PORT = "port"; public static final String PORT = "port";
public static final String PROTOCOL = "proto"; public static final String PROTOCOL = "proto";
public int address();
} }

View File

@@ -9,6 +9,7 @@ import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files; import java.nio.file.Files;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@@ -35,6 +36,7 @@ import de.srsoftware.web4rail.tags.Div;
import de.srsoftware.web4rail.tags.Form; import de.srsoftware.web4rail.tags.Form;
import de.srsoftware.web4rail.tags.Input; import de.srsoftware.web4rail.tags.Input;
import de.srsoftware.web4rail.tags.Label; import de.srsoftware.web4rail.tags.Label;
import de.srsoftware.web4rail.tags.Table;
import de.srsoftware.web4rail.tiles.Block; import de.srsoftware.web4rail.tiles.Block;
import de.srsoftware.web4rail.tiles.BlockH; import de.srsoftware.web4rail.tiles.BlockH;
import de.srsoftware.web4rail.tiles.BlockV; import de.srsoftware.web4rail.tiles.BlockV;
@@ -601,6 +603,8 @@ public class Plan extends BaseClass{
} }
Window win = new Window("plan-properties", t("Properties")); Window win = new Window("plan-properties", t("Properties"));
new Tag("h4").content(t("Editable properties")).addTo(win);
Form form = new Form("plan-properties-form"); Form form = new Form("plan-properties-form");
new Input(REALM,REALM_PLAN).hideIn(form); new Input(REALM,REALM_PLAN).hideIn(form);
new Input(ACTION,ACTION_UPDATE).hideIn(form); new Input(ACTION,ACTION_UPDATE).hideIn(form);
@@ -608,6 +612,21 @@ public class Plan extends BaseClass{
new Input(SPEED_UNIT, speedUnit).addTo(new Label(t("Speed unit")+":"+NBSP)).addTo(form); new Input(SPEED_UNIT, speedUnit).addTo(new Label(t("Speed unit")+":"+NBSP)).addTo(form);
new Button(t("Save"), form).addTo(form); new Button(t("Save"), form).addTo(form);
form.addTo(win); form.addTo(win);
new Tag("h4").content(t("turnout properties")).addTo(win);
Table table = new Table();
table.addHead(t("Address"),t("Relay/Turnout"));
tiles.values()
.stream()
.filter(tile -> tile instanceof Device )
.map(tile -> (Device) tile)
.sorted(Comparator.comparing(Device::address))
.forEach(turnout -> {
table.addRow(turnout.address(),turnout);
if (turnout.address() % 4 == 1) table.children().lastElement().clazz("group");
});
table.clazz("turnouts").addTo(win);
return win; return win;
} }

View File

@@ -76,6 +76,11 @@ public class Locomotive extends Car implements Constants,Device{
return t("Unknown action: {}",params.get(ACTION)); return t("Unknown action: {}",params.get(ACTION));
} }
@Override
public int address() {
return address;
}
public static Tag cockpit(Object locoOrTrain) { public static Tag cockpit(Object locoOrTrain) {
int id = 0; int id = 0;
int speed = 0; int speed = 0;

View File

@@ -44,6 +44,10 @@ public class Relay extends Tile implements Device{
private static final String LABEL_B = "label_b"; private static final String LABEL_B = "label_b";
private static final String NAME = "name"; private static final String NAME = "name";
public int address() {
return address;
}
@Override @Override
public Object click() throws IOException { public Object click() throws IOException {
Object o = super.click(); Object o = super.click();

View File

@@ -41,6 +41,10 @@ public abstract class Turnout extends Tile implements Device{
LEFT,STRAIGHT,RIGHT,UNDEF; LEFT,STRAIGHT,RIGHT,UNDEF;
} }
public int address() {
return address;
}
@Override @Override
public Object click() throws IOException { public Object click() throws IOException {
LOG.debug(getClass().getSimpleName()+".click()"); LOG.debug(getClass().getSimpleName()+".click()");