overhauled registry
This commit is contained in:
@@ -11,22 +11,16 @@ import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Input;
|
||||
|
||||
public class DelayedAction extends Action {
|
||||
public class DelayedAction extends ActionList {
|
||||
|
||||
|
||||
private static final String ACTIONS = "actions";
|
||||
public static final String DELAY = "delay";
|
||||
private static final int DEFAULT_DELAY = 1000;
|
||||
private int delay = DEFAULT_DELAY;
|
||||
private ActionList actions;
|
||||
|
||||
public DelayedAction(BaseClass parent) {
|
||||
super(parent);
|
||||
actions = new ActionList(this);
|
||||
}
|
||||
|
||||
public ActionList children() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
public boolean equals(DelayedAction other) {
|
||||
@@ -43,7 +37,7 @@ public class DelayedAction extends Action {
|
||||
} catch (InterruptedException e) {
|
||||
LOG.warn("Interrupted Exception thrown while waiting:",e);
|
||||
}
|
||||
actions.fire(context);
|
||||
DelayedAction.super.fire(context);
|
||||
};
|
||||
}.start();
|
||||
return true;
|
||||
@@ -53,14 +47,14 @@ public class DelayedAction extends Action {
|
||||
public JSONObject json() {
|
||||
JSONObject json = super.json();
|
||||
json.put(DELAY, delay);
|
||||
json.put(ACTIONS, actions.jsonArray());
|
||||
json.put(ACTIONS, jsonArray());
|
||||
return json;
|
||||
}
|
||||
|
||||
public DelayedAction load(JSONObject json) {
|
||||
super.load(json);
|
||||
delay = json.getInt(DELAY);
|
||||
if (json.has(ACTIONS)) actions.load(json.getJSONArray(ACTIONS));
|
||||
if (json.has(ACTIONS)) super.load(json.getJSONArray(ACTIONS));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -68,7 +62,7 @@ public class DelayedAction extends Action {
|
||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||
formInputs.add(t("Delay"),new Input(DELAY,delay).numeric().addTo(new Tag("span")).content(NBSP+"ms"));
|
||||
Fieldset fieldset = new Fieldset(t("Actions"));
|
||||
actions.list().addTo(fieldset);
|
||||
list().addTo(fieldset);
|
||||
postForm.add(fieldset);
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user