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 package it.tidalwave.ui.javafx;
27
28 import javax.annotation.Nonnull;
29 import org.springframework.context.ConfigurableApplicationContext;
30 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
31 import org.springframework.context.annotation.Bean;
32 import org.springframework.context.annotation.Configuration;
33 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
34 import org.slf4j.Logger;
35 import org.slf4j.LoggerFactory;
36 import it.tidalwave.util.PreferencesHandler;
37 import it.tidalwave.role.impl.DefaultContextManager;
38 import it.tidalwave.role.spring.spi.AnnotationSpringSystemRoleFactory;
39 import it.tidalwave.role.ui.javafx.StackPaneSelector;
40
41
42
43
44
45
46
47
48
49 @Configuration
50 public class JavaFXSpringAnnotationApplication extends AbstractJavaFXSpringApplication
51 {
52
53 private final Logger log = LoggerFactory.getLogger(JavaFXSpringApplication.class);
54
55 @Override @Nonnull
56 protected ConfigurableApplicationContext createApplicationContext()
57 {
58 final var mainClass = getClass();
59 log.info("Scanning beans from {}", mainClass);
60 return new AnnotationConfigApplicationContext(mainClass);
61 }
62
63 @Bean(name = "javafxBinderExecutor")
64 public ThreadPoolTaskExecutor getJavaFXSafeProxyCreator()
65 {
66 return JavaFXSafeProxyCreator.getExecutor();
67 }
68
69 @Bean(name = "stackPaneSelector")
70 public StackPaneSelector getStackPaneSelector()
71 {
72 return new StackPaneSelector();
73 }
74
75 @Bean(name = "preferencesHandler")
76 public PreferencesHandler getPreferencesHandler()
77 {
78 return PreferencesHandler.getInstance();
79 }
80
81 @Bean(name = "roleManager")
82 public AnnotationSpringSystemRoleFactory getAnnotationSpringSystemRoleFactory()
83 {
84 return new AnnotationSpringSystemRoleFactory();
85 }
86
87 @Bean(name = "contextManager")
88 public DefaultContextManager getDefaultContextManager()
89 {
90 return new DefaultContextManager();
91 }
92 }