You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a FXMLItem is defined we get the same instance of FXMLComponent (so the same node).
If multiple instances of a model are defined then the same instance node will be retrieve. In this case we must use getFXMLItem().getNew().
Here is the temporary code I did to fix this issue. But I would like to have your opinion first.
If it's ok for you can include it as a next commit.
/** * Inform if the model will be displayed multiple times on screen * As consequence the FXMLItem will provide a new FXMLComponent instance to avoid * duplicate children on the scene graph * * @return true is the node mus */protectedbooleanduplicateOnScreen() {
returnfalse;
}
/** * {@inheritDoc} */@OverrideprotectedfinalvoidinitInternalModel() throwsCoreException {
[... DOTHINGS ...]
if (getFXMLItem() != null) {
if (!duplicateOnScreen()) {
this.fxmlComponent = getFXMLItem().get();
} else {
this.fxmlComponent = getFXMLItem().getNew();
}
// Don't forget to set the model to the controller here cause of FXMLBuilder#buildComponentthis.fxmlComponent.getController().setModel(this);
} elseif (getFXMLPath() != null) {
this.fxmlComponent = FXMLUtils.loadFXML(this, getFXMLPath(), getFXMLBundlePath());
}
[... DOOTHERSTHINGS ...]
}
The text was updated successfully, but these errors were encountered:
This issue follow the issue #126 and the following lines in AbstractFXMLObjectModel:
When a FXMLItem is defined we get the same instance of FXMLComponent (so the same node).
If multiple instances of a model are defined then the same instance node will be retrieve. In this case we must use getFXMLItem().getNew().
Here is the temporary code I did to fix this issue. But I would like to have your opinion first.
If it's ok for you can include it as a next commit.
The text was updated successfully, but these errors were encountered: