Closed marl0rd closed 7 years ago
Let's take the Dynamo: Display to tests...
Basically it has the following structure:
/* ********** Fields ********** */
private ObjectProperty<Paint> textFill;
private StringProperty currentText;
private ObjectProperty<DisplayFont> valueFont;
private BooleanProperty alarmed;
private StringProperty title;
private ObjectProperty<DisplayFont> titleFont;
private StringProperty unit;
private ObjectProperty<DisplayFont> unitFont;
private BooleanProperty unitVisible;
private BooleanProperty blinking;
private IntegerProperty blinkingInterval;
/* ********** Fields ********** */
private volatile ScheduledFuture<?> periodicBlinkTask;
private static ScheduledExecutorService periodicBlinkExecutorService;
/* ********** Constructor ********** */
public Display() {
getStyleClass().add("display");
textFill = new SimpleObjectProperty<>(this, "textFill", DEFAULT_TEXT_FILL);
currentText = new SimpleStringProperty(this, "currentTex", "VALUE");
valueFont = new SimpleObjectProperty<>(this, "valueFont", DEFAULT_DISPLAY_FONT);
alarmed = new SimpleBooleanProperty(this, "alarmed", false);
title = new SimpleStringProperty(this, "title", "TITLE");
titleFont = new SimpleObjectProperty<>(this, "titleFont", DEFAULT_DISPLAY_FONT);
unit = new SimpleStringProperty(this, "unit", "Unit");
unitFont = new SimpleObjectProperty<>(this, "unitFont", DEFAULT_DISPLAY_FONT);
unitVisible = new SimpleBooleanProperty(this, "unitVisible", true);
blinking = new SimpleBooleanProperty(this, "blinking", false);
blinkingInterval = new SimpleIntegerProperty(this, "blinkingInterval", DEFAULT_BLINKING_INTERVAL);
}
/* ********** Properties Setters and Getters ********** */
[....]
Let's focus on the currentText property:
private StringProperty currentText;
public String getCurrentText() {
return currentText.get();
}
public StringProperty currentTextProperty() {
return currentText;
}
public void setCurrentText(String currentText) {
this.currentText.set(currentText);
}
When a property is added in this way, with the setter, getter and propertygetter, SceneBuilder detect it automatically.
Now, I am going to add a new property called: currentValueTagID . Notes: 1) This should not be done in the dynamo, the dynamo class should not be related to tags or other eru stuff. So we have to create a package in Eru to extend and add this properties... 2) This property name can change.
/* ********** Fields ********** */
[...]
private StringProperty currentValueTagID;
private DoubleProperty currentValue;
[...]
/* ********** Constructor ********** */
public Display() {
currentValueTagID = new SimpleStringProperty(this, "currentValueTagID","");
currentValue = new SimpleDoubleProperty(this, "currentValue", 0.0);
[...]
}
/* ********** Setters and Getters ********** */
[...]
public String getCurrentValueTagID() {
return currentValueTagID.get();
}
public StringProperty currentValueTagIDProperty() {
return currentValueTagID;
}
public void setCurrentValueTagID(String currentValueTagID) {
this.currentValueTagID.set(currentValueTagID);
}
public double getCurrentValue() {
return currentValue.get();
}
public DoubleProperty currentValueProperty() {
return currentValue;
}
public void setCurrentValue(double currentValue) {
this.currentValue.set(currentValue);
}
Now Scene Builder help us to set the tag ID :
And it is saved in the FXML, like the others properties....
Adding the ID (Tag table now shows the tag ID):
So, adding the ID in Scene Builder:
Everything is setted...
So, I am going to: 1) Create a package in eru gui to have dynamos extended and to be analyzed by the CustomLibraryLoader. 2) Create dynamos there.
Eru is now has Scene Builder embedded... Now we have to find a way to link Dynamos Properties to tags.