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

FXML Templating Support

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • javafx
    • None

      Support for FXML and CSS in JavaFX is great, as it allows to separate graphical UI design (FXML + CSS) from technical implementation (controller + model POJOs).

      Unfortunately there is (at least) on scenario where UI designers have no other chance that to learn Java: When it comes to replacing the visual experience of cells (like changing from a simple icon plus text label to a more complex "interior"). The reason is that for this purpose, one has to write a customo cell factory.

      One could assume that it should be a simple and straightforward task to write a generic cell factory which simply loads FXML internally. Unfortunately this is a rather bad idea, as it implies heavy I/O on the rendering thread, leading to poor performance and overly use of CPU cycles and RAM fragmentation due to lots of short-living objects.

      Also the next idea won't work: Cloning a preloaded Node. Unfortunately, Nodes are not cloneable (not even the few built-in implementations, neither virtually all custom ones).

      Hence, there is not solution possible with JavaFX 8 and 9, so there should be a plan to support this in Java FX 10. Several idea come into mind, like:
       * (A) Real Templates: Template<Node> t = FXMLLoader.compile(URL); Node n = t.createInstance();
       * (B) Stream Cache (key is URL, value is content) inside FXMLLoader.
       * (C) Making Node cloneable, and implement it for all standard widgets.

      This issue does neither provide a full discussion of the topic, nor a comprehensive list of solutions. It merely serves as a trigger for a future discussion within the JavaFX project team.

            Unassigned Unassigned
            mkarg Markus Karg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: