API change request (RT-23413)

Greg Brown greg.x.brown at oracle.com
Mon Jul 30 09:05:41 PDT 2012


After further discussion (see JIRA), I have revised the proposed API change for RT-23413:

  http://javafx-jira.kenai.com/browse/RT-23413

The previous proposal would have added a new boolean property to FXMLLoader called "clearImportsOnLoad"; however, this would have required a caller to both set this flag and set the document root to null before each call to load(), which is not very intuitive.

The revised proposal adds a "template" flag to FXMLLoader. Setting this flag to true indicates that the loader will be used as a template for producing multiple instances of a single object hierarchy. When this flag is set to false (the default), FXMLLoader#load() will behave as currently implemented. When true, FXMLLoader#load() will: 

a) clear the root value by calling setRoot(null) 
b) not clear any existing imports 

This helps improve performance on subsequent loads since the overhead of loading the classes referred to by the document is eliminated.

Greg

On Jul 20, 2012, at 3:03 PM, Greg Brown wrote:

> Good point. Thanks!
> 
> On Jul 20, 2012, at 2:59 PM, Daniel Fuchs wrote:
> 
>> Hi,
>> 
>> Whatever option you choose, I think you need to clear the imports if the ClassLoader changes.
>> Otherwise you might use the class that was returned by the previous ClassLoader, which would be
>> bad.
>> Also you probably need to specify what happens if the default class loader is changed. Does that
>> affect existing FXMLLoader instances? I guess not...
>> "Sets the default ClassLoader" is maybe a bit too concise ;-)
>> 
>> best regards,
>> 
>> -- daniel
> 



More information about the openjfx-dev mailing list