Browse Source

UI work

lookup-tables
Stephan Richter 5 years ago
parent
commit
2e6f0c9708
  1. 2
      pom.xml
  2. 16
      resources/css/style.css
  3. 3
      resources/svg/Contact.svg
  4. 38
      src/main/java/de/srsoftware/web4rail/Plan.java

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>0.10.10</version> <version>0.10.11</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>

16
resources/css/style.css

@ -113,10 +113,11 @@ svg circle{
.menu > div > .list{ .menu > div > .list{
position: fixed; position: fixed;
height: 30px; left: 5%;
bottom: 50px; bottom: 50px;
width: 100%; width: 90%;
z-index: 10; z-index: 10;
padding-top: 50px;
} }
.menu > div > .list > *{ .menu > div > .list > *{
@ -152,6 +153,17 @@ h2{
font-size: 30px; font-size: 30px;
background: red; background: red;
color: white; color: white;
width: 40px;
height: 40px;
text-align: center;
}
.actions .list > div,
.hardware .list > div,
.help .list > div,
.trains .list > div{
padding: 5px;
height: unset;
} }
.closebtn{ .closebtn{

3
resources/svg/Contact.svg

@ -0,0 +1,3 @@
<svg width="100" height="100" viewbox="0 0 %width% 100">
<circle cx="50" cy="50" r="25" />
</svg>

After

Width:  |  Height:  |  Size: 98 B

38
src/main/java/de/srsoftware/web4rail/Plan.java

@ -160,21 +160,6 @@ public class Plan extends BaseClass{
return t("Unknown action: {}",params.get(ACTION)); return t("Unknown action: {}",params.get(ACTION));
} }
/**
* generates the action menu that is appended to the plan
* @return
* @throws IOException
*/
private Tag actionMenu() throws IOException {
Tag actionMenu = new Tag("div").clazz("actions").content(t("Actions"));
Tag actions = new Tag("div").clazz("list").content("");
new Div(ACTION_POWER).clazz(REALM_CU).content(t("Toggle power")).addTo(actions);
new Div(ACTION_SAVE).clazz(REALM_PLAN).content(t("Save plan")).addTo(actions);
new Div(ACTION_ANALYZE).clazz(REALM_PLAN).content(t("Analyze plan")).addTo(actions);
new Div(ACTION_QR).clazz(REALM_PLAN).content(t("QR-Code")).addTo(actions);
return actions.addTo(actionMenu);
}
/** /**
* attaches a new client to the event stream of the plan * attaches a new client to the event stream of the plan
* @param client * @param client
@ -335,6 +320,7 @@ public class Plan extends BaseClass{
private Tag hardwareMenu() throws IOException { private Tag hardwareMenu() throws IOException {
Tag tileMenu = new Tag("div").clazz("hardware").content(t("Hardware")); Tag tileMenu = new Tag("div").clazz("hardware").content(t("Hardware"));
Tag list = new Tag("div").clazz("list").content(""); Tag list = new Tag("div").clazz("list").content("");
new Div(ACTION_POWER).clazz(REALM_CU).content(t("Toggle power")).addTo(list);
new Div(ACTION_PROPS).clazz(REALM_CU).content(t("Control unit")).addTo(list); new Div(ACTION_PROPS).clazz(REALM_CU).content(t("Control unit")).addTo(list);
return list.addTo(tileMenu); return list.addTo(tileMenu);
} }
@ -435,11 +421,11 @@ public class Plan extends BaseClass{
private Tag menu() throws IOException { private Tag menu() throws IOException {
Tag menu = new Tag("div").clazz("menu"); Tag menu = new Tag("div").clazz("menu");
new Tag("div").clazz("emergency").content(t("Emergency")).attr("onclick","return request({realm:'"+REALM_CU+"',action:'"+ACTION_EMERGENCY+"'});").addTo(menu); new Tag("div").clazz("emergency").content(t("Emergency")).attr("onclick","return request({realm:'"+REALM_CU+"',action:'"+ACTION_EMERGENCY+"'});").addTo(menu);
actionMenu().addTo(menu);
moveMenu().addTo(menu); moveMenu().addTo(menu);
planMenu().addTo(menu);
hardwareMenu().addTo(menu);
tileMenu().addTo(menu); tileMenu().addTo(menu);
trainMenu().addTo(menu); trainMenu().addTo(menu);
hardwareMenu().addTo(menu);
help().addTo(menu); help().addTo(menu);
return menu; return menu;
} }
@ -558,6 +544,20 @@ public class Plan extends BaseClass{
} }
return tile; return tile;
} }
/**
* generates the action menu that is appended to the plan
* @return
* @throws IOException
*/
private Tag planMenu() throws IOException {
Tag actionMenu = new Tag("div").clazz("actions").content(t("Plan"));
Tag actions = new Tag("div").clazz("list").content("");
new Div(ACTION_SAVE).clazz(REALM_PLAN).content(t("Save")).addTo(actions);
new Div(ACTION_ANALYZE).clazz(REALM_PLAN).content(t("Analyze")).addTo(actions);
new Div(ACTION_QR).clazz(REALM_PLAN).content(t("QR-Code")).addTo(actions);
return actions.addTo(actionMenu);
}
/** /**
* adds a command to the control unit's command queue * adds a command to the control unit's command queue
@ -754,6 +754,8 @@ public class Plan extends BaseClass{
Tag tileMenu = new Tag("div").clazz("addtile").title(t("Add tile")).content("╦"); Tag tileMenu = new Tag("div").clazz("addtile").title(t("Add tile")).content("╦");
Tag tiles = new Tag("div").clazz("list").content(""); Tag tiles = new Tag("div").clazz("list").content("");
new CrossV().tag(null).addTo(tiles);
new CrossH().tag(null).addTo(tiles);
new StraightH().tag(null).addTo(tiles); new StraightH().tag(null).addTo(tiles);
new StraightV().tag(null).addTo(tiles); new StraightV().tag(null).addTo(tiles);
new ContactH().tag(null).addTo(tiles); new ContactH().tag(null).addTo(tiles);
@ -781,8 +783,6 @@ public class Plan extends BaseClass{
new TurnoutLW().tag(null).addTo(tiles); new TurnoutLW().tag(null).addTo(tiles);
new TurnoutLE().tag(null).addTo(tiles); new TurnoutLE().tag(null).addTo(tiles);
new Turnout3E().tag(null).addTo(tiles); new Turnout3E().tag(null).addTo(tiles);
new CrossH().tag(null).addTo(tiles);
new CrossV().tag(null).addTo(tiles);
new Relay().setLabel(true,"RL").tag(null).addTo(tiles); new Relay().setLabel(true,"RL").tag(null).addTo(tiles);
new Eraser().tag(null).addTo(tiles); new Eraser().tag(null).addTo(tiles);
return tiles.addTo(tileMenu); return tiles.addTo(tileMenu);

Loading…
Cancel
Save