JDK-8103765 : Impact of Builders removal on FXML
  • Type: Task
  • Component: javafx
  • Sub-Component: fxml
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-04-02
  • Updated: 2015-06-16
  • Resolved: 2013-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Blocks :  
Relates :  
Description
Loading of FXML file depends on Builders for such classes that do not provide either default no-arg constructor or do not provide valueOf(String) method (for fx:value attribute) or do not provide static no-arg factory method (fx:factory attribute). FXML uses some builders that were implemented as convenience for developers to create JavaFX objects. Planned removal of Builders would impact also FXML. Here is small analysis of what classes couldn't be created in FXML if Builders are removed from JavaFX API. (Note that classes that are not listed is possible to create by other means)

Classes that will not be possible to create when loading FXML file if Builders are removed:

javafx.beans.property.adapter.JavaBeanBooleanProperty
javafx.beans.property.adapter.JavaBeanDoubleProperty
javafx.beans.property.adapter.JavaBeanFloatProperty
javafx.beans.property.adapter.JavaBeanIntegerProperty
javafx.beans.property.adapter.JavaBeanLongProperty
javafx.beans.property.adapter.JavaBeanObjectProperty
javafx.beans.property.adapter.JavaBeanStringProperty
javafx.beans.property.adapter.ReadOnlyJavaBeanBooleanProperty
javafx.beans.property.adapter.ReadOnlyJavaBeanDoubleProperty
javafx.beans.property.adapter.ReadOnlyJavaBeanFloatProperty
javafx.beans.property.adapter.ReadOnlyJavaBeanIntegerProperty
javafx.beans.property.adapter.ReadOnlyJavaBeanLongProperty
javafx.beans.property.adapter.ReadOnlyJavaBeanObjectProperty
javafx.beans.property.adapter.ReadOnlyJavaBeanStringProperty
javafx.geometry.BoundingBox
javafx.geometry.Dimension2D
javafx.geometry.Insets
javafx.geometry.Point2D
javafx.geometry.Point3D
javafx.geometry.Rectangle2D
javafx.scene.SubScene
javafx.scene.chart.AreaChart
javafx.scene.chart.BarChart
javafx.scene.chart.BubbleChart
javafx.scene.chart.LineChart
javafx.scene.chart.ScatterChart
javafx.scene.chart.StackedAreaChart
javafx.scene.chart.StackedBarChart
javafx.scene.control.RadioMenuItem
javafx.scene.control.ResizeFeaturesBase
javafx.scene.control.cell.PropertyValueFactory
javafx.scene.control.cell.TreeItemPropertyValueFactory
javafx.scene.input.InputMethodTextRun
javafx.scene.input.Mnemonic
javafx.scene.input.TouchPoint
javafx.scene.layout.Background
javafx.scene.layout.BackgroundFill
javafx.scene.layout.BackgroundImage
javafx.scene.layout.BackgroundPosition
javafx.scene.layout.BackgroundSize
javafx.scene.layout.Border
javafx.scene.layout.BorderImage
javafx.scene.layout.BorderStroke
javafx.scene.layout.BorderStrokeStyle
javafx.scene.layout.BorderWidths
javafx.scene.media.AudioClip
javafx.scene.media.Media
javafx.scene.media.MediaPlayer
javafx.scene.paint.Stop
javafx.scene.web.PromptData

Following list of classes shows classes that is not possible to create even now when Builders are still part of JavaFX API:

javafx.animation.KeyFrame
javafx.animation.KeyValue
javafx.application.HostServices
javafx.application.Platform
javafx.beans.WeakInvalidationListener
javafx.beans.binding.Bindings
javafx.beans.binding.When
javafx.beans.value.WeakChangeListener
javafx.collections.FXCollections
javafx.collections.WeakListChangeListener
javafx.collections.WeakMapChangeListener
javafx.collections.WeakSetChangeListener
javafx.concurrent.EventHelper
javafx.css.ParsedValue
javafx.css.SimpleStyleableBooleanProperty
javafx.css.SimpleStyleableDoubleProperty
javafx.css.SimpleStyleableFloatProperty
javafx.css.SimpleStyleableIntegerProperty
javafx.css.SimpleStyleableLongProperty
javafx.css.SimpleStyleableObjectProperty
javafx.css.SimpleStyleableStringProperty
javafx.embed.swing.DataFlavorUtils
javafx.embed.swing.SwingCursors
javafx.embed.swing.SwingDnD
javafx.embed.swing.SwingDragSource
javafx.embed.swing.SwingEvents
javafx.embed.swing.SwingFXUtils
javafx.embed.swt.SWTCursors
javafx.embed.swt.SWTEvents
javafx.embed.swt.SWTFXUtils
javafx.event.WeakEventHandler
javafx.fxml.ParseTraceElement
javafx.print.JobSettings
javafx.print.PageLayout
javafx.print.PageRange
javafx.print.Paper
javafx.print.PaperSource
javafx.print.PrintResolution
javafx.print.Printer
javafx.print.PrinterAttributes
javafx.print.PrinterJob
javafx.scene.CssStyleHelper
javafx.scene.PropertyHelper
javafx.scene.SnapshotResult
javafx.scene.canvas.GraphicsContext
javafx.scene.control.ControlUtils
javafx.scene.control.TablePosition
javafx.scene.control.TableUtil
javafx.scene.control.TreeTablePosition
javafx.scene.control.TreeUtil
javafx.scene.control.cell.CellUtils
javafx.scene.control.cell.MapValueFactory
javafx.scene.image.WritableImage
javafx.scene.input.Clipboard
javafx.scene.input.DataFormat
javafx.scene.input.Dragboard
javafx.scene.input.PickResult
javafx.scene.layout.CornerRadii
javafx.scene.media.AudioEqualizer
javafx.scene.media.AudioTrack
javafx.scene.media.MediaPlayerShutdownHook
javafx.scene.media.SubtitleTrack
javafx.scene.media.VideoTrack
javafx.scene.shape.PredefinedMeshManager
javafx.scene.web.PopupFeatures
javafx.scene.web.WebHistory
javafx.stage.Screen
javafx.stage.Window
javafx.util.Pair
javafx.util.converter.FormatStringConverter


Special case are classes Scene, Font and Image that have own Builders implemented in FXML due to implementation details.

Comments
Just added a comment to RT-35522 with a fair amount of information about how FXMLLoader works with and without a custom BuilderFactory.
24-02-2014

RT-14875 has a lot of "back-story" about the builders.
24-02-2014

RT-35522 involves improving documentation for FXMLLoader.
24-02-2014

Sure. I just added a "related to" link.
22-02-2014

Can this be linked to RT-30520?
22-02-2014

No longer applicable after RT-32859
03-12-2013

If you look at the XAML spec it has a prescription for handling constructor args and factory methods (similar to spring in terms of specifying them). I put together a XAML for Java (called XIML) with a javafx dialect and it can work fine. In fact, if you just follow the XAML spec more closely (I know this is debatable), you can get other goodies as well including delayed evaluate of XML fragments and extensions to embed mini-DSLs into the markup to make authoring easier. You can also integrate much easier into DI containers which FXML does not make easy. For my markup test cases, I never needed to use a builder object directly which I thought were mostly a construct to simplify direct java coding. The java xaml with the javafx dialect project is on sourceforge. I found that the pivot and java swing constructor and event-handling inconsistencies and other things made those dialects much harder. If you think of FXML as a node stream versus a markup language, you can actually create the nodestream for any user-oriented markup easier. There are some other very simple tricks to allow you to manipulate constructor or static constructor type objects and shield that in an XML markup language.
05-04-2013

Milan, do you think it is possible to create TriangleMesh with FXML? I tried the following but it didn't work: <TriangleMesh> <points> 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, </points> <texCoords> 0, 0 </texCoords> <faces> 0, 0, 1, 0, 2, 0 3, 0, 1, 0, 2, 0 </faces> </TriangleMesh>
04-04-2013

Thank you for this information! It is important for some of the 3D FXML work. See related issues for more information.
03-04-2013