bugfixes, improved action framework, added actions
This commit is contained in:
@@ -58,8 +58,8 @@ public abstract class Block extends StretchableTile{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag propForm() {
|
||||
Tag form = super.propForm();
|
||||
public Tag propForm(String id) {
|
||||
Tag form = super.propForm(id);
|
||||
|
||||
new Input(NAME, name).addTo(new Label(t("name:")+" ")).addTo(new Tag("p")).addTo(form);
|
||||
|
||||
@@ -119,7 +119,12 @@ public abstract class Block extends StretchableTile{
|
||||
if (params.containsKey(NAME)) name=params.get(NAME);
|
||||
if (params.containsKey(TRAIN)) {
|
||||
long trainId = Long.parseLong(params.get(TRAIN));
|
||||
train(trainId == 0 ? null : Train.get(trainId));
|
||||
Train t = Train.get(trainId);
|
||||
if (t != null) {
|
||||
Block oldBlock = t.block();
|
||||
if (oldBlock != null) oldBlock.train(null);
|
||||
train(t);
|
||||
}
|
||||
}
|
||||
turnAllowed = params.containsKey(ALLOW_TURN) && params.get(ALLOW_TURN).equals("on");
|
||||
return this;
|
||||
|
||||
@@ -34,8 +34,8 @@ public abstract class StretchableTile extends Tile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag propForm() {
|
||||
Tag form = super.propForm();
|
||||
public Tag propForm(String id) {
|
||||
Tag form = super.propForm(id);
|
||||
|
||||
Tag label = new Tag("label").content(t("length:"));
|
||||
new Tag("input").attr("type", "number").attr("name","length").attr("value", length).addTo(label);
|
||||
|
||||
@@ -180,8 +180,8 @@ public abstract class Tile implements Constants{
|
||||
return new Vector<Plan.Direction>();
|
||||
}
|
||||
|
||||
public Tag propForm() {
|
||||
Form form = new Form();
|
||||
public Tag propForm(String id) {
|
||||
Form form = new Form(id);
|
||||
new Input(ACTION, ACTION_UPDATE).hideIn(form);
|
||||
new Input(REALM, REALM_PLAN).hideIn(form);
|
||||
new Input(ID,id()).hideIn(form);
|
||||
@@ -199,9 +199,10 @@ public abstract class Tile implements Constants{
|
||||
|
||||
public Tag propMenu() {
|
||||
Window window = new Window("tile-properties",t("Properties of {} @ ({},{})",getClass().getSimpleName(),x,y));
|
||||
Tag form = propForm();
|
||||
String formId = "tile-properties-"+id();
|
||||
Tag form = propForm(formId);
|
||||
if (form!=null && form.children().size()>3) {
|
||||
new Button(t("save")).addTo(form);
|
||||
new Button(t("save"),"submitForm('"+formId+"')").addTo(form);
|
||||
form.addTo(window);
|
||||
} else {
|
||||
window.content(t("This tile ({}) has no editable properties",getClass().getSimpleName()));
|
||||
|
||||
@@ -101,8 +101,8 @@ public abstract class Turnout extends Tile implements Device{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag propForm() {
|
||||
Tag form = super.propForm();
|
||||
public Tag propForm(String id) {
|
||||
Tag form = super.propForm(id);
|
||||
Fieldset fieldset = new Fieldset(t("Decoder settings"));
|
||||
Label protocol = new Label(t("Protocol:"));
|
||||
for (Protocol proto : Protocol.values()) {
|
||||
|
||||
@@ -34,8 +34,8 @@ public class TurnoutL extends Turnout {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag propForm() {
|
||||
Tag form = super.propForm();
|
||||
public Tag propForm(String id) {
|
||||
Tag form = super.propForm(id);
|
||||
Tag fieldset = null;
|
||||
for (Tag child : form.children()) {
|
||||
if (child.is(Fieldset.TYPE)) {
|
||||
|
||||
@@ -35,8 +35,8 @@ public class TurnoutR extends Turnout {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag propForm() {
|
||||
Tag form = super.propForm();
|
||||
public Tag propForm(String id) {
|
||||
Tag form = super.propForm(id);
|
||||
Tag fieldset = null;
|
||||
for (Tag child : form.children()) {
|
||||
if (child.is(Fieldset.TYPE)) {
|
||||
|
||||
Reference in New Issue
Block a user