refactoring...
This commit is contained in:
@@ -125,8 +125,17 @@ public abstract class Action extends BaseClass {
|
||||
public String toString() {
|
||||
return t(getClass().getSimpleName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
return t("Nothing changed");
|
||||
super.update(params);
|
||||
BaseClass parent = parent();
|
||||
if (isNull(parent)) return properties();
|
||||
if (parent instanceof ActionList) {
|
||||
ActionList al = (ActionList) parent;
|
||||
return al.parent().properties();
|
||||
}
|
||||
return parent.properties();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,14 +83,11 @@ public class SetSignal extends Action {
|
||||
};
|
||||
|
||||
@Override
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
LOG.debug("update: {}",params);
|
||||
public Object update(HashMap<String, String> params) {
|
||||
Tile tile = plan.get(new Id(params.get(SIGNAL)), false);
|
||||
if (tile instanceof Signal) signal = (Signal) tile;
|
||||
String st = params.get(Signal.STATE);
|
||||
if (isSet(st)) state = st;
|
||||
return properties();
|
||||
return super.update(params);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ 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;
|
||||
@@ -59,7 +58,6 @@ public class SetSpeed extends Action{
|
||||
|
||||
@Override
|
||||
protected Object update(HashMap<String, String> params) {
|
||||
LOG.debug("update: {}",params);
|
||||
String error = null;
|
||||
String ms = params.get(MAX_SPEED);
|
||||
if (ms == null) {
|
||||
@@ -76,7 +74,7 @@ public class SetSpeed extends Action{
|
||||
error = t("Not a valid number!");
|
||||
}
|
||||
}
|
||||
Window win = properties();
|
||||
return new Tag("span").content(error).addTo(win);
|
||||
if (isSet(error)) return error;
|
||||
return super.update(params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user