01 /*
02 * Copyright 2008-2014 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.swing;
17
18 import griffon.core.addon.GriffonAddon;
19 import griffon.core.controller.ActionManager;
20 import griffon.core.injection.Module;
21 import griffon.core.threading.UIThreadManager;
22 import griffon.core.view.WindowManager;
23 import griffon.swing.SwingWindowDisplayHandler;
24 import org.codehaus.griffon.runtime.core.injection.AbstractModule;
25 import org.codehaus.griffon.runtime.swing.controller.SwingActionManager;
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("swing")
37 @ServiceProviderFor(Module.class)
38 public class SwingModule extends AbstractModule {
39 @Override
40 protected void doConfigure() {
41 // tag::bindings[]
42 bind(SwingWindowDisplayHandler.class)
43 .withClassifier(named("defaultWindowDisplayHandler"))
44 .to(DefaultSwingWindowDisplayHandler.class)
45 .asSingleton();
46
47 bind(SwingWindowDisplayHandler.class)
48 .withClassifier(named("windowDisplayHandler"))
49 .to(ConfigurableSwingWindowDisplayHandler.class)
50 .asSingleton();
51
52 bind(WindowManager.class)
53 .to(DefaultSwingWindowManager.class)
54 .asSingleton();
55
56 bind(UIThreadManager.class)
57 .to(SwingUIThreadManager.class)
58 .asSingleton();
59
60 bind(ActionManager.class)
61 .to(SwingActionManager.class)
62 .asSingleton();
63
64 bind(GriffonAddon.class)
65 .to(SwingAddon.class)
66 .asSingleton();
67 // end::bindings[]
68 }
69 }
|