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