refurbishing route.save
This commit is contained in:
@@ -5,6 +5,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.conditions.Condition;
|
||||
@@ -17,6 +20,8 @@ import de.srsoftware.web4rail.tags.Select;
|
||||
|
||||
public class ConditionalAction extends Action {
|
||||
|
||||
private static final String CONDITIONS = "conditions";
|
||||
private static final String ACTIONS = "actions";
|
||||
private Vector<Condition> conditions = new Vector<Condition>();
|
||||
private ActionList actions = new ActionList();
|
||||
|
||||
@@ -26,6 +31,10 @@ public class ConditionalAction extends Action {
|
||||
return fieldset;
|
||||
}
|
||||
|
||||
public ActionList children() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
private Tag conditionForm(HashMap<String, String> params) {
|
||||
Fieldset fieldset = new Fieldset(t("Conditions"));
|
||||
|
||||
@@ -64,6 +73,16 @@ public class ConditionalAction extends Action {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
JSONArray conditions = new JSONArray();
|
||||
for (Condition condition : this.conditions) conditions.put(condition.json());
|
||||
json.put(CONDITIONS, conditions);
|
||||
json.put(ACTIONS, actions.json());
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Window properties(HashMap<String, String> params) {
|
||||
@@ -99,8 +118,4 @@ public class ConditionalAction extends Action {
|
||||
}
|
||||
return super.update(params);
|
||||
}
|
||||
|
||||
public ActionList children() {
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user