implemented highlighting of tiles on action edit
This commit is contained in:
@@ -98,6 +98,10 @@ public abstract class Action extends BaseClass {
|
||||
public static Action get(Id actionId) {
|
||||
return actions.get(actionId);
|
||||
}
|
||||
|
||||
protected String highlightId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public JSONObject json() {
|
||||
return new JSONObject().put(TYPE, getClass().getSimpleName());
|
||||
|
||||
@@ -129,7 +129,7 @@ public class ActionList extends Action implements Iterable<Action>{
|
||||
if (!isEmpty()) {
|
||||
Tag list = new Tag("ol");
|
||||
for (Action action : actions) {
|
||||
Tag item = action.link("span",action).addTo(new Tag("li")).content(NBSP);
|
||||
Tag item = action.link("span",action, action.highlightId()).addTo(new Tag("li")).content(NBSP);
|
||||
action.button("↑", Map.of(ACTION,ACTION_MOVE)).title(t("move up")).addTo(item);
|
||||
action.button("-", Map.of(ACTION,ACTION_DROP)).title(t("delete")).addTo(item);
|
||||
if (action instanceof ActionList) ((ActionList) action).listAt(item);
|
||||
|
||||
@@ -56,6 +56,12 @@ public class AddRemoveDestination extends Action {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(destination) ? destination.id().toString() : null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
@@ -34,6 +34,11 @@ public class DetermineTrainInBlock extends Action {
|
||||
return (isSet(train));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(block) ? block.id().toString() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
@@ -41,6 +41,12 @@ public class DisableEnableBlock extends Action {
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(block) ? block.id().toString() : null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Action load(JSONObject json) {
|
||||
if (json.has(STATE)) disable = !json.getBoolean(STATE);
|
||||
|
||||
@@ -29,6 +29,12 @@ public class SetDisplayText extends TextAction{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(display) ? display.id().toString() : null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
@@ -35,6 +35,12 @@ public class SetRelayOrSwitch extends Action {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(relayOrSwitch) ? relayOrSwitch.id().toString() : null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
@@ -40,6 +40,11 @@ public class SetSignal extends Action {
|
||||
return signal.state(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(signal) ? signal.id().toString() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
@@ -34,6 +34,11 @@ public class SetTurnout extends Action {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(turnout) ? turnout.id().toString() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
@@ -25,6 +25,12 @@ public class TriggerContact extends Action {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(contact) ? contact.id().toString() : null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
@@ -57,6 +57,12 @@ public class WaitForContact extends ActionList {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String highlightId() {
|
||||
return isSet(contact) ? contact.id().toString() : null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
|
||||
Reference in New Issue
Block a user