various GUI improvements
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.2.41</version>
|
||||
<version>1.2.42</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -331,3 +331,14 @@ textarea.json {
|
||||
height: 33%;
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
svg.preview circle,
|
||||
svg.preview line,
|
||||
svg.preview polygon,
|
||||
svg.preview rect{
|
||||
fill:peru;
|
||||
}
|
||||
|
||||
svg.Block text{
|
||||
fill: black;
|
||||
}
|
||||
@@ -57,6 +57,7 @@ function closeMenu(ev){
|
||||
|
||||
function closeWindows(){
|
||||
$('.window').remove();
|
||||
$('.preview').removeClass('preview');
|
||||
$('#plan').css('height','').css('width','');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<svg width="100" height="100" viewbox="0 0 100 100">
|
||||
<rect x="0" y="35" width="%width%" height="30" />
|
||||
<rect class="block" x="20" y="10" width="%width%-40" height="80" />
|
||||
<text x="25" y="65" fill="red">%text%</text>
|
||||
<text x="25" y="65">%text%</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 214 B |
@@ -1,5 +1,5 @@
|
||||
<svg width="100" height="100" viewbox="0 0 100 100">
|
||||
<rect x="35" y="0" width="30" height="%height%" />
|
||||
<rect class="block" x="10" y="20" width="80" height="%height%-40" />
|
||||
<text x="25" y="65" fill="red" transform="translate(100, 0) rotate(90)">%text%</text>
|
||||
<text x="25" y="65" transform="translate(100, 0) rotate(90)">%text%</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 257 B |
@@ -165,6 +165,7 @@ PushPullTrain : Wendezug
|
||||
Push-pull train : Wendezug
|
||||
quit autopilot : Autopilot beenden
|
||||
{} reached it`s destination! : {} ist am Ziel angekommen!
|
||||
Relays and Turnouts : Relais und Weichen
|
||||
Relay/Turnout : Relais/Weiche
|
||||
Report Issue : Problem melden
|
||||
reverse : rückwärts
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Vector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
@@ -595,18 +596,30 @@ public class Plan extends BaseClass{
|
||||
new Button(t("Save"), form).addTo(form);
|
||||
form.addTo(win);
|
||||
|
||||
new Tag("h4").content(t("turnout properties")).addTo(win);
|
||||
new Tag("h4").content(t("Relays and Turnouts")).addTo(win);
|
||||
Table table = new Table();
|
||||
table.addHead(t("Address"),t("Relay/Turnout"));
|
||||
BaseClass.listElements(Tile.class)
|
||||
List<Device> devices = BaseClass.listElements(Tile.class)
|
||||
.stream()
|
||||
.filter(tile -> tile instanceof Device )
|
||||
.map(tile -> (Device) tile)
|
||||
.sorted(Comparator.comparing(Device::address))
|
||||
.forEach(turnout -> {
|
||||
table.addRow(turnout.address(),turnout);
|
||||
if (turnout.address() % 4 == 1) table.children().lastElement().clazz("group");
|
||||
});
|
||||
.collect(Collectors.toList());
|
||||
for (Device device : devices) {
|
||||
Tile tile = (Tile) device;
|
||||
table.addRow(device.address(),tile.link(tile.toString()));
|
||||
if (device.address() % 4 == 1) table.children().lastElement().clazz("group");
|
||||
|
||||
}
|
||||
table.clazz("turnouts").addTo(win);
|
||||
|
||||
new Tag("h4").content(t("Routes")).addTo(win);
|
||||
table = new Table();
|
||||
table.addHead(t("Name"),t("Start"),t("End"));
|
||||
List<Route> routes = BaseClass.listElements(Route.class);
|
||||
for (Route route : routes) {
|
||||
table.addRow(route.link("span",route.name()),route.link("span", route.startBlock()),route.link("span", route.endBlock()));
|
||||
}
|
||||
table.clazz("turnouts").addTo(win);
|
||||
|
||||
return win;
|
||||
|
||||
@@ -733,6 +733,14 @@ public class Route extends BaseClass {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Tag previewScript() {
|
||||
Tag script = new Tag("script").attr("type", "text/javascript");
|
||||
for (Tile tile : path) {
|
||||
script.content("$('#"+tile.id()+"').addClass('preview');\n");
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||
|
||||
@@ -745,7 +753,10 @@ public class Route extends BaseClass {
|
||||
postForm.add(basicProperties());
|
||||
if (!turnouts.isEmpty()) postForm.add(turnouts());
|
||||
postForm.add(brakeTimes());
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
Window win = super.properties(preForm, formInputs, postForm);
|
||||
previewScript().addTo(win);
|
||||
return win;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ public class Button extends Tag {
|
||||
|
||||
public Button(String text,Form form) {
|
||||
this(text,"return submitForm('"+form.get("id")+"');");
|
||||
form.attr("onsubmit", "return submitForm('"+form.get("id")+"');");
|
||||
}
|
||||
|
||||
public Button(String text, Map<String, ? extends Object> props) {
|
||||
|
||||
Reference in New Issue
Block a user