I wrote an FXML file in which I use a custom component that extends Group. When loading this custom component, it must add some child elements (here: MyOverlayIcon) to its children list and set some attributes by code (here: layoutX and layoutY).
MyIcon.java:
public class MyIcon extends Group {
private ImageView graphic;
public ImageView getGraphic() {
if(graphic == null) {
graphic = new ImageView();
getChildren().add(graphic);
graphic.toBack();
}
return graphic;
}
private Property<String> dataPath;
public Property<String> dataPathProperty() {
if (dataPath == null) {
dataPath = new SimpleStringProperty();
}
return dataPath;
}
public String getDataPath() {
return dataPathProperty().getValue();
}
public void setDataPath(String dataPath) {
this.dataPathProperty().setValue(dataPath);
getGraphic().setImage(new Image(dataPath));
}
private ObservableList<MyOverlayIcon> overlays;
public ObservableList<MyOverlayIcon> getOverlays() {
if (overlays == null) {
overlays = FXCollections.observableArrayList();
overlays.addListener(new ListChangeListener<MyOverlayIcon>() {
@Override
public void onChanged(ListChangeListener.Change<? extends MyOverlayIcon> c) {
double moveX = 0.0;
double moveY = 0.0;
double iconWidth = 48.0;
double iconHeight = 48.0;
ObservableList<? extends MyOverlayIcon> icons = c.getList();
MyOverlayIcon icon = icons.get(icons.size() - 1);
String orientation = icon.getOrientation().toString();
if(orientation.endsWith("EAST")) {
moveX = iconWidth / 2;
}
if(orientation.startsWith("SOUTH")) {
moveY = iconHeight / 2;
}
icon.setLayoutX(moveX);
icon.setLayoutY(moveY);
getChildren().add(icon);
}
});
}
return overlays;
}
public MyIcon(){}
}
MyOverlayIcon.java:
public class MyOverlayIcon extends MyIcon {
private EnumOrientation orientation;
public EnumOrientation getOrientation() {
return orientation;
}
public void setOrientation(EnumOrientation orientation) {
this.orientation = orientation;
}
public MyOverlayIcon() {}
}
MyIconView.fxml:
<Group xmlns:fx="http://javafx.com/fxml">
<MyIcon dataPath="@/images/User1_48.png">
<overlays>
<MyOverlayIcon dataPath="@/images/Remove_24.png" orientation="SOUTHWEST" />
<MyOverlayIcon dataPath="@/images/Search1_24.png" orientation="NORTHEAST" />
</overlays>
</MyIcon>
</Group>
When I run the application in my IDE by downloading this fxml fith FXMLLoader file, it works fine: all new children are added and displayed correctly:

Now I want to modify this fxml file using Scene Builder. But when I upload a file using Scene Builder, I see only an empty group instance:

Only these two workarounds were detected:
1.) , (, setter-), , , -, , .
2.) Scene Builder , , , , fxml . Scene Builder .
, , java-, , fxml.
node fxml, Scene Builder.
: , (: layoutX layoutY), , fxml .
MyIconView_Workaround.fxml:
<Group xmlns:fx="http://javafx.com/fxml">
<MyIcon dataPath="@/images/User1_48.png">
<Pane />
<overlays>
<MyOverlayIcon dataPath="@/images/Remove_24.png" orientation="SOUTHWEST" layoutY="456">
<Pane />
</MyOverlayIcon>
<MyOverlayIcon dataPath="@/images/Search1_24.png" orientation="NORTHEAST" layoutX="123">
<Pane />
</MyOverlayIcon>
</overlays>
</MyIcon>
</Group>

//Edit: , .
- , fxml Scene Builder, , java- ( ) fxml?