GUI improvements
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.36</version>
|
<version>1.5.37</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>
|
||||||
|
|||||||
@@ -104,6 +104,13 @@ 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() {
|
||||||
@@ -130,7 +137,7 @@ public class ActionList extends Action implements Iterable<Action>{
|
|||||||
if (!isEmpty()) {
|
if (!isEmpty()) {
|
||||||
Tag list = new Tag("ol");
|
Tag list = new Tag("ol");
|
||||||
for (Action action : actions) {
|
for (Action action : actions) {
|
||||||
Tag item = action.link("span",action, action.highlightId()).addTo(new Tag("li")).content(NBSP);
|
Tag item = action.link("span",action, action.highlightId()).id(action.id().toString()).addTo(new Tag("li")).content(NBSP);
|
||||||
action.button("↑", Map.of(ACTION,ACTION_MOVE)).title(t("move up")).addTo(item);
|
action.button("↑", Map.of(ACTION,ACTION_MOVE)).title(t("move up")).addTo(item);
|
||||||
action.button("-", Map.of(ACTION,ACTION_DROP)).title(t("delete")).addTo(item);
|
action.button("-", Map.of(ACTION,ACTION_DROP)).title(t("delete")).addTo(item);
|
||||||
if (action instanceof ActionList) ((ActionList) action).listAt(item);
|
if (action instanceof ActionList) ((ActionList) action).listAt(item);
|
||||||
@@ -245,7 +252,12 @@ public class ActionList extends Action implements Iterable<Action>{
|
|||||||
case ACTION_START:
|
case ACTION_START:
|
||||||
return start(action);
|
return start(action);
|
||||||
case ACTION_UPDATE:
|
case ACTION_UPDATE:
|
||||||
return action.update(params);
|
Object res = action.update(params);
|
||||||
|
if (res instanceof Window) {
|
||||||
|
Window win = (Window) res;
|
||||||
|
highlight(win,action);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
return t("Unknown action: {}",command);
|
return t("Unknown action: {}",command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,6 @@ public class SetPower extends Action{
|
|||||||
LOG.debug("update: {}",params);
|
LOG.debug("update: {}",params);
|
||||||
String newState = params.getString(STATE);
|
String newState = params.getString(STATE);
|
||||||
if (isSet(newState)) pc = POWERCHANGE.valueOf(newState);
|
if (isSet(newState)) pc = POWERCHANGE.valueOf(newState);
|
||||||
return parent().properties();
|
return context().properties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class TriggerContact extends Action {
|
|||||||
contactOrSwitch = tile;
|
contactOrSwitch = tile;
|
||||||
} else error = t("{} is neither a contact nor a switch!",tile);
|
} else error = t("{} is neither a contact nor a switch!",tile);
|
||||||
}
|
}
|
||||||
return properties(error);
|
return context().properties(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user