/
App.java
51 lines (45 loc) · 1.47 KB
/
App.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.airhacks.followme;
import com.airhacks.followme.dashboard.DashboardView;
import com.airhacks.afterburner.injection.Injector;
import java.time.LocalDate;
import java.time.Month;
import java.util.HashMap;
import java.util.Map;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author adam-bien.com
*/
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);
System.setProperty("happyEnding", " Enjoy the flight!");
DashboardView appView = new DashboardView();
Scene scene = new Scene(appView.getView());
stage.setTitle("followme.fx");
final String uri = getClass().getResource("app.css").toExternalForm();
scene.getStylesheets().add(uri);
stage.setScene(scene);
stage.show();
}
@Override
public void stop() throws Exception {
Injector.forgetAll();
}
public static void main(String[] args) {
launch(args);
}
}