Scene Builder should change fx:id values rather than saving a corrupt FXML file

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 7u6
    • Affects Version/s: None
    • Component/s: javafx
    • None

      Scene Builder should never save a corrupt FXML file under any circumstances. Today it is possible to create such a thing by duplicate fx:id values. In particular, if the same fx:id is used by a ToggleGroup and by some other thing then depending exactly on how it is resolved, the loader may try to set the ToggleGroup of a ToggleButton to that other thing, which will cause the whole load to fail.

      Changing fx:id values is a bit radical because they are used during injection. I think the right thing to do is to change them only when they appear in an fx:ref somewhere. We could special-case the treatment of ToggleGroups, and keep a map of all ToggleGroup ids on hand at all times, but I think it would be much better to change the SaveFxml logic so that it generates unique fx:id values if it detects fx:ref conflicts.

            Assignee:
            Daniel Fuchs
            Reporter:
            Eamonn McManus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: