package de.srsoftware.web4rail.actions; import java.util.HashMap; import java.util.List; import org.json.JSONObject; import de.srsoftware.web4rail.BaseClass; import de.srsoftware.web4rail.tags.Fieldset; import de.srsoftware.web4rail.tags.Input; import de.srsoftware.web4rail.tags.Label; import de.srsoftware.web4rail.tags.Window; public abstract class TextAction extends Action { public TextAction(BaseClass parent) { super(parent); } public static final String TEXT = "text"; protected String text = "Hello, world!"; public String fill(String tx,Context context) { if (isSet(context.block())) tx = tx.replace("%block%", context.block().name); if (isSet(context.contact())) tx = tx.replace("%contact%", context.contact().id().toString()); if (isSet(context.route())) tx = tx.replace("%route%", context.route().name()); if (isSet(context.train())) tx = tx.replace("%train%", context.train().name()); return tx; } @Override public JSONObject json() { JSONObject json = super.json(); json.put(TEXT, text); return json; } protected abstract Label label(); @Override public Action load(JSONObject json) { super.load(json); text = json.getString(TEXT); return this; } @Override protected Window properties(List