This commit is contained in:
Stephan Richter
2021-03-18 23:35:22 +01:00
parent 9172b60329
commit 483ebec39e
9 changed files with 101 additions and 53 deletions

View File

@@ -84,17 +84,16 @@ public class Contact extends Tile{
} else {
LOG.debug("{} activated.",this);
state = true;
stream();
if (isSet(timer)) timer.abort();
Train train = train();
Context context = isSet(train) ? train.contact(this) : new Context(this);
actions.fire(context,"Contact("+addr+")");
for (Listener listener : listeners) listener.fired("Contact("+addr+")");
stream();
}
}
public int addr() {
return addr;
}
@@ -112,12 +111,7 @@ public class Contact extends Tile{
@Override
public Object click(boolean shift) throws IOException {
if (!shift) new Thread(Application.threadName(this)) {
@Override
public void run() {
trigger(200);
}
}.start();
if (!shift) trigger(200);
return super.click(shift);
}

View File

@@ -540,7 +540,11 @@ public abstract class Tile extends BaseClass implements Comparable<Tile> {
oneWay = null;
}
}
if ("on".equals(params.get(DISABLED))) status = Status.DISABLED;
if ("on".equals(params.get(DISABLED))) {
status = Status.DISABLED;
} else {
status = isSet(train) ? Status.OCCUPIED : Status.FREE;
}
String len = params.get(LENGTH);
if (isSet(len)) length(Integer.parseInt(len));
super.update(params);