minor changes
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>0.10.9</version>
|
||||
<version>0.10.10</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -105,7 +105,7 @@ train is shorter than {} : Zug ist kürzer als {}
|
||||
Trains : Züge
|
||||
Trains\: : Züge:
|
||||
TrainHasTag : Zug mit Tag
|
||||
TrainLength : Zuglänge
|
||||
TrainLength : Zug-Länge
|
||||
TrainSelect : Zug-Auswahl
|
||||
Trigger {} : {} betätigen
|
||||
TriggerContact : Kontakt auslösen
|
||||
|
||||
@@ -671,7 +671,7 @@ public class Plan extends BaseClass{
|
||||
|
||||
public void sensor(int addr, boolean active) {
|
||||
Contact contact = Contact.get(addr);
|
||||
LOG.debug("contact: {}",contact);
|
||||
LOG.debug("contact: {}",isSet(contact) ? contact : addr);
|
||||
if (contact != null) {
|
||||
contact.activate(active);
|
||||
} else {
|
||||
|
||||
@@ -646,7 +646,7 @@ public class Route extends BaseClass{
|
||||
trace.add(t);
|
||||
if (t == tile) break;
|
||||
}
|
||||
train.addToTrace(trace);
|
||||
if (isSet(train)) train.addToTrace(trace);
|
||||
}
|
||||
|
||||
public boolean train(Train newTrain) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ActionList extends Vector<Action> implements Constants{
|
||||
|
||||
public void addActionsFrom(ActionList other) {
|
||||
for (Action otherAction : other) {
|
||||
LOG.debug("old action: {}",otherAction);
|
||||
//LOG.debug("old action ({}): {}",otherAction.getClass().getSimpleName(),otherAction);
|
||||
boolean exists = false;
|
||||
int len = this.size();
|
||||
for (int i=0; i<len; i++) {
|
||||
@@ -234,4 +234,4 @@ public class ActionList extends Vector<Action> implements Constants{
|
||||
}
|
||||
return t("No action with id {} found.",actionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,15 @@ public class ConditionalAction extends Action {
|
||||
return actions;
|
||||
}
|
||||
|
||||
private StringBuffer conditions() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i<conditions.size(); i++) {
|
||||
if (i>0) sb.append(t(" or "));
|
||||
sb.append(conditions.get(i).toString());
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
private Tag conditionForm(HashMap<String, String> params) {
|
||||
Fieldset fieldset = new Fieldset(t("Conditions"));
|
||||
|
||||
@@ -53,6 +62,10 @@ public class ConditionalAction extends Action {
|
||||
Condition.selector().addTo(form);
|
||||
return new Button(t("Add condition"),form).addTo(form).addTo(fieldset);
|
||||
}
|
||||
|
||||
public boolean equals(ConditionalAction other) {
|
||||
return (conditions()+":"+actions).equals(other.conditions()+":"+other.actions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fire(Context context) throws IOException {
|
||||
@@ -97,12 +110,7 @@ public class ConditionalAction extends Action {
|
||||
@Override
|
||||
public String toString() {
|
||||
if (conditions.isEmpty()) return t("[Click here to add condition]");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i<conditions.size(); i++) {
|
||||
if (i>0) sb.append(t(" or "));
|
||||
sb.append(conditions.get(i).toString());
|
||||
}
|
||||
return t("if ({}): {}",sb,actions);
|
||||
return t("if ({}):",conditions());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,6 +44,10 @@ public class DelayedAction extends Action {
|
||||
new Input(DELAY,delay).numeric().addTo(new Label(t("Delay")+NBSP)).content(NBSP+"ms").addTo(form);
|
||||
return new Button(t("Apply"),form).addTo(form).addTo(fieldset);
|
||||
}
|
||||
|
||||
public boolean equals(DelayedAction other) {
|
||||
return (delay+":"+actions).equals(other.delay+":"+other.actions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fire(Context context) throws IOException {
|
||||
@@ -85,7 +89,7 @@ public class DelayedAction extends Action {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return t("Wait {} ms, then: {}",delay,actions);
|
||||
return t("Wait {} ms, then: ",delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,7 +87,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
stop = false;
|
||||
while (true) {
|
||||
if (isNull(route)) {
|
||||
Thread.sleep(2000);
|
||||
Thread.sleep(1000);
|
||||
if (stop) return;
|
||||
Train.this.start();
|
||||
}
|
||||
|
||||
@@ -136,6 +136,11 @@ public abstract class Contact extends Tile{
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String title() {
|
||||
return t("Contact {} @ ({}, {})",addr,x,y);
|
||||
}
|
||||
|
||||
public String trigger() {
|
||||
if (trigger == null) trigger = getClass().getSimpleName()+"-"+id();
|
||||
return trigger;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ContactV extends Contact {
|
||||
default:
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Direction> possibleDirections() {
|
||||
|
||||
@@ -355,6 +355,8 @@ public abstract class Tile extends BaseClass{
|
||||
default:
|
||||
}
|
||||
}
|
||||
String title = title();
|
||||
if (isSet(title)) new Tag("title").content(title()).addTo(svg);
|
||||
} else {
|
||||
new Tag("title").content(t("No display defined for this tile ({})",getClass().getSimpleName())).addTo(svg);
|
||||
new Tag("text")
|
||||
@@ -362,8 +364,6 @@ public abstract class Tile extends BaseClass{
|
||||
.content("?")
|
||||
.addTo(svg);
|
||||
}
|
||||
String title = title();
|
||||
if (isSet(title)) new Tag("title").content(title()).addTo(svg);
|
||||
|
||||
return svg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user