JavaFXModule.java
01 /*
02  * Copyright 2008-2016 the original author or authors.
03  *
04  * Licensed under the Apache License, Version 2.0 (the "License");
05  * you may not use this file except in compliance with the License.
06  * You may obtain a copy of the License at
07  *
08  *     http://www.apache.org/licenses/LICENSE-2.0
09  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.codehaus.griffon.runtime.javafx;
17 
18 import griffon.core.controller.ActionManager;
19 import griffon.core.injection.Module;
20 import griffon.core.threading.UIThreadManager;
21 import griffon.core.view.WindowManager;
22 import griffon.javafx.JavaFXWindowDisplayHandler;
23 import org.codehaus.griffon.runtime.core.injection.AbstractModule;
24 import org.codehaus.griffon.runtime.javafx.controller.JavaFXActionManager;
25 import org.kordamp.jipsy.ServiceProviderFor;
26 
27 import javax.inject.Named;
28 
29 import static griffon.util.AnnotationUtils.named;
30 
31 /**
32  @author Andres Almiray
33  @since 2.0.0
34  */
35 @Named("javafx")
36 @ServiceProviderFor(Module.class)
37 public class JavaFXModule extends AbstractModule {
38     @Override
39     protected void doConfigure() {
40         // tag::bindings[]
41         bind(JavaFXWindowDisplayHandler.class)
42             .withClassifier(named("defaultWindowDisplayHandler"))
43             .to(DefaultJavaFXWindowDisplayHandler.class)
44             .asSingleton();
45 
46         bind(JavaFXWindowDisplayHandler.class)
47             .withClassifier(named("windowDisplayHandler"))
48             .to(ConfigurableJavaFXWindowDisplayHandler.class)
49             .asSingleton();
50 
51         bind(WindowManager.class)
52             .to(DefaultJavaFXWindowManager.class)
53             .asSingleton();
54 
55         bind(UIThreadManager.class)
56             .to(JavaFXUIThreadManager.class)
57             .asSingleton();
58 
59         bind(ActionManager.class)
60             .to(JavaFXActionManager.class)
61             .asSingleton();
62         // end::bindings[]
63     }
64 }