API change request for RT-20471/JavaFX 2.2
richard.bair at oracle.com
Wed Apr 25 14:47:36 PDT 2012
I agree, I'd love to get standard annotations involved, but since we can do that later compatibly, I'm happy with the enhancement here. The only thing that bothers me about it is that the names are "magic" I guess for the ResourceBundle, in that I cannot have a ResourceBundle in my FXML file with an fx:id by that name? Or things might get confusing.
On Mar 19, 2012, at 5:03 PM, Daniel Zwolenski wrote:
> +1 on the improved API from me.
> Just as something to think about, we're starting to have a mini-dependency
> injection framework in FXML, with a custom DI API. There are standard
> annotations for this built into Java (under JEE) including the @Resource
> and @PostConstruct annotations, which closely match the way the @FXML
> annotation is being used in this case:
> The standard stuff might be an area worth looking at either to leverage, or
> for design ideas to consider (e.g. the @PostConstruct annotation can be
> applied to any method, it does not need to be named 'initialize()').
> Another source of ideas on this stuff could be JSR330 (the 'javax.inject'
> e.g. Using just the features in JFX2.0, I've been able to inject the
> ResourceBundle into my 'controller' using this standard JEE dependency
> injection, and also use the PostConstruct to do the initialisation. As a
> result I've been able to avoid the Initializable interface and achieve the
> result this enhancement is aimed at achieving (though my solution requires
> a DI implementation such as Spring, whereas in the proposal the FXMLLoader
> would effectively be the DI implementation).
> Just some thoughts to throw in the mix, but I definitely like the
> annotation based solution over the interface one.
> On Tue, Mar 20, 2012 at 7:25 AM, Greg Brown <greg.x.brown at oracle.com> wrote:
>> This change would automatically inject "location" and "resources" fields
>> in an FXML controller object rather than requiring the controller to
>> implement Initializable. See JIRA issue for details:
More information about the openjfx-dev