custom controls in SceneBuilder
tbee at tbee.org
Fri Aug 31 07:15:01 PDT 2012
On 2012-08-31 15:56, Daniel Fuchs wrote:
>> So it works. An annoyance of course is the fact that this must be done every time the file
>> is opened.
> We don't want to transparently load custom code without the user
> being aware that this is happening. Imagine that someone sends you
> an FXML containing classpath instructions which happen to point
> to some jar also existing on your machine.
Interesting angle; should classpath instructions be part of the FXML?
A class file does not know what jars are available, it only has import statements. It's the responsibility of the environment aka IDE to make sure the classpath is setup correctly, so the import can be resolved. Similarly, the SB should be setup correctly to render the FXML. Classpath information IMHO should not be part of the FXML, just the imports.
That said, then the SB should have a list of jars it needs to load upon start. But if you are working on multiple projects, there may be (version) conflicts. So it could have a notion of a something like a "project" in which a set of of FXML files are procesed in the context of a set of controls. For example a SceneBuilder.properties / xml file inside the directory with the FXML files (like the .project file in Eclipse). This is not a definite suggestion, just a brain dump.
> SceneBuilder can be used to open different FXML files which might
> point to different jars - possibly containing different versions of
> the same class - so I'm not sure we should put any custom class
> in SceneBuilder's classpath. IMHO that would be a bigger nest
> of bugs.
See above; probably some kind of project concept probably is needed. It is not without reason that all IDE's end up doing this.
> All properties which are specific to the custom control itself
> are put in a big "Miscellaneous" bag that you should see appear
> in the inspector.
Yup. Apparently I do need glasses after all. I really checked if I overlooked them.
Seems it doesn't know how to do Calendar. But, hey, you know, I happen to know an nice control for that ;-)
More information about the openjfx-dev