BlockFree now using new assignment function
This commit is contained in:
2
pom.xml
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>1.3.22</version>
|
<version>1.3.23</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>
|
||||||
|
|||||||
@@ -54,17 +54,18 @@ BrakeStop : Bremsvorgang abschließen
|
|||||||
Brake time¹, forward : Bremszeit¹, vorwärts
|
Brake time¹, forward : Bremszeit¹, vorwärts
|
||||||
Brake time¹, reverse : Bremszeit¹, rückwärts
|
Brake time¹, reverse : Bremszeit¹, rückwärts
|
||||||
Brake time table : Bremszeit-Tabelle
|
Brake time table : Bremszeit-Tabelle
|
||||||
CarInTrain : Wagen im Zug
|
CarInTrain : Fahrzeug im Zug
|
||||||
Car manager : Waggon-Verwaltung
|
Car manager : Waggon-Verwaltung
|
||||||
CarOrientation : Wagen-Laufrichtung
|
CarOrientation : Wagen-Laufrichtung
|
||||||
Cars : Waggons
|
Cars : Waggons
|
||||||
cars : Fahrzeugen teilen
|
cars : Fahrzeugen teilen
|
||||||
|
Clicked tile is not a block! : Angeklickte Kachel ist kein Block!
|
||||||
Click here to add conditions : Hier klicken, um Bedingungen hinzuzufügen
|
Click here to add conditions : Hier klicken, um Bedingungen hinzuzufügen
|
||||||
Click here to select block! : Hier klicken, um Block auszuwählen!
|
Click here to select block! : Hier klicken, um Block auszuwählen!
|
||||||
Click here to select car! : Hier klicken, um Fahrzeug auszuwählen!
|
Click here to select car! : Hier klicken, um Fahrzeug auszuwählen!
|
||||||
Click here to select display! : Hier klicken, um Anzeige auszuwählen!
|
Click here to select display! : Hier klicken, um Anzeige auszuwählen!
|
||||||
Click here to select train! : Hier klicken, um Zug auszuwählen!
|
Click here to select train! : Hier klicken, um Zug auszuwählen!
|
||||||
click here to setup contact : Hier klicken, um Kontakt auszuwählen
|
Click here to setup contact : Hier klicken, um Kontakt auszuwählen
|
||||||
Click here to setup decoupler : Hier klicken, um Entkuppler einzurichten
|
Click here to setup decoupler : Hier klicken, um Entkuppler einzurichten
|
||||||
click here to setup relay : Hier klicken, um Relais einzurichten
|
click here to setup relay : Hier klicken, um Relais einzurichten
|
||||||
click here to setup signal : Hier klicken, um Signal einzurichten
|
click here to setup signal : Hier klicken, um Signal einzurichten
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package de.srsoftware.web4rail.conditions;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ import de.srsoftware.web4rail.BaseClass;
|
|||||||
import de.srsoftware.web4rail.Window;
|
import de.srsoftware.web4rail.Window;
|
||||||
import de.srsoftware.web4rail.tags.Fieldset;
|
import de.srsoftware.web4rail.tags.Fieldset;
|
||||||
import de.srsoftware.web4rail.tiles.Block;
|
import de.srsoftware.web4rail.tiles.Block;
|
||||||
|
import de.srsoftware.web4rail.tiles.Tile;
|
||||||
|
|
||||||
public class BlockFree extends Condition {
|
public class BlockFree extends Condition {
|
||||||
|
|
||||||
@@ -55,7 +57,7 @@ public class BlockFree extends Condition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||||
formInputs.add(t("Select block"), Block.selector(block, null));
|
formInputs.add(t("Block: {}",isNull(block) ? t("unset") : block),button(t("Select from plan"),Map.of(ACTION,ACTION_UPDATE,ASSIGN,BLOCK)));
|
||||||
return super.properties(preForm, formInputs, postForm);
|
return super.properties(preForm, formInputs, postForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,9 +78,14 @@ public class BlockFree extends Condition {
|
|||||||
protected Object update(HashMap<String, String> params) {
|
protected Object update(HashMap<String, String> params) {
|
||||||
if (!params.containsKey(BLOCK)) return t("No block id passed to BlockFree.update()!");
|
if (!params.containsKey(BLOCK)) return t("No block id passed to BlockFree.update()!");
|
||||||
Id bid = new Id(params.get(BLOCK));
|
Id bid = new Id(params.get(BLOCK));
|
||||||
Block block = Block.get(bid);
|
|
||||||
if (isNull(block)) return t("No block with id {} found!",bid);
|
Tile tile = plan.get(bid, true);
|
||||||
this.block = block;
|
if (tile instanceof Block) {
|
||||||
|
block = (Block) tile;
|
||||||
|
} else {
|
||||||
|
return t("Clicked tile is not a block!");
|
||||||
|
}
|
||||||
|
|
||||||
return super.update(params);
|
return super.update(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ public abstract class Condition extends BaseClass {
|
|||||||
case ACTION_PROPS:
|
case ACTION_PROPS:
|
||||||
return condition.properties();
|
return condition.properties();
|
||||||
case ACTION_UPDATE:
|
case ACTION_UPDATE:
|
||||||
condition.update(params);
|
return condition.update(params);
|
||||||
return condition.context().properties();
|
|
||||||
}
|
}
|
||||||
return t("Unknown action: {}",action);
|
return t("Unknown action: {}",action);
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,9 @@ public abstract class Condition extends BaseClass {
|
|||||||
ConditionList conditionList = BaseClass.get(parentId);
|
ConditionList conditionList = BaseClass.get(parentId);
|
||||||
if (isNull(conditionList)) return t("No condition list with id {} found!",parentId);
|
if (isNull(conditionList)) return t("No condition list with id {} found!",parentId);
|
||||||
|
|
||||||
return conditionList.add(Condition.create(type)).properties();
|
Condition condition = Condition.create(type);
|
||||||
|
conditionList.add(condition);
|
||||||
|
return condition.properties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Condition create(String type) {
|
public static Condition create(String type) {
|
||||||
@@ -165,6 +166,7 @@ public abstract class Condition extends BaseClass {
|
|||||||
|
|
||||||
protected Object update(HashMap<String, String> params) {
|
protected Object update(HashMap<String, String> params) {
|
||||||
inverted = "on".equals(params.get(INVERTED));
|
inverted = "on".equals(params.get(INVERTED));
|
||||||
return super.update(params);
|
super.update(params);
|
||||||
|
return context().properties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user