igniter.fx--The afterburner.fx Archetype Released 📎
igniter.fx version 1.9.1 is released. igniter.fx is a maven archetype (=wizard), which generates a JavaFX application based on afterburner.fx 1.5.1
To create a JavaFX maven project with a sample application execute the following command from the CLI:
mvn archetype:generate -Dfilter=com.airhacks:igniter
The sample application was extended to demonstrate dependency injection of a custom object (java.time.LocalDate
).
public class FollowmePresenter implements Initializable {
@FXML
Label message;
@Inject
Tower tower;
@Inject
private String prefix;
@Inject
private String happyEnding;
@Inject
private LocalDate date;
//[...]
}
See the full code: FollowmePresenter.java
You can configure injectable properties with a java.util.Map
public class App extends Application {
@Override
public void start(Stage stage) throws Exception {
/*
* Properties of any type can be easily injected.
*/
LocalDate date = LocalDate.of(4242, Month.JULY, 21);
Map<Object, Object> customProperties = new HashMap<>();
customProperties.put("date", date);
/*
* any function which accepts an Object as key and returns
* and return an Object as result can be used as source.
*/
Injector.setConfigurationSource(customProperties::get);
//[...]
}
See the full code: App.java.
You can also clone the sample application directly: https://github.com/AdamBien/followme.fx.
igniter.fx is open source: https://github.com/AdamBien/igniter.fx
See you at Java EE Workshops at MUC Airport, particularly at the Java EE User Interfaces workshop!