implemented AddDestination action and evaluation of destination tags of trains.
This commit is contained in:
@@ -77,9 +77,7 @@ public class BlockFree extends Condition {
|
||||
@Override
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
if (!params.containsKey(BLOCK)) return t("No block id passed to BlockFree.update()!");
|
||||
Id bid = new Id(params.get(BLOCK));
|
||||
|
||||
Tile tile = plan.get(bid, true);
|
||||
Tile tile = plan.get(new Id(params.get(BLOCK)), true);
|
||||
if (tile instanceof Block) {
|
||||
block = (Block) tile;
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@ package de.srsoftware.web4rail.conditions;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -11,6 +12,7 @@ import de.srsoftware.web4rail.Route;
|
||||
import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tiles.Block;
|
||||
import de.srsoftware.web4rail.tiles.Tile;
|
||||
|
||||
public class RouteEndBlock extends Condition{
|
||||
|
||||
@@ -58,7 +60,7 @@ public class RouteEndBlock extends Condition{
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -77,11 +79,12 @@ public class RouteEndBlock extends Condition{
|
||||
|
||||
@Override
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
if (!params.containsKey(BLOCK)) return t("No block id passed to RouteEndBlock.update()!");
|
||||
Id bid = new Id(params.get(BLOCK));
|
||||
Block block = Block.get(bid);
|
||||
if (block == null) return t("No block with id {} found!",bid);
|
||||
this.block = block;
|
||||
if (params.containsKey(BLOCK)) {
|
||||
Tile tile = plan.get(new Id(params.get(BLOCK)), true);
|
||||
if (tile instanceof Block) {
|
||||
block = (Block) tile;
|
||||
} else return t("Clicked tile is not a {}!",t("block"));
|
||||
}
|
||||
return super.update(params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user