refactoring actions
This commit is contained in:
@@ -6,23 +6,25 @@ import java.util.List;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.BaseClass;
|
||||
import de.srsoftware.web4rail.Window;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Input;
|
||||
|
||||
public class DelayedAction extends Action {
|
||||
|
||||
public DelayedAction(Context parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
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 = new ActionList();
|
||||
private ActionList actions;
|
||||
|
||||
public DelayedAction(BaseClass parent) {
|
||||
super(parent);
|
||||
actions = new ActionList(this);
|
||||
}
|
||||
|
||||
public ActionList children() {
|
||||
return actions;
|
||||
}
|
||||
@@ -58,15 +60,16 @@ public class DelayedAction extends Action {
|
||||
public DelayedAction load(JSONObject json) {
|
||||
super.load(json);
|
||||
delay = json.getInt(DELAY);
|
||||
if (json.has(ACTIONS)) actions = new ActionList().load(json.getJSONArray(ACTIONS));
|
||||
if (json.has(ACTIONS)) actions.load(json.getJSONArray(ACTIONS));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
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"));
|
||||
postForm.add(actions.list());
|
||||
Fieldset fieldset = new Fieldset(t("Actions"));
|
||||
actions.list().addTo(fieldset);
|
||||
postForm.add(fieldset);
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user