/
ScreensConfiguration.java
50 lines (40 loc) · 1.26 KB
/
ScreensConfiguration.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
package com.comsysto;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
@Configuration
@Lazy
public class ScreensConfiguration {
private static Stage primaryStage;
public static void setPrimaryStage(Stage newPrimaryStage) {
primaryStage = newPrimaryStage;
}
public static Stage getPrimaryStage() {
return primaryStage;
}
public void showScreen(Parent screen) {
primaryStage.setScene(new Scene(screen, 777, 500));
primaryStage.show();
}
@Bean
MainController mainController() {
return new MainController(this);
}
@Bean
FXMLStage mainStage() {
return new FXMLStage(mainController(), getClass().getResource("Main.fxml"), primaryStage);
}
@Bean
@Scope("prototype")
StandardController aboutController() {
return new StandardController();
}
@Bean(name="aboutDialog")
FXMLDialog aboutDialog() {
return new FXMLDialog(aboutController(), getClass().getResource("About.fxml"), primaryStage);
}
}