8u40 `content` property name clash - intent to revert to 'children'

18 views
Skip to first unread message

Jarek Sacha

unread,
Nov 18, 2014, 10:47:03 PM11/18/14
to scala...@googlegroups.com
While working on on a wrapper for the new 8u40 Dialog API I came across difficult to resolve name clash. The DialogPane (derived from Pane) in the new JavaFX Dialog API is using a `content` property to make distinction between content of  the dialog and the implementation details of the JavaFX Pane that is using `children` property.

Some time early in the history of ScalaFX API children of a Pane were made available using `content` property. At this point it is simply an alias for `children` property, it is actually defined as:
    def content = children

There probably was a good reason for that at the time. At this point it leads to some confusion (why there is a `content` when there is already `children`). More important, with 8u40 it is causing conflict with JavaFX API and requires need for special constructs that will lead to errors. For instance, using intuitively correct code

 dialog.dialogPane().content = grid

will lead to error, since rather than accessing the new JavaFX DialogPane `content` property we will be accessing `children` property. To get it right, right now we have to use unfamiliar:

 dialog.dialogPane().contentNode = grid

to get desired behavior. This will be causing user issues.

I am thinking about removing the "old" `content` property and changing Pane API (and others) to use only `children` property. Short term, this will cause backward compatibility problems for the code that is currently using `content`.  Long term, it will lead to cleaner and more intuitive API. This probably need to be done by first deprecating old uses of `content` in the next release and removing it for 8u40 release.

To keep track of this naming conflict I created Issue #163.

Let me know what you think. I will appreciate suggestions how to resolve the naming conflict in the cleanest way.

Jarek
Reply all
Reply to author
Forward
0 new messages