01 /*
02 * Copyright 2008-2017 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 griffon.javafx.support.ActionMatcher;
24 import org.codehaus.griffon.runtime.core.injection.AbstractModule;
25 import org.codehaus.griffon.runtime.javafx.controller.JavaFXActionManager;
26 import org.kordamp.jipsy.ServiceProviderFor;
27
28 import javax.inject.Named;
29
30 import static griffon.util.AnnotationUtils.named;
31
32 /**
33 * @author Andres Almiray
34 * @since 2.0.0
35 */
36 @Named("javafx")
37 @ServiceProviderFor(Module.class)
38 public class JavaFXModule extends AbstractModule {
39 @Override
40 protected void doConfigure() {
41 // tag::bindings[]
42 bind(JavaFXWindowDisplayHandler.class)
43 .withClassifier(named("defaultWindowDisplayHandler"))
44 .to(DefaultJavaFXWindowDisplayHandler.class)
45 .asSingleton();
46
47 bind(JavaFXWindowDisplayHandler.class)
48 .withClassifier(named("windowDisplayHandler"))
49 .to(ConfigurableJavaFXWindowDisplayHandler.class)
50 .asSingleton();
51
52 bind(WindowManager.class)
53 .to(DefaultJavaFXWindowManager.class)
54 .asSingleton();
55
56 bind(UIThreadManager.class)
57 .to(JavaFXUIThreadManager.class)
58 .asSingleton();
59
60 bind(ActionManager.class)
61 .to(JavaFXActionManager.class)
62 .asSingleton();
63
64 bind(ActionMatcher.class)
65 .toInstance(ActionMatcher.DEFAULT);
66 // end::bindings[]
67 }
68 }
|