refactored condition management
This commit is contained in:
@@ -2,14 +2,15 @@ package de.srsoftware.web4rail.actions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import de.keawe.tools.translations.Translation;
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.Application;
|
||||
import de.srsoftware.web4rail.Constants;
|
||||
import de.srsoftware.web4rail.Plan;
|
||||
@@ -20,7 +21,7 @@ import de.srsoftware.web4rail.tiles.Contact;
|
||||
|
||||
public abstract class Action implements Constants {
|
||||
public static final Logger LOG = LoggerFactory.getLogger(Action.class);
|
||||
private int id;
|
||||
protected int id;
|
||||
|
||||
public static class Context {
|
||||
public Plan plan = null;
|
||||
@@ -37,7 +38,7 @@ public abstract class Action implements Constants {
|
||||
}
|
||||
|
||||
public Action() {
|
||||
id = new Date().hashCode();
|
||||
id = Application.createId();
|
||||
}
|
||||
|
||||
public abstract boolean fire(Context context) throws IOException;
|
||||
@@ -46,18 +47,18 @@ public abstract class Action implements Constants {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public JSONObject json() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put(TYPE, getClass().getSimpleName());
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName();
|
||||
protected Tag link(int actionId, String context) {
|
||||
Map<String, String> props = Map.of(REALM,REALM_ACTIONS,ID,actionId+"/"+id,ACTION,ACTION_PROPS,CONTEXT,context);
|
||||
String action = "request("+(new JSONObject(props).toString().replace("\"", "'"))+")";
|
||||
return new Tag("span").content(toString()).attr("onclick", action);
|
||||
}
|
||||
|
||||
|
||||
public static Action load(JSONObject json) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException {
|
||||
String clazz = json.getString(TYPE);
|
||||
switch (clazz) {
|
||||
@@ -75,11 +76,20 @@ public abstract class Action implements Constants {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Window propForm(HashMap<String, String> params) {
|
||||
return new Window("action-props", "Action properties");
|
||||
public Window properties(HashMap<String, String> params) {
|
||||
return new Window("action-props-"+id, t("Properties of {}",this.getClass().getSimpleName()));
|
||||
}
|
||||
|
||||
protected static String t(String tex,Object...fills) {
|
||||
return Translation.get(Application.class, tex, fills);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
return t("Nothing changed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package de.srsoftware.web4rail.actions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -14,6 +13,7 @@ import de.keawe.tools.translations.Translation;
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.Application;
|
||||
import de.srsoftware.web4rail.Constants;
|
||||
import de.srsoftware.web4rail.Plan;
|
||||
import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.actions.Action.Context;
|
||||
import de.srsoftware.web4rail.tags.Button;
|
||||
@@ -30,48 +30,78 @@ public class ActionList extends Vector<Action> implements Constants{
|
||||
private static final HashMap<Integer, ActionList> actionLists = new HashMap<Integer, ActionList>();
|
||||
|
||||
public ActionList() {
|
||||
id = new Date().hashCode();
|
||||
id = Application.createId();
|
||||
actionLists.put(id,this);
|
||||
}
|
||||
|
||||
public void fire(Context context) {
|
||||
LOG.debug("Firing {}",this);
|
||||
|
||||
for (Action action : this) {
|
||||
try {
|
||||
action.fire(context);
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Action did not fire properly: {}",action,e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer actionId(HashMap<String, String> params) {
|
||||
if (!params.containsKey(ID)) return null;
|
||||
String[] parts = params.get(ID).split("/");
|
||||
if (parts.length<2) return null;
|
||||
return Integer.parseInt(parts[1]);
|
||||
}
|
||||
|
||||
public boolean drop(int actionId) {
|
||||
for (Action action : this) {
|
||||
if (action.id() == actionId) {
|
||||
this.remove(action);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
private static Integer actionListId(HashMap<String, String> params) {
|
||||
if (!params.containsKey(ID)) return null;
|
||||
String[] parts = params.get(ID).split("/");
|
||||
return Integer.parseInt(parts[0]);
|
||||
}
|
||||
|
||||
public boolean moveUp(int actionId) {
|
||||
for (int i=1; i<size(); i++) {
|
||||
if (actionId == elementAt(i).id()) {
|
||||
Action action = remove(i);
|
||||
insertElementAt(action, i-1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
private Object actionTypeForm(Window win, String context) {
|
||||
String formId ="add-action-to-"+id;
|
||||
Tag typeForm = new Form(formId);
|
||||
new Input(REALM, REALM_ACTIONS).hideIn(typeForm);
|
||||
new Input(ID,id).hideIn(typeForm);
|
||||
new Input(ACTION,ACTION_ADD).hideIn(typeForm);
|
||||
new Input(CONTEXT,context).hideIn(typeForm);
|
||||
Select select = new Select(TYPE);
|
||||
List<Class<? extends Action>> classes = List.of(
|
||||
SpeedReduction.class,
|
||||
SetSignalsToStop.class,
|
||||
FinishRoute.class,
|
||||
TurnTrain.class,
|
||||
ConditionalAction.class);
|
||||
for (Class<? extends Action> clazz : classes) select.addOption(clazz.getSimpleName());
|
||||
select.addTo(new Label("Action type:")).addTo(typeForm);
|
||||
return new Button(t("Create action"),"return submitForm('"+formId+"');").addTo(typeForm).addTo(win);
|
||||
}
|
||||
|
||||
public void addTo(Tag link) {
|
||||
|
||||
private Object addActionForm(HashMap<String, String> params, Plan plan) {
|
||||
Window win = new Window("add-action-form", t("Add action to action list"));
|
||||
String type = params.get(TYPE);
|
||||
String context = params.get(CONTEXT);
|
||||
if (type == null) return actionTypeForm(win,context);
|
||||
|
||||
switch (type) {
|
||||
case "ConditionalAction":
|
||||
add(new ConditionalAction());
|
||||
break;
|
||||
case "FinishRoute":
|
||||
add(new FinishRoute());
|
||||
break;
|
||||
case "SetSignalsToStop":
|
||||
add(new SetSignalsToStop());
|
||||
break;
|
||||
case "SpeedReduction":
|
||||
add(new SpeedReduction(0));
|
||||
break;
|
||||
case "TurnTrain":
|
||||
add(new TurnTrain());
|
||||
break;
|
||||
default:
|
||||
actionTypeForm(win,context);
|
||||
new Tag("span").content(t("Unknown action type: {}",type)).addTo(win);
|
||||
return win;
|
||||
}
|
||||
return plan.showContext(params);
|
||||
}
|
||||
|
||||
public void addTo(Tag link, String context) {
|
||||
Map<String, Object> props = new HashMap<String, Object>(Map.of(
|
||||
REALM,REALM_ACTIONS,
|
||||
ID,id,
|
||||
ACTION,ACTION_ADD));
|
||||
ACTION,ACTION_ADD,
|
||||
CONTEXT,context));
|
||||
new Button(t("add action"),props).addTo(link);
|
||||
|
||||
props.put(ACTION,ACTION_PROPS);
|
||||
@@ -80,7 +110,7 @@ public class ActionList extends Vector<Action> implements Constants{
|
||||
boolean first = true;
|
||||
for (Action action : this) {
|
||||
props.put(ID, id+"/"+action.id());
|
||||
Tag act = new Tag("li").content(action.toString());
|
||||
Tag act = action.link(id,context).addTo(new Tag("li"));
|
||||
if (!first) {
|
||||
props.put(ACTION, ACTION_MOVE);
|
||||
new Button("↑",props).addTo(act);
|
||||
@@ -94,79 +124,92 @@ public class ActionList extends Vector<Action> implements Constants{
|
||||
}
|
||||
}
|
||||
|
||||
private static String t(String text,Object...fills) {
|
||||
return Translation.get(Application.class, text, fills);
|
||||
}
|
||||
|
||||
public static Object process(HashMap<String, String> params) {
|
||||
if (!params.containsKey(ID)) return t("No action list id passed to ActionList.process()!");
|
||||
String[] parts = params.get(ID).split("/");
|
||||
int listId = Integer.parseInt(parts[0]);
|
||||
int actionId = parts.length>1 ? Integer.parseInt(parts[1]) : 0;
|
||||
ActionList actionList = actionLists.get(listId);
|
||||
if (actionList == null) return t("No action list with id {} found!",listId);
|
||||
String action = params.get(ACTION);
|
||||
if (action == null) return t("No action passed to ActionList.process()!");
|
||||
switch (action) {
|
||||
case ACTION_ADD:
|
||||
return actionList.addActionForm(params);
|
||||
case ACTION_DROP:
|
||||
return actionList.drop(actionId) ? t("Action removed") : t("No action with id {} found!",actionId);
|
||||
case ACTION_MOVE:
|
||||
return actionList.moveUp(actionId) ? t("Action moved") : t("No action with id {} found!",actionId);
|
||||
public boolean drop(int actionId) {
|
||||
for (Action action : this) {
|
||||
if (action.id() == actionId) {
|
||||
this.remove(action);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return t("Unknown action: {}",action);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void fire(Context context) {
|
||||
LOG.debug("Firing {}",this);
|
||||
|
||||
private Object addActionForm(HashMap<String, String> params) {
|
||||
Window win = new Window("add-action-form", t("Add action to action list"));
|
||||
String formId ="add-action-to-"+id;
|
||||
Tag typeForm = new Form(formId);
|
||||
new Input(REALM, REALM_ACTIONS).hideIn(typeForm);
|
||||
new Input(ID,id).hideIn(typeForm);
|
||||
new Input(ACTION,ACTION_ADD).hideIn(typeForm);
|
||||
String type = params.get(TYPE);
|
||||
if (type == null) return actionTypeForm(win);
|
||||
|
||||
switch (type) {
|
||||
case "FinishRoute":
|
||||
add(new FinishRoute());
|
||||
break;
|
||||
case "SetSignalsToStop":
|
||||
add(new SetSignalsToStop());
|
||||
break;
|
||||
case "SpeedReduction":
|
||||
return SpeedReduction.propForm(this,params);
|
||||
case "TurnTrain":
|
||||
add(new TurnTrain());
|
||||
break;
|
||||
default:
|
||||
actionTypeForm(win);
|
||||
new Tag("span").content(t("Unknown action type: {}",type)).addTo(win);
|
||||
return win;
|
||||
for (Action action : this) {
|
||||
try {
|
||||
action.fire(context);
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Action did not fire properly: {}",action,e);
|
||||
}
|
||||
}
|
||||
return t("Action added!");
|
||||
}
|
||||
|
||||
private Object actionTypeForm(Window win) {
|
||||
String formId ="add-action-to-"+id;
|
||||
Tag typeForm = new Form(formId);
|
||||
new Input(REALM, REALM_ACTIONS).hideIn(typeForm);
|
||||
new Input(ID,id).hideIn(typeForm);
|
||||
new Input(ACTION,ACTION_ADD).hideIn(typeForm);
|
||||
Select select = new Select(TYPE);
|
||||
List<Class<? extends Action>> classes = List.of(
|
||||
SpeedReduction.class,
|
||||
SetSignalsToStop.class,
|
||||
FinishRoute.class,
|
||||
TurnTrain.class,
|
||||
ConditionalAction.class);
|
||||
for (Class<? extends Action> clazz : classes) select.addOption(clazz.getSimpleName());
|
||||
select.addTo(new Label("Action type:")).addTo(typeForm);
|
||||
return new Button(t("Create action"),"return submitForm('"+formId+"');").addTo(typeForm).addTo(win);
|
||||
|
||||
private Action getAction(int actionId) {
|
||||
for (Action action : this) {
|
||||
if (action.id == actionId) return action;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int id() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean moveUp(int actionId) {
|
||||
for (int i=1; i<size(); i++) {
|
||||
if (actionId == elementAt(i).id()) {
|
||||
Action action = remove(i);
|
||||
insertElementAt(action, i-1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Object process(HashMap<String, String> params, Plan plan) {
|
||||
Integer listId = actionListId(params);
|
||||
if (listId == null) return t("No action list id passed to ActionList.process()!");
|
||||
ActionList actionList = actionLists.get(listId);
|
||||
if (actionList == null) return t("No action list with id {} found!",listId);
|
||||
|
||||
Integer actionId = actionId(params);
|
||||
String action = params.get(ACTION);
|
||||
if (action == null) return t("No action passed to ActionList.process()!");
|
||||
|
||||
switch (action) {
|
||||
case ACTION_ADD:
|
||||
return actionList.addActionForm(params,plan);
|
||||
case ACTION_DROP:
|
||||
return actionList.drop(actionId) ? plan.showContext(params) : t("No action with id {} found!",actionId);
|
||||
case ACTION_MOVE:
|
||||
return actionList.moveUp(actionId) ? plan.showContext(params) : t("No action with id {} found!",actionId);
|
||||
case ACTION_PROPS:
|
||||
return actionList.propsOf(params);
|
||||
case ACTION_UPDATE:
|
||||
return actionList.update(actionId,params,plan);
|
||||
}
|
||||
return t("Unknown action: {}",action);
|
||||
}
|
||||
|
||||
private Object propsOf(HashMap<String, String> params) {
|
||||
int actionId = actionId(params);
|
||||
Action action = getAction(actionId);
|
||||
if (action != null) return action.properties(params);
|
||||
return t("No action with id {} found!",actionId);
|
||||
}
|
||||
|
||||
private static String t(String text,Object...fills) {
|
||||
return Translation.get(Application.class, text, fills);
|
||||
}
|
||||
|
||||
private Object update(int actionId, HashMap<String, String> params, Plan plan) {
|
||||
Action action = getAction(actionId);
|
||||
if (action != null) {
|
||||
plan.stream(action.update(params).toString());
|
||||
return plan.showContext(params);
|
||||
}
|
||||
return t("No action with id {} found.",actionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,47 @@
|
||||
package de.srsoftware.web4rail.actions;
|
||||
|
||||
import static de.srsoftware.web4rail.Constants.TYPE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.Route;
|
||||
import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.conditions.Condition;
|
||||
import de.srsoftware.web4rail.conditions.TrainSelect;
|
||||
import de.srsoftware.web4rail.tags.Button;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Form;
|
||||
import de.srsoftware.web4rail.tags.Input;
|
||||
import de.srsoftware.web4rail.tags.Select;
|
||||
import de.srsoftware.web4rail.tiles.Contact;
|
||||
|
||||
public class ConditionalAction extends Action {
|
||||
|
||||
private Vector<Condition> conditions = new Vector<Condition>();
|
||||
private Vector<Action> actions = new Vector<Action>();
|
||||
private ActionList actions = new ActionList();
|
||||
|
||||
private ConditionalAction addCondition(Condition condition) {
|
||||
conditions.add(new TrainSelect());
|
||||
return this;
|
||||
}
|
||||
|
||||
private static void addToContact(Route route, Contact contact, String conditionType) {
|
||||
Condition condition = null;
|
||||
switch (conditionType) {
|
||||
case "TrainSelect":
|
||||
condition = new TrainSelect();
|
||||
break;
|
||||
default: return;
|
||||
private Tag conditionForm(HashMap<String, String> params) {
|
||||
Fieldset fieldset = new Fieldset("Conditions");
|
||||
|
||||
if (!conditions.isEmpty()) {
|
||||
Tag list = new Tag("ul");
|
||||
for (Condition condition : conditions) condition.link("li",params.get(CONTEXT)).addTo(list);
|
||||
list.addTo(fieldset);
|
||||
}
|
||||
route.addAction(contact.trigger(), new ConditionalAction().addCondition(condition));
|
||||
String formId = "action-prop-form-"+id;
|
||||
Form form = new Form(formId);
|
||||
new Input(REALM,REALM_ACTIONS).hideIn(form);
|
||||
new Input(ID,params.get(ID)).hideIn(form);
|
||||
new Input(ACTION,ACTION_UPDATE).hideIn(form);
|
||||
new Input(CONTEXT,params.get(CONTEXT)).hideIn(form);
|
||||
|
||||
Select select = new Select(REALM_CONDITION);
|
||||
List<Class<? extends Condition>> classes = List.of(TrainSelect.class);
|
||||
for (Class<? extends Condition> clazz : classes) select.addOption(clazz.getSimpleName());
|
||||
select.addTo(form);
|
||||
return new Button(t("Add condition"),"return submitForm('"+formId+"');").addTo(form).addTo(fieldset);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean fire(Context context) throws IOException {
|
||||
for (Condition condition : conditions) {
|
||||
@@ -55,39 +58,38 @@ public class ConditionalAction extends Action {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Window propForm(HashMap<String, String> params, Route route, Contact contact) {
|
||||
String condition = params.get(REALM_CONDITION);
|
||||
if (condition != null) {
|
||||
addToContact(route,contact,condition);
|
||||
return route.properties();
|
||||
}
|
||||
Window win = Action.propForm(params);
|
||||
String formId = "add-action-to-contact-"+contact.id();
|
||||
Tag form = new Form(formId);
|
||||
new Tag("div").content(t("Add Action {} to contact {} on route {}:",ConditionalAction.class.getSimpleName(),contact,route)).addTo(win);
|
||||
new Input(REALM, REALM_ROUTE).hideIn(form);
|
||||
new Input(ID,route.id()).hideIn(form);
|
||||
new Input(ACTION,ACTION_ADD_ACTION).hideIn(form);
|
||||
new Input(CONTACT,contact.id()).hideIn(form);
|
||||
new Input(TYPE,ConditionalAction.class.getSimpleName()).hideIn(form);
|
||||
Select select = new Select(REALM_CONDITION);
|
||||
List<Class<? extends Condition>> conditionTypes = List.of(TrainSelect.class);
|
||||
for (Class<? extends Condition> clazz : conditionTypes) select.addOption(clazz.getSimpleName());
|
||||
select.addTo(form);
|
||||
new Button(t("Create action"),"return submitForm('"+formId+"');").addTo(form).addTo(win);
|
||||
|
||||
@Override
|
||||
public Window properties(HashMap<String, String> params) {
|
||||
Window win = super.properties(params);
|
||||
conditionForm(params).addTo(win);
|
||||
return win;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (conditions.isEmpty()) return t("Invalid condition");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i<conditions.size(); i++) {
|
||||
Condition condition = conditions.get(i);
|
||||
Tag link = condition.link("span");
|
||||
sb.append(link);
|
||||
if (i>0) sb.append(t(" or "));
|
||||
sb.append(conditions.get(i).toString());
|
||||
}
|
||||
return t("if ({}):",sb);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
String conditionClass = params.get(REALM_CONDITION);
|
||||
if (conditionClass != null) {
|
||||
switch (conditionClass) {
|
||||
case "TrainSelect":
|
||||
conditions.add(new TrainSelect());
|
||||
break;
|
||||
|
||||
default:
|
||||
return t("Unknown type of condition: {}",conditionClass);
|
||||
}
|
||||
}
|
||||
return super.update(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,30 @@ public class SpeedReduction extends Action{
|
||||
return json;
|
||||
}
|
||||
|
||||
public static Object propForm(ActionList actionList, HashMap<String, String> params) {
|
||||
@Override
|
||||
public Window properties(HashMap<String, String> params) {
|
||||
Window win = super.properties(params);
|
||||
String formId = "action-prop-form-"+id;
|
||||
Form form = new Form(formId);
|
||||
new Input(REALM,REALM_ACTIONS).hideIn(form);
|
||||
new Input(ID,params.get(ID)).hideIn(form);
|
||||
new Input(ACTION,ACTION_UPDATE).hideIn(form);
|
||||
new Input(CONTEXT,params.get(CONTEXT)).hideIn(form);
|
||||
Label label = new Label(t("Set speed to")+NBSP);
|
||||
new Input(MAX_SPEED, maxSpeed).addTo(label).content(NBSP+t("km/h"));
|
||||
label.addTo(form);
|
||||
new Button(t("Save"),"return submitForm('"+formId+"');").addTo(form).addTo(win);
|
||||
return win;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return t("Reduce speed to {} km/h",maxSpeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
LOG.debug("update: {}",params);
|
||||
String error = null;
|
||||
String ms = params.get(MAX_SPEED);
|
||||
if (ms == null) {
|
||||
@@ -47,28 +70,14 @@ public class SpeedReduction extends Action{
|
||||
int s = Integer.parseInt(ms);
|
||||
if (s<0) error = t("Speed must not be less than zero!");
|
||||
if (error == null) {
|
||||
actionList.add(new SpeedReduction(s));
|
||||
return t("Action added!");
|
||||
this.maxSpeed = s;
|
||||
return t("Action updated!");
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
error = t("Not a valid number!");
|
||||
}
|
||||
}
|
||||
Window win = Action.propForm(params);
|
||||
String formId = "edit-speedreduction";
|
||||
Tag form = new Form(formId);
|
||||
new Input(REALM, REALM_ACTIONS).hideIn(form);
|
||||
new Input(ID,actionList.id()).hideIn(form);
|
||||
new Input(ACTION,ACTION_ADD).hideIn(form);
|
||||
new Input(TYPE,SpeedReduction.class.getSimpleName()).hideIn(form);
|
||||
new Input(MAX_SPEED, ms).addTo(new Label("new speed")).addTo(form);
|
||||
//if (error != null) new Tag("div").content(error).addTo(form);
|
||||
new Button(t("Create action"),"return submitForm('"+formId+"');").addTo(form).addTo(win);
|
||||
return win;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return t("Reduce speed to {} km/h",maxSpeed);
|
||||
Window win = properties(params);
|
||||
return new Tag("span").content(error).addTo(win);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user