improved UI
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.srsoftware</groupId>
|
||||
<artifactId>web4rail</artifactId>
|
||||
<version>1.5.37</version>
|
||||
<version>1.5.38</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -104,13 +104,6 @@ public class ActionList extends Action implements Iterable<Action>{
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
|
||||
private static void highlight(Window win, Action action) {
|
||||
BaseClass scrollTarget = action.parent();
|
||||
if (isNull(scrollTarget)) scrollTarget = action;
|
||||
|
||||
win.children().add(new Tag("script").content("document.getElementById('"+scrollTarget.id()+"').scrollIntoView({ behavior: \"smooth\" }); document.getElementById('"+action.id()+"').classList.add('highlight');"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Action> iterator() {
|
||||
@@ -253,10 +246,7 @@ public class ActionList extends Action implements Iterable<Action>{
|
||||
return start(action);
|
||||
case ACTION_UPDATE:
|
||||
Object res = action.update(params);
|
||||
if (res instanceof Window) {
|
||||
Window win = (Window) res;
|
||||
highlight(win,action);
|
||||
}
|
||||
if (res instanceof Window) ((Window) res).highlight(action);
|
||||
return res;
|
||||
}
|
||||
return t("Unknown action: {}",command);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ConditionalAction extends ActionList {
|
||||
public <T extends Tag> T listAt(T parent) {
|
||||
T tag = super.listAt(parent);
|
||||
if (!elseActions.isEmpty()) {
|
||||
Tag div = new Tag("div").clazz("else");
|
||||
Tag div = new Tag("div").id(elseActions.id().toString()).clazz("else");
|
||||
new Tag("span").content(t("else:")+NBSP).addTo(div);
|
||||
elseActions.listAt(div);
|
||||
div.addTo(tag);
|
||||
|
||||
@@ -16,6 +16,7 @@ import de.srsoftware.web4rail.BaseClass;
|
||||
import de.srsoftware.web4rail.Params;
|
||||
import de.srsoftware.web4rail.Plan;
|
||||
import de.srsoftware.web4rail.actions.Action;
|
||||
import de.srsoftware.web4rail.actions.ActionList;
|
||||
import de.srsoftware.web4rail.tags.Checkbox;
|
||||
import de.srsoftware.web4rail.tags.Fieldset;
|
||||
import de.srsoftware.web4rail.tags.Select;
|
||||
@@ -53,7 +54,18 @@ public abstract class Condition extends BaseClass {
|
||||
case ACTION_PROPS:
|
||||
return condition.properties();
|
||||
case ACTION_UPDATE:
|
||||
return condition.update(params);
|
||||
Object res = condition.update(params);
|
||||
if (res instanceof Window) {
|
||||
BaseClass parent = condition.parent();
|
||||
while (isSet(parent)) {
|
||||
if (parent instanceof ActionList) {
|
||||
((Window) res).highlight(parent);
|
||||
break;
|
||||
}
|
||||
parent = parent.parent();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return t("Unknown action: {}",action);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package de.srsoftware.web4rail.tags;
|
||||
|
||||
import de.srsoftware.tools.Tag;
|
||||
import de.srsoftware.web4rail.BaseClass;
|
||||
|
||||
/**
|
||||
* @author Stephan Richter, SRSoftware 2020-2021 *
|
||||
@@ -24,4 +25,11 @@ public class Window extends Tag{
|
||||
.attr("onclick", "return swapTiling();")
|
||||
.content("◧").addTo(this);
|
||||
}
|
||||
|
||||
public void highlight(BaseClass element) {
|
||||
BaseClass scrollTarget = element.parent();
|
||||
if (scrollTarget == null) scrollTarget = element;
|
||||
|
||||
children().add(new Tag("script").content("document.getElementById('"+scrollTarget.id()+"').scrollIntoView({ behavior: \"smooth\" }); document.getElementById('"+element.id()+"').classList.add('highlight');"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user