usability improvements
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.5.32</version>
|
<version>1.5.33</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>
|
||||||
|
|||||||
@@ -463,8 +463,10 @@ train has tag "{}" : Zug hat Markierung „{}“
|
|||||||
TrainHasTag : Zug hat Markierung
|
TrainHasTag : Zug hat Markierung
|
||||||
train is a push-pull train : Zug ist ein Wendezug
|
train is a push-pull train : Zug ist ein Wendezug
|
||||||
train is faster than {} {} : Zug ist schneller als {} {}
|
train is faster than {} {} : Zug ist schneller als {} {}
|
||||||
|
Train is in "{}" : Zug ist in „{}“
|
||||||
train is longer than {} {} : Zug ist länger als {} {}
|
train is longer than {} {} : Zug ist länger als {} {}
|
||||||
train is not a push-pull train : Zug ist kein Wendezug
|
train is not a push-pull train : Zug ist kein Wendezug
|
||||||
|
Train is not in "{}" : Zug ist nicht in „{}“
|
||||||
train is not shunting : Zug rangiert nicht
|
train is not shunting : Zug rangiert nicht
|
||||||
train is shorter than {} {} : Zug ist kürzer als {} {}
|
train is shorter than {} {} : Zug ist kürzer als {} {}
|
||||||
TrainIsShunting : Rangierfahrt
|
TrainIsShunting : Rangierfahrt
|
||||||
|
|||||||
@@ -377,6 +377,7 @@ public abstract class BaseClass implements Constants{
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T extends BaseClass> T get(Id id) {
|
public static <T extends BaseClass> T get(Id id) {
|
||||||
|
if (isNull(id)) return null;
|
||||||
return (T) registry.get(id);
|
return (T) registry.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class ActionList extends Action implements Iterable<Action>{
|
|||||||
Action action = Action.create(type,this);
|
Action action = Action.create(type,this);
|
||||||
if (action instanceof Action) {
|
if (action instanceof Action) {
|
||||||
add(action);
|
add(action);
|
||||||
return context().properties();
|
return action.properties();
|
||||||
}
|
}
|
||||||
return new Tag("span").content(t("Unknown action type: {}",type)).addTo(actionTypeForm());
|
return new Tag("span").content(t("Unknown action type: {}",type)).addTo(actionTypeForm());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,13 +83,14 @@ public class DetermineTrainInBlock extends Action {
|
|||||||
@Override
|
@Override
|
||||||
protected Object update(Params params) {
|
protected Object update(Params params) {
|
||||||
LOG.debug("update: {}",params);
|
LOG.debug("update: {}",params);
|
||||||
|
parked = ("on".equals(params.get(PARKED_TRAIN)));
|
||||||
if (params.containsKey(BLOCK)) {
|
if (params.containsKey(BLOCK)) {
|
||||||
Tile tile = plan.get(new Id(params.getString(BLOCK)), true);
|
Tile tile = plan.get(new Id(params.getString(BLOCK)), true);
|
||||||
if (tile instanceof Block) {
|
if (tile instanceof Block) {
|
||||||
block = (Block) tile;
|
block = (Block) tile;
|
||||||
|
return properties();
|
||||||
} else return t("Clicked tile is not a {}!",t("block"));
|
} else return t("Clicked tile is not a {}!",t("block"));
|
||||||
}
|
}
|
||||||
parked = ("on".equals(params.get(PARKED_TRAIN)));
|
|
||||||
return context().properties();
|
return context().properties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.json.JSONObject;
|
|||||||
|
|
||||||
import de.srsoftware.tools.Tag;
|
import de.srsoftware.tools.Tag;
|
||||||
import de.srsoftware.web4rail.BaseClass;
|
import de.srsoftware.web4rail.BaseClass;
|
||||||
|
import de.srsoftware.web4rail.LoadCallback;
|
||||||
import de.srsoftware.web4rail.Params;
|
import de.srsoftware.web4rail.Params;
|
||||||
import de.srsoftware.web4rail.moving.Train;
|
import de.srsoftware.web4rail.moving.Train;
|
||||||
import de.srsoftware.web4rail.tags.Fieldset;
|
import de.srsoftware.web4rail.tags.Fieldset;
|
||||||
@@ -31,7 +32,8 @@ public class TrainWasInBlock extends Condition {
|
|||||||
@Override
|
@Override
|
||||||
public boolean fulfilledBy(Context context) {
|
public boolean fulfilledBy(Context context) {
|
||||||
Train train = context.train();
|
Train train = context.train();
|
||||||
if (isNull(train)) return false;
|
if (isNull(train)) return false;
|
||||||
|
if (count == 0) return (train.currentBlock() == block) != inverted;
|
||||||
return train.lastBlocks(count).contains(block) != inverted;
|
return train.lastBlocks(count).contains(block) != inverted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,8 +44,14 @@ public class TrainWasInBlock extends Condition {
|
|||||||
|
|
||||||
public Condition load(JSONObject json) {
|
public Condition load(JSONObject json) {
|
||||||
super.load(json);
|
super.load(json);
|
||||||
if (json.has(BLOCK)) block(Block.get(new Id(json.getString(BLOCK))));
|
|
||||||
if (json.has(COUNT)) count = json.getInt(COUNT);
|
if (json.has(COUNT)) count = json.getInt(COUNT);
|
||||||
|
new LoadCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterLoad() {
|
||||||
|
if (json.has(BLOCK)) block(Block.get(Id.from(json, BLOCK)));
|
||||||
|
}
|
||||||
|
};
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,18 +71,22 @@ public class TrainWasInBlock extends Condition {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (block == null) return "["+t("Click here to select block!")+"]";
|
if (block == null) return "["+t("Click here to select block!")+"]";
|
||||||
|
if (count == 0) return t(inverted ? "Train is not in \"{}\"" : "Train is in \"{}\"", block);
|
||||||
return t(inverted ? "{} not within last {} blocks of train":"{} within last {} blocks of train",block,count);
|
return t(inverted ? "{} not within last {} blocks of train":"{} within last {} blocks of train",block,count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object update(Params params) {
|
protected Object update(Params params) {
|
||||||
if (!params.containsKey(BLOCK)) return t("No block id passed to TrainWasInBlock.update()!");
|
Id bid = Id.from(params, BLOCK);
|
||||||
Id bid = new Id(params.getString(BLOCK));
|
|
||||||
Tile tile = BaseClass.get(bid);
|
Tile tile = BaseClass.get(bid);
|
||||||
if (tile instanceof Shadow) tile = ((Shadow)tile).overlay();
|
if (tile instanceof Shadow) tile = ((Shadow)tile).overlay();
|
||||||
if (tile instanceof Block) block = (Block) tile;
|
|
||||||
if (params.containsKey(COUNT)) count=params.getInt(COUNT);
|
if (params.containsKey(COUNT)) count=params.getInt(COUNT);
|
||||||
|
if (tile instanceof Block) {
|
||||||
|
block = (Block) tile;
|
||||||
|
super.update(params);
|
||||||
|
return properties();
|
||||||
|
}
|
||||||
return super.update(params);
|
return super.update(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user