refurbishing route.save
This commit is contained in:
@@ -48,6 +48,10 @@ public abstract class Condition implements Constants {
|
||||
return t("Unknown action: {}",action);
|
||||
}
|
||||
|
||||
public JSONObject json() {
|
||||
return new JSONObject().put(TYPE, getClass().getSimpleName());
|
||||
}
|
||||
|
||||
public Tag link(String tagClass,String context) {
|
||||
String json = new JSONObject(Map.of(REALM,REALM_CONDITION,ID,id,ACTION,ACTION_PROPS,CONTEXT,context)).toString().replace("\"", "'");
|
||||
return new Tag(tagClass).clazz("link").attr("onclick","request("+json+")").content(toString());
|
||||
|
||||
@@ -2,6 +2,8 @@ package de.srsoftware.web4rail.conditions;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.actions.Action.Context;
|
||||
import de.srsoftware.web4rail.moving.Train;
|
||||
@@ -20,6 +22,11 @@ public class TrainSelect extends Condition {
|
||||
return context.train == train;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
return super.json().put(REALM_TRAIN, train.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Window properties(HashMap<String, String> params) {
|
||||
Window win = new Window("condition-props", t("Properties of {}",getClass().getSimpleName()));
|
||||
|
||||
Reference in New Issue
Block a user