now remembering last clicked tabs
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.3.45</version>
|
<version>1.3.46</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>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var mode = null;
|
|||||||
var messageTimer = null;
|
var messageTimer = null;
|
||||||
var messageOpacity = 0;
|
var messageOpacity = 0;
|
||||||
var pendingAssignment = null;
|
var pendingAssignment = null;
|
||||||
var lastTab = null;
|
var clickHistory = [];
|
||||||
|
|
||||||
function addClass(data){
|
function addClass(data){
|
||||||
parts = data.split(" ");
|
parts = data.split(" ");
|
||||||
@@ -39,17 +39,23 @@ function arrangeTabs(){
|
|||||||
|
|
||||||
tabs.insertAfter($('.swapbtn'));
|
tabs.insertAfter($('.swapbtn'));
|
||||||
var target = null;
|
var target = null;
|
||||||
|
var index = null;
|
||||||
$('.window > fieldset > legend').each(function(){
|
$('.window > fieldset > legend').each(function(){
|
||||||
var fs = this.parentNode;
|
var fs = this.parentNode;
|
||||||
if (!fs.id) fs.id = winId+id;
|
if (!fs.id) fs.id = winId+id;
|
||||||
if (fs.id == lastTab) target = this;
|
var i = clickHistory.indexOf(fs.id);
|
||||||
|
if (i>-1 && (index == null || i<index)) {
|
||||||
|
index = i;
|
||||||
|
target = this;
|
||||||
|
}
|
||||||
|
//if (fs.id == lastTab) target = this;
|
||||||
$(this).appendTo(tabs).click(fs.id,clickLegend);
|
$(this).appendTo(tabs).click(fs.id,clickLegend);
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
$(fs).hide();
|
$(fs).hide();
|
||||||
} else $(this).addClass('front');
|
} else $(this).addClass('front');
|
||||||
id++;
|
id++;
|
||||||
});
|
});
|
||||||
if (target != null) clickLegend({'data':lastTab,'target':target});
|
if (index != null) clickLegend({'data':clickHistory[index],'target':target,'no-update':true});
|
||||||
}
|
}
|
||||||
|
|
||||||
function assign(context){
|
function assign(context){
|
||||||
@@ -65,6 +71,7 @@ function clickLegend(ev){
|
|||||||
$(ev.target).addClass('front');
|
$(ev.target).addClass('front');
|
||||||
$('.window > fieldset').hide();
|
$('.window > fieldset').hide();
|
||||||
$('#'+lastTab).show();
|
$('#'+lastTab).show();
|
||||||
|
if (!('no-update' in ev)) remember(lastTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickTile(x,y,shift){
|
function clickTile(x,y,shift){
|
||||||
@@ -211,6 +218,13 @@ function planClick(ev){
|
|||||||
console.log('unknown action "'+mode+'" @ ('+ev.clientX+','+ev.clientY+')');
|
console.log('unknown action "'+mode+'" @ ('+ev.clientX+','+ev.clientY+')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remember(lastClickedId){
|
||||||
|
console.log("lastClickedId: "+lastClickedId)
|
||||||
|
var index = clickHistory.indexOf(lastClickedId);
|
||||||
|
if (index > -1) clickHistory.splice(index, 1);
|
||||||
|
clickHistory.unshift(lastClickedId);
|
||||||
|
}
|
||||||
|
|
||||||
function remove(id){
|
function remove(id){
|
||||||
$('#'+id).remove();
|
$('#'+id).remove();
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ disabled routes : deaktivierte Fahrstraßen
|
|||||||
DisableEnableBlock : Block (de)aktivieren
|
DisableEnableBlock : Block (de)aktivieren
|
||||||
Display "{}" on {}. : „{}“ auf {} anzeigen.
|
Display "{}" on {}. : „{}“ auf {} anzeigen.
|
||||||
Drop : Verwerfen
|
Drop : Verwerfen
|
||||||
|
Drop brake times : Bremszeiten löschen
|
||||||
Dropped destination of {}. : Ziel von {} verworfen.
|
Dropped destination of {}. : Ziel von {} verworfen.
|
||||||
1) Duration between 5 {} steps during brake process. : 1) Zeit zwischen 5 {}-Schritten beim Bremsvorgang.
|
1) Duration between 5 {} steps during brake process. : 1) Zeit zwischen 5 {}-Schritten beim Bremsvorgang.
|
||||||
EAST : Osten
|
EAST : Osten
|
||||||
|
|||||||
@@ -440,13 +440,12 @@ public abstract class BaseClass implements Constants{
|
|||||||
formInputs.add(new AbstractMap.SimpleEntry<String, Tag>(t("Notes"),new TextArea(NOTES,notes)));
|
formInputs.add(new AbstractMap.SimpleEntry<String, Tag>(t("Notes"),new TextArea(NOTES,notes)));
|
||||||
|
|
||||||
form(getClass().getSimpleName()+"-prop-form",formInputs)
|
form(getClass().getSimpleName()+"-prop-form",formInputs)
|
||||||
.addTo(new Fieldset(t("Basic properties")))
|
.addTo(new Fieldset(t("Basic properties")).id("props-basic"))
|
||||||
.addTo(win);
|
.addTo(win);
|
||||||
|
|
||||||
postForm.forEach(fieldset -> fieldset.addTo(win));
|
postForm.forEach(fieldset -> fieldset.addTo(win));
|
||||||
|
|
||||||
Fieldset customFields = new Fieldset(t("custom fields"));
|
Fieldset customFields = new Fieldset(t("custom fields")).id("props-custom");
|
||||||
customFields.attr("id", "custom");
|
|
||||||
|
|
||||||
Form customForm = new Form(CUSTOM_FIELDS);
|
Form customForm = new Form(CUSTOM_FIELDS);
|
||||||
new Input(ACTION, ACTION_UPDATE).hideIn(customForm);
|
new Input(ACTION, ACTION_UPDATE).hideIn(customForm);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public class Locomotive extends Car implements Constants,Device{
|
|||||||
|
|
||||||
HashMap<String,Object> params = new HashMap<String, Object>(Map.of(REALM,realm,ID,id));
|
HashMap<String,Object> params = new HashMap<String, Object>(Map.of(REALM,realm,ID,id));
|
||||||
|
|
||||||
Fieldset fieldset = new Fieldset(t("Control"));
|
Fieldset fieldset = new Fieldset(t("Control")).id("props-cockpit");
|
||||||
fieldset.clazz("cockpit");
|
fieldset.clazz("cockpit");
|
||||||
|
|
||||||
new Tag("span").content(t("Current velocity: {} {}",speed,speedUnit)).addTo(fieldset);
|
new Tag("span").content(t("Current velocity: {} {}",speed,speedUnit)).addTo(fieldset);
|
||||||
@@ -316,7 +316,7 @@ public class Locomotive extends Car implements Constants,Device{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Fieldset programming() {
|
private Fieldset programming() {
|
||||||
Fieldset fieldset = new Fieldset(t("Programming"));
|
Fieldset fieldset = new Fieldset(t("Programming")).id("props-cv");
|
||||||
|
|
||||||
Form form = new Form("cv-form");
|
Form form = new Form("cv-form");
|
||||||
new Input(REALM,REALM_LOCO).hideIn(form);
|
new Input(REALM,REALM_LOCO).hideIn(form);
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Fieldset blockHistory() {
|
private Fieldset blockHistory() {
|
||||||
Fieldset fieldset = new Fieldset(t("Last blocks"));
|
Fieldset fieldset = new Fieldset(t("Last blocks")).id("props-history");
|
||||||
Tag list = new Tag("ol");
|
Tag list = new Tag("ol");
|
||||||
for (int i=lastBlocks.size(); i>0; i--) {
|
for (int i=lastBlocks.size(); i>0; i--) {
|
||||||
lastBlocks.get(i-1).link().addTo(new Tag("li")).addTo(list);
|
lastBlocks.get(i-1).link().addTo(new Tag("li")).addTo(list);
|
||||||
@@ -239,7 +239,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Fieldset brakeTimes() {
|
private Fieldset brakeTimes() {
|
||||||
Fieldset fieldset = new Fieldset(t("Brake time table"));
|
Fieldset fieldset = new Fieldset(t("Brake time table")).id("props-times");
|
||||||
Table timeTable = new Table();
|
Table timeTable = new Table();
|
||||||
timeTable.addRow(t("forward"),t("backward"),t("Route"));
|
timeTable.addRow(t("forward"),t("backward"),t("Route"));
|
||||||
List<Route> routes = BaseClass.listElements(Route.class);
|
List<Route> routes = BaseClass.listElements(Route.class);
|
||||||
@@ -698,7 +698,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
formInputs.add(t("Tags"), new Input(TAGS,String.join(", ", tags)));
|
formInputs.add(t("Tags"), new Input(TAGS,String.join(", ", tags)));
|
||||||
|
|
||||||
if (this.hasLoco()) preForm.add(Locomotive.cockpit(this));
|
if (this.hasLoco()) preForm.add(Locomotive.cockpit(this));
|
||||||
postForm.add(propList.addTo(new Fieldset(t("other train properties")).attr("id", "train-props")));
|
postForm.add(propList.addTo(new Fieldset(t("other train properties")).id("props-other")));
|
||||||
postForm.add(brakeTimes());
|
postForm.add(brakeTimes());
|
||||||
postForm.add(blockHistory());
|
postForm.add(blockHistory());
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ public abstract class Block extends StretchableTile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Fieldset contactForm() {
|
private Fieldset contactForm() {
|
||||||
Fieldset fieldset = new Fieldset(t("internal contacts"));
|
Fieldset fieldset = new Fieldset(t("internal contacts")).id("props-contacts");
|
||||||
this.button(t("new contact"), Map.of(ACTION,ACTION_ADD_CONTACT)).addTo(fieldset);
|
this.button(t("new contact"), Map.of(ACTION,ACTION_ADD_CONTACT)).addTo(fieldset);
|
||||||
if (!internalContacts.isEmpty()) {
|
if (!internalContacts.isEmpty()) {
|
||||||
Tag ul = new Tag("ul");
|
Tag ul = new Tag("ul");
|
||||||
@@ -455,7 +455,7 @@ public abstract class Block extends StretchableTile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Fieldset waitTimeForm() {
|
public Fieldset waitTimeForm() {
|
||||||
Fieldset win = new Fieldset(t("Wait times"));
|
Fieldset win = new Fieldset(t("Wait times")).id("props-times");
|
||||||
Form form = new Form("train-wait-form");
|
Form form = new Form("train-wait-form");
|
||||||
new Tag("h4").content(t("Stop settings")).addTo(win);
|
new Tag("h4").content(t("Stop settings")).addTo(win);
|
||||||
new Input(REALM,REALM_PLAN).hideIn(form);
|
new Input(REALM,REALM_PLAN).hideIn(form);
|
||||||
|
|||||||
@@ -197,8 +197,7 @@ public class Contact extends Tile{
|
|||||||
button(t("learn"),Map.of(ACTION,ACTION_ANALYZE)).addTo(span);
|
button(t("learn"),Map.of(ACTION,ACTION_ANALYZE)).addTo(span);
|
||||||
formInputs.add(t("Address"),span);
|
formInputs.add(t("Address"),span);
|
||||||
|
|
||||||
Fieldset fieldset = new Fieldset(t("Actions"));
|
Fieldset fieldset = new Fieldset(t("Actions")).id("props-actions");
|
||||||
fieldset.id("actions");
|
|
||||||
actions.list().addTo(fieldset);
|
actions.list().addTo(fieldset);
|
||||||
postForm.add(fieldset);
|
postForm.add(fieldset);
|
||||||
return super.properties(preForm, formInputs, postForm);
|
return super.properties(preForm, formInputs, postForm);
|
||||||
|
|||||||
@@ -128,8 +128,7 @@ public abstract class Signal extends Tile {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||||
Fieldset aspectEditor = new Fieldset(t("Aspects"));
|
Fieldset aspectEditor = new Fieldset(t("Aspects")).id("props-aspects");
|
||||||
aspectEditor.attr(ID, "aspect-editor");
|
|
||||||
Form form = new Form("aspect-form");
|
Form form = new Form("aspect-form");
|
||||||
new Input(REALM,REALM_PLAN).hideIn(form);
|
new Input(REALM,REALM_PLAN).hideIn(form);
|
||||||
new Input(ACTION,ACTION_UPDATE).hideIn(form);
|
new Input(ACTION,ACTION_UPDATE).hideIn(form);
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile>{
|
|||||||
if (isSet(train.route())) {
|
if (isSet(train.route())) {
|
||||||
train.button(t("stop"), Map.of(ACTION,ACTION_STOP)).addTo(fieldset);
|
train.button(t("stop"), Map.of(ACTION,ACTION_STOP)).addTo(fieldset);
|
||||||
} else {
|
} else {
|
||||||
train.button(t("start"), Map.of(ACTION,ACTION_START)).addTo(fieldset);
|
train.button(t("depart"), Map.of(ACTION,ACTION_START)).addTo(fieldset);
|
||||||
}
|
}
|
||||||
if (train.usesAutopilot()) {
|
if (train.usesAutopilot()) {
|
||||||
train.button(t("quit autopilot"), Map.of(ACTION,ACTION_QUIT)).addTo(fieldset);
|
train.button(t("quit autopilot"), Map.of(ACTION,ACTION_QUIT)).addTo(fieldset);
|
||||||
@@ -300,7 +300,7 @@ public abstract class Tile extends BaseClass implements Comparable<Tile>{
|
|||||||
|
|
||||||
|
|
||||||
if (!routes.isEmpty()) {
|
if (!routes.isEmpty()) {
|
||||||
fieldset = new Fieldset(t("Routes"));
|
fieldset = new Fieldset(t("Routes")).id("props-routes");
|
||||||
Tag routeList = new Tag("ol");
|
Tag routeList = new Tag("ol");
|
||||||
boolean empty = true;
|
boolean empty = true;
|
||||||
for (Route route : routes) {
|
for (Route route : routes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user