Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8091011

Allow editing of an FXML file which imports custom controls defined in other FXML files without Java source or class files

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • tbd
    • 8
    • javafx

    Description

      As requested, I am creating this entry in order to split out the last few comments near the end of DTL-5911 into a separate feature request.

      THE PROBLEM:

      Currently, when the user wants to use a child custom control (using fx:import, fx:root, etc.) within a parent FXML file, it is first necessary to create Java source backing the custom control, then compile that source to .class files, and then wrap that custom control's FXML and .class files into a JAR file which can be provided to SceneBuilder when it starts up, so that it can render that custom control when editing the parent FXML file. The user must also use the scenebuilder-classpath-element directive in the parent FXML file to point to the classpath from which the JAR file may be loaded. All of this is quite a bit of work and maintenance for what would otherwise be a fairly simple process, especially when the custom control is very simple.

      This current approach (separate compilation of custom controls using JAR files) makes it very difficult to maintain a project that contains many custom controls which are still being developed (if they were all finished and unchanging, it would be less of a problem), and has impacted my workflow quite a lot due to the constant separate compilation passes I have to do every time something changes. This problem has become annoying enough that I have mostly stopped using custom controls, since the amount of work required to use one is often larger than the time saved by not having to duplicate code.

      Also the documentation of how to get a custom control working in SceneBuilder in the fashion that I described above (e.g. using the scenebuilder-classpath-element directive) is not very good, and not really mentioned or referenced in the Oracle tutorials or most other related documentation, so it is quite difficult to figure out how to get all of this working in the first place.

      THE FEATURE REQUEST:

      If I have FXML describing a custom control (for, say, a listbox and several buttons to add and remove items from it), then I want to be able to edit FXML files that contain instances of that custom control, and see those controls in the locations where they appear in the UI that I am editing. I don't think that I should need the Java code for the "real" control for that, or any Java code at all really -- I just need to see the controls that were described by the child FXML files, as if copies of that FXML file had been included in the parent FXML file at the appropriate locations.

      Please make it possible so that if SceneBuilder loads an FXML file that imports other FXML files containing one or more custom controls, it can recognize the relationship between the files and show the controls described by the child FXML file(s) as immutable controls at the location where they were imported into the parent FXML file, without requiring that there be compiled Java code (a jar file) to back up the child FXML files.

      These child controls can be treated as "read only" when editing the parent FXML file that imports them. However, they should otherwise be like other controls in that they should react to the contents of their parent nodes as appropriate. (If a user wants to edit one of the child FXML files, the user can open that file separately and edit it instead.)

      Of course, child FXML files may themselves import grandchild FXML files (or grandchild JAR files containing custom controls) and so forth, so SceneBuilder should be able to handle arbitrary nesting of custom controls within each other via import, with any such nesting structure treated as a single read-only control when editing the top-level FXML document.

      Also, SceneBuilder shouldn't make any changes to the importing structure when writing the file out again: if child elements were being imported via fx:import when the file was read in, they should still be imported when it is written out again, unless the user has deliberately changed the structure. (Features might be added to allow the user to do this, like "inlining" and/or "extracting" a node and its children to/from the "tree view" of SceneBuilder into or out of a custom control held in a separate FXML file.)



      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: