@Override protected void configure() { install(new DefaultModule.Builder() .placeManager(DefaultPlaceManager.class) .tokenFormatter(RouteTokenFormatter.class) .build()); bind(CurrentUser.class).asEagerSingleton(); bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.getHome()); bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.getHome()); bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.getLogin()); install(new ServiceModule()); install(new LoginModule()); install(new ApplicationModule()); } }
@Override protected void configure() { // dummy, redefine in your application install(new DefaultModule.Builder().placeManager(OwnPlaceManagerImpl.class) .defaultPlace(NameTokens.LOGIN).errorPlace(NameTokens.LOGIN) .unauthorizedPlace(NameTokens.LOGIN).build()); this.bindPresenter(NavigationPresenter.class, NavigationPresenter.MyView.class, TreeNavigationView.class, NavigationPresenter.MyProxy.class); this.bind(User.class).to(MinimumUser.class).in(Singleton.class); this.bind(Session.class).to(DummySession.class).in(Singleton.class); this.bind(NavigationStructure.class).to(DummyNavigationStructure.class).in(Singleton.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() { // dummy, redefine in your application install(new DefaultModule.Builder().placeManager(OwnPlaceManagerImpl.class) .defaultPlace(NameTokens.LOGIN).errorPlace(NameTokens.LOGIN) .unauthorizedPlace(NameTokens.LOGIN).build()); this.bindPresenter(NavigationPresenter.class, NavigationPresenter.MyView.class, TreeNavigationView.class, NavigationPresenter.MyProxy.class); this.bind(User.class).to(MinimumUser.class).in(Singleton.class); this.bind(Session.class).to(DummySession.class).in(Singleton.class); this.bind(NavigationStructure.class).to(DummyNavigationStructure.class).in(Singleton.class); } }
public class ClientModule extends AbstractPresenterModule { @Override protected void configure() { bind(RestyGwtConfig.class).asEagerSingleton(); install(new DefaultModule.Builder().defaultPlace(Routing.PAGE.url).errorPlace(Routing.PAGE.url).unauthorizedPlace(Routing.LOGIN.url).tokenFormatter(RouteTokenFormatter.class).build()); install(new AppModule()); bind(CurrentUser.class).in(Singleton.class); bind(IsAdminGatekeeper.class).in(Singleton.class); bind(UserLoginGatekeeper.class).in(Singleton.class); } }
/** * When instantiating the module this way be sure to read {@link DefaultPlaceManager} and manually bind the required * constants. Consider using {@link DefaultModule.Builder} if you need to use a different implementation than the * default one for a binding. * <p/> * <b>Important!</b> If you use this class, don't forget to bind {@link DefaultPlace}, {@link ErrorPlace} and {@link * UnauthorizedPlace} to name tokens associated to a presenter.<br/> */ public DefaultModule() { this(new Builder()); }