Yesterday, Daniel Spiewak released Fuse 0.2. Fuse is a resource injection library mostly designed to be used with GUI toolkits like Swing and SWT. I did not work much on this release so there are no new supported types for Swing. That said there is some good stuff in there:
JLabel and create a definition that tells Fuse to inject foreground and text. Definitions can be declared with XML, regulare classes or maps.The are a few other new features you can discover in the release notes. You can download Fuse 0.2 or visit the project page to get a comprehensive introduction and documentation.
We have already begun working on Fuse 0.3 and if you grab the source code from the CVS you will be able to play with a very cool incoming feature: auto injection. Here is a short example:
JFrame f = new JFrame("Swing Auto Injection");
AutoInjection.enable(f);
// or enable("name", f) to choose a specific resource injector
Once auto injection is enabled on a container, (JPanel, JFrame, whatever…) resources will be injected in every component you add to this container or one of its children. That's right, you won't have anything else to do. Auto injection also introduces the notion of binding. When using Swing's auto injection provider you can bind a component name to a definition. For instance, here is how you can make all your error labels be red:
// load a definition
ResourceInjector.addDefinition("error-foreground",
XMLDefinition.load(SwingAutoInjection.class, "error-label.xml"));
// bind the name error-label to the definition called error-foreground
AutoInjection.bind("error-label", "error-foreground");
// create the label and give it a name
JLabel label = new JLabel("Howdy I am red.");
label.setName("error-label");
f.add(label, BorderLayout.SOUTH);
Once bound to a definition you can easily change the properties file to change the appearance of all your error labels. We are also thinking about the way we could mix auto injection and hives to let you reload and refresh the UI very easily.
Enjoy!
hydrocodone pharmacy mexican mexican at pharmacy
I agree! Just marvellous! Your writing manner is pleasing and the way you treated the subject with grace is commendable. I am intrigued, I presume you are an master on this subject. I am signing up for your upcoming updates from now on.