improved UI
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>1.5.37</version>
|
<version>1.5.38</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
|
|||||||
@@ -105,13 +105,6 @@ public class ActionList extends Action implements Iterable<Action>{
|
|||||||
return speed;
|
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
|
@Override
|
||||||
public Iterator<Action> iterator() {
|
public Iterator<Action> iterator() {
|
||||||
return actions.iterator();
|
return actions.iterator();
|
||||||
@@ -253,10 +246,7 @@ public class ActionList extends Action implements Iterable<Action>{
|
|||||||
return start(action);
|
return start(action);
|
||||||
case ACTION_UPDATE:
|
case ACTION_UPDATE:
|
||||||
Object res = action.update(params);
|
Object res = action.update(params);
|
||||||
if (res instanceof Window) {
|
if (res instanceof Window) ((Window) res).highlight(action);
|
||||||
Window win = (Window) res;
|
|
||||||
highlight(win,action);
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return t("Unknown action: {}",command);
|
return t("Unknown action: {}",command);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class ConditionalAction extends ActionList {
|
|||||||
public <T extends Tag> T listAt(T parent) {
|
public <T extends Tag> T listAt(T parent) {
|
||||||
T tag = super.listAt(parent);
|
T tag = super.listAt(parent);
|
||||||
if (!elseActions.isEmpty()) {
|
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);
|
new Tag("span").content(t("else:")+NBSP).addTo(div);
|
||||||
elseActions.listAt(div);
|
elseActions.listAt(div);
|
||||||
div.addTo(tag);
|
div.addTo(tag);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import de.srsoftware.web4rail.BaseClass;
|
|||||||
import de.srsoftware.web4rail.Params;
|
import de.srsoftware.web4rail.Params;
|
||||||
import de.srsoftware.web4rail.Plan;
|
import de.srsoftware.web4rail.Plan;
|
||||||
import de.srsoftware.web4rail.actions.Action;
|
import de.srsoftware.web4rail.actions.Action;
|
||||||
|
import de.srsoftware.web4rail.actions.ActionList;
|
||||||
import de.srsoftware.web4rail.tags.Checkbox;
|
import de.srsoftware.web4rail.tags.Checkbox;
|
||||||
import de.srsoftware.web4rail.tags.Fieldset;
|
import de.srsoftware.web4rail.tags.Fieldset;
|
||||||
import de.srsoftware.web4rail.tags.Select;
|
import de.srsoftware.web4rail.tags.Select;
|
||||||
@@ -53,7 +54,18 @@ public abstract class Condition extends BaseClass {
|
|||||||
case ACTION_PROPS:
|
case ACTION_PROPS:
|
||||||
return condition.properties();
|
return condition.properties();
|
||||||
case ACTION_UPDATE:
|
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);
|
return t("Unknown action: {}",action);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.srsoftware.web4rail.tags;
|
package de.srsoftware.web4rail.tags;
|
||||||
|
|
||||||
import de.srsoftware.tools.Tag;
|
import de.srsoftware.tools.Tag;
|
||||||
|
import de.srsoftware.web4rail.BaseClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stephan Richter, SRSoftware 2020-2021 *
|
* @author Stephan Richter, SRSoftware 2020-2021 *
|
||||||
@@ -24,4 +25,11 @@ public class Window extends Tag{
|
|||||||
.attr("onclick", "return swapTiling();")
|
.attr("onclick", "return swapTiling();")
|
||||||
.content("◧").addTo(this);
|
.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