void bindCommonModelProviders() { // Options bind(OptionsProvider.class).in(Singleton.class); } protected void bindConfiguratorIntegration(Class<? extends Configurator> configurator) {
/** * Binds the {@link JsonRegistry}. * * @see com.google.gwt.inject.client.AbstractGinModule#configure() */ @Override protected void configure() { bind(JsonRegistry.class).in(Singleton.class); } }
/** * Binds the {@link XmlRegistry}. * * @see com.google.gwt.inject.client.AbstractGinModule#configure() */ @Override protected void configure() { bind(XmlRegistry.class).in(Singleton.class); } }
@Override protected void configure() { bind(SocialAuthenticator.class).in(Singleton.class); } }
private void bindFrontendInfrastructure() { bind(Frontend.class).in(Singleton.class); requestStaticInjection(Frontend.InstanceHolder.class); bind(VdcOperationManager.class).in(Singleton.class); bind(OperationProcessor.class).in(Singleton.class); bind(CommunicationProvider.class).to(GWTRPCCommunicationProvider.class).in(Singleton.class); bind(XsrfRpcRequestBuilder.class).in(Singleton.class); }
/** * Binds {@code type} to its {@code impl} so that injecting any of these yields the singleton {@code impl} instance. */ protected <T> void bindTypeAndImplAsSingleton(Class<T> type, Class<? extends T> impl) { bind(type).to(impl); bind(impl).in(Singleton.class); }
protected void bindCommonIntegration() { bind(ITypeResolver.class).to(UiCommonDefaultTypeResolver.class).asEagerSingleton(); bind(FrontendEventsHandlerImpl.class).in(Singleton.class); bind(FrontendFailureEventListener.class).in(Singleton.class); bind(ILogger.class).to(LoggerImpl.class).in(Singleton.class); // User Options bind(OptionsModel.class).in(Singleton.class); bindCommonModelProviders(); bindConsoles(); }
protected void bindResourceConfiguration( Class<? extends CommonApplicationConstants> constants, Class<? extends CommonApplicationMessages> messages, Class<? extends CommonApplicationResources> resources, Class<? extends CommonApplicationTemplates> templates, Class<? extends DynamicMessages> dynamicMessages) { bindTypeAndImplAsSingleton(CommonApplicationConstants.class, constants); bindTypeAndImplAsSingleton(CommonApplicationMessages.class, messages); bindTypeAndImplAsSingleton(CommonApplicationResources.class, resources); bindTypeAndImplAsSingleton(CommonApplicationTemplates.class, templates); bindTypeAndImplAsSingleton(DynamicMessages.class, dynamicMessages); bind(AppErrors.class).in(Singleton.class); bind(VdsmErrors.class).in(Singleton.class); }
/** * Convenience method for binding a singleton presenter with its view and its * proxy, when using automatically generated proxy classes. * * @param <P> The {@link Presenter} class type. * @param <V> The {@link View} interface type. * @param <Proxy_> The {@link Proxy} type. * @param presenterImpl The {@link Presenter} implementation (a singleton). * @param view The {@link View} interface. * @param viewImpl The {@link View} implementation (a singleton). * @param proxy The {@link Proxy} interface, which will lead to an * automatically generated proxy classes. */ protected <P extends Presenter<?, ?>, V extends View, Proxy_ extends Proxy<P>> void bindPresenter( Class<P> presenterImpl, Class<V> view, Class<? extends V> viewImpl, Class<Proxy_> proxy) { bind(presenterImpl).in(Singleton.class); bind(viewImpl).in(Singleton.class); bind(proxy).asEagerSingleton(); bind(view).to(viewImpl); }
/** * Convenience method for binding a singleton presenter with its proxy, when * using automatically generated proxy classes and non-singleton views. * <p/> * <b>Important!</b> This is only be meant to be used by presenters associated * with non-singleton views, for example when the same view class is reused * with many presenters. As such, you will need to also use the * {@link #bindSharedView} method. If the view class is use only by one * presenter, you should consider using * {@link #bindPresenter(Class, Class, Class, Class)} instead. * * @param <P> The {@link Presenter} class type. * @param <Proxy_> The {@link Proxy} type. * @param presenterImpl The {@link Presenter} implementation (a singleton). * @param proxy The {@link Proxy} interface, which will lead to an * automatically generated proxy classes. */ protected <P extends Presenter<?, ?>, Proxy_ extends Proxy<P>> void bindPresenter( Class<P> presenterImpl, Class<Proxy_> proxy) { bind(presenterImpl).in(Singleton.class); bind(proxy).asEagerSingleton(); }
/** * Convenience method for binding a singleton presenter with its view and its * proxy, when using custom-made proxy classes. * * @param <P> The {@link Presenter} class type. * @param <V> The {@link View} interface type. * @param <Proxy_> The {@link Proxy} type. * @param presenterImpl The {@link Presenter} implementation (a singleton). * @param view The {@link View} interface. * @param viewImpl The {@link View} implementation (a singleton). * @param proxy The {@link Proxy} interface. * @param proxyImpl The {@link Proxy} implementation (a singleton). */ protected <P extends Presenter<?, ?>, V extends View, Proxy_ extends Proxy<P>> void bindPresenterCustomProxy( Class<P> presenterImpl, Class<V> view, Class<? extends V> viewImpl, Class<Proxy_> proxy, Class<? extends Proxy_> proxyImpl) { bind(presenterImpl).in(Singleton.class); bind(viewImpl).in(Singleton.class); bind(proxyImpl).asEagerSingleton(); bind(view).to(viewImpl); bind(proxy).to(proxyImpl); }
/** * Convenience method for binding a singleton presenter with its view and its * proxy, when using automatically generated proxy classes. * * @param <P> The {@link Presenter} interface type. * @param <V> The {@link View} interface type. * @param <Proxy_> The {@link Proxy} type. * @param presenter The {@link Presenter} interface. * @param presenterImpl The {@link Presenter} implementation (a singleton). * @param view The {@link View} interface. * @param viewImpl The {@link View} implementation (a singleton). * @param proxy The {@link Proxy} interface, which will lead to an * automatically generated proxy classes. */ protected <P extends Presenter<?, ?>, V extends View, Proxy_ extends Proxy<P>> void bindPresenter( Class<P> presenter, Class<? extends P> presenterImpl, Class<V> view, Class<? extends V> viewImpl, Class<Proxy_> proxy) { bind(presenterImpl).in(Singleton.class); bind(viewImpl).in(Singleton.class); bind(proxy).asEagerSingleton(); bind(presenter).to(presenterImpl); bind(view).to(viewImpl); }
/** * Convenience method for binding a singleton {@link PresenterWidget} with its * {@link View}. * <p/> * <b>Important!</b> If you want to use the same {@link PresenterWidget} in * many different places, you should consider making it non-singleton with * {@link #bindPresenterWidget}. It is possible to use the same singleton * {@link PresenterWidget} in different presenters, as long as these are not * simultaneously visible. Also, if you do this, you must make sure to set the * singleton presenter widget as content in its containing presenter * {@link Presenter#onReveal} and to remove it in the * {@link Presenter#onHide}. * * @param <P> The {@link PresenterWidget} class type. * @param <V> The {@link View} interface type. * @param presenterImpl The {@link PresenterWidget} implementation (a * singleton). * @param view The {@link View} interface. * @param viewImpl The {@link View} implementation (a singleton). */ protected <P extends PresenterWidget<?>, V extends View> void bindSingletonPresenterWidget( Class<P> presenterImpl, Class<V> view, Class<? extends V> viewImpl) { bind(presenterImpl).in(Singleton.class); bind(view).to(viewImpl).in(Singleton.class); } }
/** * Convenience method for binding a singleton presenter with its proxy, when * using automatically generated proxy classes and non-singleton views. * <p/> * <b>Important!</b> This is only be meant to be used by presenters associated * with non-singleton views, for example when the same view class is reused * with many presenters. As such, you will need to also use the * {@link #bindSharedView} method. If the view class is use only by one * presenter, you should consider using * {@link #bindPresenter(Class, Class, Class, Class, Class)} instead. * * @param <P> The {@link Presenter} interface type. * @param <Proxy_> The {@link Proxy} type. * @param presenterImpl The {@link Presenter} interface. * @param proxy The {@link Proxy} interface, which will lead to an * automatically generated proxy classes. */ protected <P extends Presenter<?, ?>, Proxy_ extends Proxy<P>> void bindPresenter( Class<P> presenter, Class<? extends P> presenterImpl, Class<Proxy_> proxy) { bind(presenterImpl).in(Singleton.class); bind(proxy).asEagerSingleton(); bind(presenter).to(presenterImpl); }
@Override protected void configure() { bind(ProcessesOutputRestorer.class).asEagerSingleton(); bind(MachineFailNotifier.class).asEagerSingleton(); bind(MachineChooserView.class).to(MachineChooserViewImpl.class); bind(ModuleHolder.class).in(Singleton.class); bindConstant() .annotatedWith(Names.named("machine.extension.api_port")) .to(Constants.WS_AGENT_PORT); } }
/** * Binds the components related with the federation configuration path */ private void bindFederation() { bindPresenter(FederationPresenter.class, FederationPresenter.MyView.class, NewFederationView.class, FederationPresenter.MyProxy.class); bind(FederationStore.class).to(FederationStoreImpl.class).in(Singleton.class); bind(DeploymentFederationStore.class).to(DeploymentFederationStoreImpl.class).in(Singleton.class); bind(DeploymentManager.class).in(Singleton.class); bind(FederationManager.class); } }
@Override protected void configure() { install(new DefaultModule.Builder() .tokenFormatter(RouteTokenFormatter.class) .defaultPlace(NameTokens.HOME) .errorPlace(NameTokens.HOME) .unauthorizedPlace(NameTokens.HOME) .build()); install(new RestDispatchAsyncModule()); install(new ApplicationModule()); bind(ResourceLoader.class).asEagerSingleton(); bindConstant().annotatedWith(RestApplicationPath.class).to("/api"); bind(MyGatekeeper.class).in(Singleton.class); } }
@Override protected void configure() { bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class); bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.class); bind(GoogleAnalytics.class).to(GoogleAnalyticsImpl.class).in(Singleton.class); // You will need to add this if you are using MVP // bind(RootPresenter.class).asEagerSingleton(); /** * this makes the sldeditor the default place to open. * <p>Rebind this if you want something else. */ bind(PlaceManager.class).to(SldEditorPlaceManager.class).in(Singleton.class); /** * Contains service calls to parse / validate / load / save SLD data */ bind(SldManager.class).to(SldManagerImpl.class).in(Singleton.class); /** * i18n */ bind(SldEditorExpertMessages.class).in(Singleton.class); } }
@Override protected void configure() { bind(AuthenticatedUser.class).toProvider(ClientSideAuthProvider.class); bind(RemoteCommandServiceAsync.class).toProvider(RemoteServiceProvider.class).in(Singleton.class); bind(Dispatcher.class).annotatedWith(Remote.class).to(RemoteDispatcher.class).in(Singleton.class); bind(DispatchEventSource.class).to(CacheManager.class); bind(PageStateSerializer.class).in(Singleton.class); bind(EventBus.class).to(LoggingEventBus.class).in(Singleton.class); bind(StateProvider.class).to(GxtStateProvider.class); bind(Frame.class).annotatedWith(Root.class).to(AppFrameSet.class); bind(GalleryView.class).to(GalleryPage.class); }