preparing control unit setup
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>0.4.1</version>
|
<version>0.4.2</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
<url>https://github.com/StephanRichter/Web4Rail</url>
|
<url>https://github.com/StephanRichter/Web4Rail</url>
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ window.onload = function () {
|
|||||||
$('.menu .move .list div').click(enableMove);
|
$('.menu .move .list div').click(enableMove);
|
||||||
$('.menu .actions .list > div').click(runAction);
|
$('.menu .actions .list > div').click(runAction);
|
||||||
$('.menu .trains .list > div').click(runAction);
|
$('.menu .trains .list > div').click(runAction);
|
||||||
|
$('.menu .hardware .list > div').click(runAction);
|
||||||
$(PLAN).click(planClick);
|
$(PLAN).click(planClick);
|
||||||
(new EventSource("stream")).onmessage = stream;
|
(new EventSource("stream")).onmessage = stream;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ public class Plan {
|
|||||||
public static final String ACTION_ADD_LOCO = "addLoco";
|
public static final String ACTION_ADD_LOCO = "addLoco";
|
||||||
public static final String ACTION_ADD_TRAIN = "addTrain";
|
public static final String ACTION_ADD_TRAIN = "addTrain";
|
||||||
public static final String ACTION_UPDATE_CAR = "updateCar";
|
public static final String ACTION_UPDATE_CAR = "updateCar";
|
||||||
|
private static final String ACTION_CONTROL_UNIT = "controlProps";
|
||||||
|
|
||||||
public HashMap<String,Tile> tiles = new HashMap<String,Tile>();
|
public HashMap<String,Tile> tiles = new HashMap<String,Tile>();
|
||||||
private HashSet<Block> blocks = new HashSet<Block>();
|
private HashSet<Block> blocks = new HashSet<Block>();
|
||||||
@@ -123,10 +124,10 @@ public class Plan {
|
|||||||
|
|
||||||
private Tag actionMenu() throws IOException {
|
private Tag actionMenu() throws IOException {
|
||||||
Tag tileMenu = new Tag("div").clazz("actions").content(t("Actions"));
|
Tag tileMenu = new Tag("div").clazz("actions").content(t("Actions"));
|
||||||
StringBuffer tiles = new StringBuffer();
|
Tag tiles = new Tag("div").clazz("list").content("");
|
||||||
tiles.append(new Div("save").content(t("Save plan")));
|
new Div("save").content(t("Save plan")).addTo(tiles);
|
||||||
tiles.append(new Div("analyze").content(t("Analyze plan")));
|
new Div("analyze").content(t("Analyze plan")).addTo(tiles);
|
||||||
return new Tag("div").clazz("list").content(tiles.toString()).addTo(tileMenu);
|
return tiles.addTo(tileMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addClient(OutputStreamWriter client) {
|
public void addClient(OutputStreamWriter client) {
|
||||||
@@ -234,6 +235,14 @@ public class Plan {
|
|||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Tag hardwareMenu() throws IOException {
|
||||||
|
Tag tileMenu = new Tag("div").clazz("hardware").content(t("Hardware"));
|
||||||
|
Tag list = new Tag("div").clazz("list").content("");
|
||||||
|
new Div(ACTION_CONTROL_UNIT).content(t("Control unit")).addTo(list);
|
||||||
|
return list.addTo(tileMenu);
|
||||||
|
}
|
||||||
|
|
||||||
private Tag heartbeat() {
|
private Tag heartbeat() {
|
||||||
return new Div("heartbeat").content("");
|
return new Div("heartbeat").content("");
|
||||||
}
|
}
|
||||||
@@ -295,6 +304,7 @@ public class Plan {
|
|||||||
moveMenu().addTo(menu);
|
moveMenu().addTo(menu);
|
||||||
tileMenu().addTo(menu);
|
tileMenu().addTo(menu);
|
||||||
trainMenu().addTo(menu);
|
trainMenu().addTo(menu);
|
||||||
|
hardwareMenu().addTo(menu);
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,12 +314,12 @@ public class Plan {
|
|||||||
|
|
||||||
private Tag moveMenu() {
|
private Tag moveMenu() {
|
||||||
Tag tileMenu = new Tag("div").clazz("move").title(t("Move tiles")).content(t("↹"));
|
Tag tileMenu = new Tag("div").clazz("move").title(t("Move tiles")).content(t("↹"));
|
||||||
StringBuffer tiles = new StringBuffer();
|
Tag tiles = new Tag("div").clazz("list").content("");
|
||||||
tiles.append(new Div("west").title(t("Move west")).content("↤"));
|
new Div("west").title(t("Move west")).content("↤").addTo(tiles);
|
||||||
tiles.append(new Div("east").title(t("Move east")).content("↦"));
|
new Div("east").title(t("Move east")).content("↦").addTo(tiles);
|
||||||
tiles.append(new Div("north").title(t("Move north")).content("↥"));
|
new Div("north").title(t("Move north")).content("↥").addTo(tiles);
|
||||||
tiles.append(new Div("south").title(t("Move south")).content("↧"));
|
new Div("south").title(t("Move south")).content("↧").addTo(tiles);
|
||||||
return new Tag("div").clazz("list").content(tiles.toString()).addTo(tileMenu);
|
return tiles.addTo(tileMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String moveTile(String direction, String tileId) throws NumberFormatException, IOException {
|
private String moveTile(String direction, String tileId) throws NumberFormatException, IOException {
|
||||||
@@ -517,46 +527,46 @@ public class Plan {
|
|||||||
private Tag tileMenu() throws IOException {
|
private Tag tileMenu() throws IOException {
|
||||||
Tag tileMenu = new Tag("div").clazz("addtile").title(t("Add tile")).content("◫");
|
Tag tileMenu = new Tag("div").clazz("addtile").title(t("Add tile")).content("◫");
|
||||||
|
|
||||||
StringBuffer tiles = new StringBuffer();
|
Tag tiles = new Tag("div").clazz("list").content("");
|
||||||
tiles.append(new StraightH().tag(null));
|
new StraightH().tag(null).addTo(tiles);
|
||||||
tiles.append(new StraightV().tag(null));
|
new StraightV().tag(null).addTo(tiles);
|
||||||
tiles.append(new ContactH().tag(null));
|
new ContactH().tag(null).addTo(tiles);
|
||||||
tiles.append(new ContactV().tag(null));
|
new ContactV().tag(null).addTo(tiles);
|
||||||
tiles.append(new SignalW().tag(null));
|
new SignalW().tag(null).addTo(tiles);
|
||||||
tiles.append(new SignalE().tag(null));
|
new SignalE().tag(null).addTo(tiles);
|
||||||
tiles.append(new SignalS().tag(null));
|
new SignalS().tag(null).addTo(tiles);
|
||||||
tiles.append(new SignalN().tag(null));
|
new SignalN().tag(null).addTo(tiles);
|
||||||
tiles.append(new BlockH().tag(null));
|
new BlockH().tag(null).addTo(tiles);
|
||||||
tiles.append(new BlockV().tag(null));
|
new BlockV().tag(null).addTo(tiles);
|
||||||
tiles.append(new DiagES().tag(null));
|
new DiagES().tag(null).addTo(tiles);
|
||||||
tiles.append(new DiagSW().tag(null));
|
new DiagSW().tag(null).addTo(tiles);
|
||||||
tiles.append(new DiagNE().tag(null));
|
new DiagNE().tag(null).addTo(tiles);
|
||||||
tiles.append(new DiagWN().tag(null));
|
new DiagWN().tag(null).addTo(tiles);
|
||||||
tiles.append(new EndE().tag(null));
|
new EndE().tag(null).addTo(tiles);
|
||||||
tiles.append(new EndW().tag(null));
|
new EndW().tag(null).addTo(tiles);
|
||||||
tiles.append(new EndN().tag(null));
|
new EndN().tag(null).addTo(tiles);
|
||||||
tiles.append(new EndS().tag(null));
|
new EndS().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutRS().tag(null));
|
new TurnoutRS().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutRN().tag(null));
|
new TurnoutRN().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutRW().tag(null));
|
new TurnoutRW().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutRE().tag(null));
|
new TurnoutRE().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutLN().tag(null));
|
new TurnoutLN().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutLS().tag(null));
|
new TurnoutLS().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutLW().tag(null));
|
new TurnoutLW().tag(null).addTo(tiles);
|
||||||
tiles.append(new TurnoutLE().tag(null));
|
new TurnoutLE().tag(null).addTo(tiles);
|
||||||
tiles.append(new Turnout3E().tag(null));
|
new Turnout3E().tag(null).addTo(tiles);
|
||||||
tiles.append(new CrossH().tag(null));
|
new CrossH().tag(null).addTo(tiles);
|
||||||
tiles.append(new CrossV().tag(null));
|
new CrossV().tag(null).addTo(tiles);
|
||||||
tiles.append(new Eraser().tag(null));
|
new Eraser().tag(null).addTo(tiles);
|
||||||
return new Tag("div").clazz("list").content(tiles.toString()).addTo(tileMenu);
|
return tiles.addTo(tileMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tag trainMenu() throws IOException {
|
private Tag trainMenu() throws IOException {
|
||||||
Tag tileMenu = new Tag("div").clazz("trains").content(t("Trains"));
|
Tag tileMenu = new Tag("div").clazz("trains").content(t("Trains"));
|
||||||
StringBuffer tiles = new StringBuffer();
|
Tag tiles = new Tag("div").clazz("list").content("");
|
||||||
tiles.append(new Div("trains").content(t("Manage trains")));
|
new Div(ACTION_TRAINS).content(t("Manage trains")).addTo(tiles);
|
||||||
tiles.append(new Div("locos").content(t("Manage locos")));
|
new Div(ACTION_LOCOS).content(t("Manage locos")).addTo(tiles);
|
||||||
return new Tag("div").clazz("list").content(tiles.toString()).addTo(tileMenu);
|
return tiles.addTo(tileMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object update(HashMap<String, String> params) throws IOException {
|
private Object update(HashMap<String, String> params) throws IOException {
|
||||||
|
|||||||
@@ -104,8 +104,7 @@ public class Locomotive extends Car {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpeed(int v) {
|
public void setSpeed(int v) {
|
||||||
// TODO Auto-generated method stub
|
LOG.debug("{}.setSpeed({})",this,v);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user