| 
01 /*02  * Copyright 2008-2015 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.lanterna;
 17
 18 import com.googlecode.lanterna.gui.GUIScreen;
 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.lanterna.LanternaWindowDisplayHandler;
 24 import org.codehaus.griffon.runtime.core.injection.AbstractModule;
 25 import org.codehaus.griffon.runtime.lanterna.controller.LanternaActionManager;
 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("lanterna")
 37 @ServiceProviderFor(Module.class)
 38 public class LanternaModule extends AbstractModule {
 39     @Override
 40     protected void doConfigure() {
 41         // tag::bindings[]
 42         bind(GUIScreen.class)
 43             .toProvider(GUIScreenProvider.class)
 44             .asSingleton();
 45
 46         bind(LanternaWindowDisplayHandler.class)
 47             .withClassifier(named("defaultWindowDisplayHandler"))
 48             .to(DefaultLanternaWindowDisplayHandler.class)
 49             .asSingleton();
 50
 51         bind(LanternaWindowDisplayHandler.class)
 52             .withClassifier(named("windowDisplayHandler"))
 53             .to(ConfigurableLanternaWindowDisplayHandler.class)
 54             .asSingleton();
 55
 56         bind(WindowManager.class)
 57             .to(DefaultLanternaWindowManager.class)
 58             .asSingleton();
 59
 60         bind(UIThreadManager.class)
 61             .to(LanternaUIThreadManager.class)
 62             .asSingleton();
 63
 64         bind(ActionManager.class)
 65             .to(LanternaActionManager.class)
 66             .asSingleton();
 67         // end::bindings[]
 68     }
 69 }
 |