minor changes

This commit is contained in:
Stephan Richter
2020-11-06 20:52:55 +01:00
parent 9fed18a517
commit d3ca0a08ef
11 changed files with 34 additions and 17 deletions

View File

@@ -76,7 +76,7 @@ public class ActionList extends Vector<Action> implements Constants{
public void addActionsFrom(ActionList other) {
for (Action otherAction : other) {
LOG.debug("old action: {}",otherAction);
//LOG.debug("old action ({}): {}",otherAction.getClass().getSimpleName(),otherAction);
boolean exists = false;
int len = this.size();
for (int i=0; i<len; i++) {
@@ -234,4 +234,4 @@ public class ActionList extends Vector<Action> implements Constants{
}
return t("No action with id {} found.",actionId);
}
}
}

View File

@@ -33,6 +33,15 @@ public class ConditionalAction extends Action {
return actions;
}
private StringBuffer conditions() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i<conditions.size(); i++) {
if (i>0) sb.append(t(" or "));
sb.append(conditions.get(i).toString());
}
return sb;
}
private Tag conditionForm(HashMap<String, String> params) {
Fieldset fieldset = new Fieldset(t("Conditions"));
@@ -53,6 +62,10 @@ public class ConditionalAction extends Action {
Condition.selector().addTo(form);
return new Button(t("Add condition"),form).addTo(form).addTo(fieldset);
}
public boolean equals(ConditionalAction other) {
return (conditions()+":"+actions).equals(other.conditions()+":"+other.actions);
}
@Override
public boolean fire(Context context) throws IOException {
@@ -97,12 +110,7 @@ public class ConditionalAction extends Action {
@Override
public String toString() {
if (conditions.isEmpty()) return t("[Click here to add condition]");
StringBuffer sb = new StringBuffer();
for (int i = 0; i<conditions.size(); i++) {
if (i>0) sb.append(t(" or "));
sb.append(conditions.get(i).toString());
}
return t("if ({}): {}",sb,actions);
return t("if ({}):",conditions());
}
@Override

View File

@@ -44,6 +44,10 @@ public class DelayedAction extends Action {
new Input(DELAY,delay).numeric().addTo(new Label(t("Delay")+NBSP)).content(NBSP+"ms").addTo(form);
return new Button(t("Apply"),form).addTo(form).addTo(fieldset);
}
public boolean equals(DelayedAction other) {
return (delay+":"+actions).equals(other.delay+":"+other.actions);
}
@Override
public boolean fire(Context context) throws IOException {
@@ -85,7 +89,7 @@ public class DelayedAction extends Action {
@Override
public String toString() {
return t("Wait {} ms, then: {}",delay,actions);
return t("Wait {} ms, then: ",delay);
}
@Override