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.pivot;
17
18 import griffon.core.controller.ActionFactory;
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.pivot.PivotWindowDisplayHandler;
24 import org.codehaus.griffon.runtime.core.injection.AbstractModule;
25 import org.codehaus.griffon.runtime.pivot.controller.PivotActionFactory;
26 import org.codehaus.griffon.runtime.pivot.controller.PivotActionManager;
27 import org.kordamp.jipsy.ServiceProviderFor;
28
29 import javax.inject.Named;
30
31 import static griffon.util.AnnotationUtils.named;
32
33 /**
34 * @author Andres Almiray
35 * @since 2.0.0
36 */
37 @Named("pivot")
38 @ServiceProviderFor(Module.class)
39 public class PivotModule extends AbstractModule {
40 @Override
41 protected void doConfigure() {
42 // tag::bindings[]
43 bind(PivotWindowDisplayHandler.class)
44 .withClassifier(named("defaultWindowDisplayHandler"))
45 .to(DefaultPivotWindowDisplayHandler.class)
46 .asSingleton();
47
48 bind(PivotWindowDisplayHandler.class)
49 .withClassifier(named("windowDisplayHandler"))
50 .to(ConfigurablePivotWindowDisplayHandler.class)
51 .asSingleton();
52
53 bind(WindowManager.class)
54 .to(DefaultPivotWindowManager.class)
55 .asSingleton();
56
57 bind(UIThreadManager.class)
58 .to(PivotUIThreadManager.class)
59 .asSingleton();
60
61 bind(ActionManager.class)
62 .to(PivotActionManager.class)
63 .asSingleton();
64
65 bind(ActionFactory.class)
66 .to(PivotActionFactory.class)
67 .asSingleton();
68 // end::bindings[]
69 }
70 }
|