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>
|
||||
<groupId>de.srsoftware</groupId>
|
||||
<artifactId>web4rail</artifactId>
|
||||
<version>1.3.45</version>
|
||||
<version>1.3.46</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -14,7 +14,7 @@ var mode = null;
|
||||
var messageTimer = null;
|
||||
var messageOpacity = 0;
|
||||
var pendingAssignment = null;
|
||||
var lastTab = null;
|
||||
var clickHistory = [];
|
||||
|
||||
function addClass(data){
|
||||
parts = data.split(" ");
|
||||
@@ -39,17 +39,23 @@ function arrangeTabs(){
|
||||
|
||||
tabs.insertAfter($('.swapbtn'));
|
||||
var target = null;
|
||||
var index = null;
|
||||
$('.window > fieldset > legend').each(function(){
|
||||
var fs = this.parentNode;
|
||||
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);
|
||||
if (id > 0) {
|
||||
$(fs).hide();
|
||||
} else $(this).addClass('front');
|
||||
id++;
|
||||
});
|
||||
if (target != null) clickLegend({'data':lastTab,'target':target});
|
||||
if (index != null) clickLegend({'data':clickHistory[index],'target':target,'no-update':true});
|
||||
}
|
||||
|
||||
function assign(context){
|
||||
@@ -65,6 +71,7 @@ function clickLegend(ev){
|
||||
$(ev.target).addClass('front');
|
||||
$('.window > fieldset').hide();
|
||||
$('#'+lastTab).show();
|
||||
if (!('no-update' in ev)) remember(lastTab);
|
||||
}
|
||||
|
||||
function clickTile(x,y,shift){
|
||||
@@ -211,6 +218,13 @@ function planClick(ev){
|
||||
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){
|
||||
$('#'+id).remove();
|
||||
return false;
|
||||
|
||||
@@ -128,6 +128,7 @@ disabled routes : deaktivierte Fahrstraßen
|
||||
DisableEnableBlock : Block (de)aktivieren
|
||||
Display "{}" on {}. : „{}“ auf {} anzeigen.
|
||||
Drop : Verwerfen
|
||||
Drop brake times : Bremszeiten löschen
|
||||
Dropped destination of {}. : Ziel von {} verworfen.
|
||||
1) Duration between 5 {} steps during brake process. : 1) Zeit zwischen 5 {}-Schritten beim Bremsvorgang.
|
||||
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)));
|
||||
|
||||
form(getClass().getSimpleName()+"-prop-form",formInputs)
|
||||
.addTo(new Fieldset(t("Basic properties")))
|
||||
.addTo(new Fieldset(t("Basic properties")).id("props-basic"))
|
||||
.addTo(win);
|
||||
|
||||
postForm.forEach(fieldset -> fieldset.addTo(win));
|
||||
|
||||
Fieldset customFields = new Fieldset(t("custom fields"));
|
||||
customFields.attr("id", "custom");
|
||||
Fieldset customFields = new Fieldset(t("custom fields")).id("props-custom");
|
||||
|
||||
Form customForm = new Form(CUSTOM_FIELDS);
|
||||
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));
|
||||
|
||||
Fieldset fieldset = new Fieldset(t("Control"));
|
||||
Fieldset fieldset = new Fieldset(t("Control")).id("props-cockpit");
|
||||
fieldset.clazz("cockpit");
|
||||
|
||||
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() {
|
||||
Fieldset fieldset = new Fieldset(t("Programming"));
|
||||
Fieldset fieldset = new Fieldset(t("Programming")).id("props-cv");
|
||||
|
||||
Form form = new Form("cv-form");
|
||||
new Input(REALM,REALM_LOCO).hideIn(form);
|
||||
|
||||
@@ -217,7 +217,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
}
|
||||
|
||||
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");
|
||||
for (int i=lastBlocks.size(); i>0; i--) {
|
||||
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() {
|
||||
Fieldset fieldset = new Fieldset(t("Brake time table"));
|
||||
Fieldset fieldset = new Fieldset(t("Brake time table")).id("props-times");
|
||||
Table timeTable = new Table();
|
||||
timeTable.addRow(t("forward"),t("backward"),t("Route"));
|
||||
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)));
|
||||
|
||||
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(blockHistory());
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ public abstract class Block extends StretchableTile{
|
||||
}
|
||||
|
||||
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);
|
||||
if (!internalContacts.isEmpty()) {
|
||||
Tag ul = new Tag("ul");
|
||||
@@ -455,7 +455,7 @@ public abstract class Block extends StretchableTile{
|
||||
}
|
||||
|
||||
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");
|
||||
new Tag("h4").content(t("Stop settings")).addTo(win);
|
||||
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);
|
||||
formInputs.add(t("Address"),span);
|
||||
|
||||
Fieldset fieldset = new Fieldset(t("Actions"));
|
||||
fieldset.id("actions");
|
||||
Fieldset fieldset = new Fieldset(t("Actions")).id("props-actions");
|
||||
actions.list().addTo(fieldset);
|
||||
postForm.add(fieldset);
|
||||
return super.properties(preForm, formInputs, postForm);
|
||||
|
||||
@@ -128,8 +128,7 @@ public abstract class Signal extends Tile {
|
||||
|
||||
@Override
|
||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm) {
|
||||
Fieldset aspectEditor = new Fieldset(t("Aspects"));
|
||||
aspectEditor.attr(ID, "aspect-editor");
|
||||
Fieldset aspectEditor = new Fieldset(t("Aspects")).id("props-aspects");
|
||||
Form form = new Form("aspect-form");
|
||||
new Input(REALM,REALM_PLAN).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())) {
|
||||
train.button(t("stop"), Map.of(ACTION,ACTION_STOP)).addTo(fieldset);
|
||||
} 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()) {
|
||||
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()) {
|
||||
fieldset = new Fieldset(t("Routes"));
|
||||
fieldset = new Fieldset(t("Routes")).id("props-routes");
|
||||
Tag routeList = new Tag("ol");
|
||||
boolean empty = true;
|
||||
for (Route route : routes) {
|
||||
|
||||
Reference in New Issue
Block a user