improved gui
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.srsoftware</groupId>
|
||||
<artifactId>web4rail</artifactId>
|
||||
<version>1.3.48</version>
|
||||
<version>1.3.49</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -15,13 +15,13 @@ add action : Aktion hinzufügen
|
||||
Add action to action list : Aktion zur Liste hinzufügen
|
||||
add car : Waggon hinzufügen
|
||||
Add condition : Bedingung hinzufügen
|
||||
AddDestination : Ziel hinzufügen
|
||||
add locomotive : Lok hinzufügen
|
||||
add new aspect : neues Signalbild hinzufügen
|
||||
add new car : neuen Waggon anlegen
|
||||
Add new custom field : neues benutzerdefiniertes Feld hinzufügen
|
||||
add new locomotive : neue Lok anlegen
|
||||
add new train : neuen Zug anlegen
|
||||
AddRemoveDestination : Ziel hinzufügen/löschen
|
||||
AddRemoveTag : Markierung hinzufügen/entfernen
|
||||
Address : Adresse
|
||||
Add tag "{}" to train : Markierung "{}" zu Zug hinzufügen
|
||||
@@ -87,6 +87,7 @@ click here to setup turnout : Hier klicken, um Weiche einzurichten
|
||||
Click on a name to edit the entry. : Klicke auf einen Namen, um einen Eintrag zu bearbeiten.
|
||||
Command to send : Kommando, welches gesendet werden soll
|
||||
ConditionalAction : bedingte Aktion
|
||||
Condition : Bedingung
|
||||
Conditions : Bedingungen
|
||||
Condition type : Bedingungs-Typ
|
||||
Connected to {}. : Mit {} verbunden.
|
||||
@@ -345,6 +346,7 @@ SwitchIsOn : Schalter is an
|
||||
Switch power off : Strom ausschalten
|
||||
Switch power on : Strom anschalten
|
||||
SYSTEM : Betriebssystem
|
||||
Tag : Markierung
|
||||
Tags : Markierungen
|
||||
Text to display on clients : Text, welcher auf den Clients angezeigt werden soll
|
||||
Text to show on display : Text, welcher in der Anzeige dargestellt werden soll
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class Action extends BaseClass {
|
||||
|
||||
public static List<Class<? extends Action>> classes() {
|
||||
return List.of(
|
||||
AddDestination.class,
|
||||
AddRemoveDestination.class,
|
||||
AddRemoveTag.class,
|
||||
AlterDirection.class,
|
||||
BrakeStart.class,
|
||||
|
||||
@@ -151,7 +151,8 @@ public class ActionList extends Action implements Iterable<Action>{
|
||||
for (Object o : list) {
|
||||
if (o instanceof JSONObject) {
|
||||
JSONObject jsonObject = (JSONObject) o;
|
||||
Action action = Action.create(jsonObject.getString(TYPE),this);
|
||||
String type = mapOldTypes(jsonObject.getString(TYPE));
|
||||
Action action = Action.create(type,this);
|
||||
if (isSet(action)) add(action.load(jsonObject));
|
||||
}
|
||||
}
|
||||
@@ -159,6 +160,15 @@ public class ActionList extends Action implements Iterable<Action>{
|
||||
return this;
|
||||
}
|
||||
|
||||
private String mapOldTypes(String type) {
|
||||
switch (type) {
|
||||
case "AddDestination":
|
||||
return AddRemoveDestination.class.getSimpleName();
|
||||
default:
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
public void merge(ActionList oldActions) {
|
||||
for (Action oldAction : oldActions.actions) {
|
||||
for (Action newAction : actions) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import de.srsoftware.web4rail.tags.Window;
|
||||
import de.srsoftware.web4rail.tiles.Block;
|
||||
import de.srsoftware.web4rail.tiles.Tile;
|
||||
|
||||
public class AddDestination extends Action {
|
||||
public class AddRemoveDestination extends Action {
|
||||
|
||||
private static final String TURN = "turn";
|
||||
private static final String SHUNTING = "shunting";
|
||||
@@ -25,7 +25,7 @@ public class AddDestination extends Action {
|
||||
private boolean turnAtDestination;
|
||||
private boolean shunting;
|
||||
|
||||
public AddDestination(BaseClass parent) {
|
||||
public AddRemoveDestination(BaseClass parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,10 @@ public class AddDestination extends Action {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return isSet(destination) ? t("Add {} to destinations of train",destination) : t("Clear destinations of train");
|
||||
if (isNull(destination)) return t("Clear destinations of train");
|
||||
String suffix = turnAtDestination ? t("Turn") : null;
|
||||
if (shunting) suffix = (isSet(suffix) ? suffix+" + " : "")+t("Shunting");
|
||||
return t("Add {} to destinations of train",destination)+(isSet(suffix) ? " ("+suffix+")" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.BaseClass;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Input;
|
||||
@@ -47,7 +48,7 @@ public class SetSpeed extends Action{
|
||||
|
||||
@Override
|
||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||
formInputs.add(t("Set speed to"),new Input(MAX_SPEED, speed).numeric());
|
||||
formInputs.add(t("Set speed to"),new Input(MAX_SPEED, speed).numeric().addTo(new Tag("span")).content(NBSP+speedUnit));
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@ import java.util.List;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.BaseClass;
|
||||
import de.srsoftware.web4rail.tags.Checkbox;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Radio;
|
||||
import de.srsoftware.web4rail.tags.Window;
|
||||
|
||||
public class StartStopAuto extends Action {
|
||||
@@ -41,7 +42,11 @@ public class StartStopAuto extends Action {
|
||||
|
||||
@Override
|
||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||
formInputs.add(t("inverted"),new Checkbox(INVERTED, t("inverted"), inverted));
|
||||
Tag radios = new Tag("div");
|
||||
new Radio(INVERTED, "on", t("Start autopilot"), inverted).addTo(radios);
|
||||
new Radio(INVERTED, "off", t("Stop autopilot"), !inverted).addTo(radios);
|
||||
formInputs.add(t("Action"), radios);
|
||||
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import de.srsoftware.web4rail.tags.Window;
|
||||
|
||||
public abstract class Condition extends BaseClass {
|
||||
public static final Logger LOG = LoggerFactory.getLogger(Condition.class);
|
||||
private static final String INVERTED = "inverted";
|
||||
protected static final String INVERTED = "inverted";
|
||||
private static final String PREFIX = Condition.class.getPackageName();
|
||||
public boolean inverted = false;
|
||||
|
||||
@@ -93,6 +93,10 @@ public abstract class Condition extends BaseClass {
|
||||
|
||||
public abstract boolean fulfilledBy(Context context);
|
||||
|
||||
public void inversionOption(FormInput formInputs) {
|
||||
formInputs.add(t("inverted"),new Checkbox(INVERTED, t("inverted"), inverted));
|
||||
}
|
||||
|
||||
public JSONObject json() {
|
||||
JSONObject json = new JSONObject().put(TYPE, getClass().getSimpleName());
|
||||
if (inverted) json.put(INVERTED, true);
|
||||
@@ -139,7 +143,7 @@ public abstract class Condition extends BaseClass {
|
||||
|
||||
@Override
|
||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||
formInputs.add(t("inverted"),new Checkbox(INVERTED, t("inverted"), inverted));
|
||||
inversionOption(formInputs);
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,11 @@ import java.util.Map;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.BaseClass;
|
||||
import de.srsoftware.web4rail.DelayedExecution;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Radio;
|
||||
import de.srsoftware.web4rail.tags.Window;
|
||||
import de.srsoftware.web4rail.tiles.Switch;
|
||||
import de.srsoftware.web4rail.tiles.Tile;
|
||||
@@ -25,6 +27,14 @@ public class SwitchIsOn extends Condition {
|
||||
if (isSet(swtch)) return swtch.isOn() != inverted;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inversionOption(FormInput formInputs) {
|
||||
Tag radios = new Tag("div");
|
||||
new Radio(INVERTED, "off", t("{} is on",swtch), !inverted).addTo(radios);
|
||||
new Radio(INVERTED, "on", t("{} is off",swtch), inverted).addTo(radios);
|
||||
formInputs.add(t("Condition"), radios);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
|
||||
@@ -5,9 +5,11 @@ import java.util.List;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.moving.Train;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Input;
|
||||
import de.srsoftware.web4rail.tags.Radio;
|
||||
import de.srsoftware.web4rail.tags.Window;
|
||||
|
||||
public class TrainHasTag extends Condition {
|
||||
@@ -24,6 +26,14 @@ public class TrainHasTag extends Condition {
|
||||
return train.tags().contains(tag) != inverted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inversionOption(FormInput formInputs) {
|
||||
Tag radios = new Tag("div");
|
||||
new Radio(INVERTED, "off", t("Markieung muss vorhanden sein"), !inverted).addTo(radios);
|
||||
new Radio(INVERTED, "on", t("Markieung darf nicht vorhanden sein"), inverted).addTo(radios);
|
||||
formInputs.add(t("Condition"), radios);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
return super.json().put(TAG, tag);
|
||||
|
||||
Reference in New Issue
Block a user