Example usage for com.google.gwt.activity.shared ActivityManager ActivityManager

List of usage examples for com.google.gwt.activity.shared ActivityManager ActivityManager

Introduction

In this page you can find the example usage for com.google.gwt.activity.shared ActivityManager ActivityManager.

Prototype

public ActivityManager(ActivityMapper mapper, EventBus eventBus) 

Source Link

Document

Create an ActivityManager.

Usage

From source file:accelerator.client.Main.java

License:Open Source License

private void loadMain(LoginInfo loginInfo) {
    mainPresenter = new MainPresenter(clientFactory);
    Shell shell = mainPresenter.getShell();
    shell.setLoginInfo(loginInfo);/*from w  w w . ja v a2 s .co  m*/

    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(shell);

    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    RootLayoutPanel.get().add(shell);
    historyHandler.handleCurrentHistory();
}

From source file:co.edu.udea.iw.rtf.client.Solicitudes.java

License:Open Source License

@SuppressWarnings("deprecation")
public void onModuleLoad() {
    Dictionary var = Dictionary.getDictionary("userInSession");
    UsuarioSingleton.setUpFromDictionary(var);
    // Create ClientFactory using deferred binding so we can replace with
    // different impls in gwt.xml
    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();
    // Start ActivityManager for the main widget with our ActivityMapper
    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appWidget);
    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, solicitudesPlace);
    historyHandler.register(placeController, eventBus, loginPlace);
    historyHandler.register(placeController, eventBus, asignarSolicitudPlace);
    historyHandler.register(placeController, eventBus, crearSolicitudPlace);
    if (UsuarioSingleton.getInstance().getLogin() != null) {
        historyHandler.register(placeController, eventBus, mainPagePlace);
    }/*from   ww  w . jav a2 s.  c  o  m*/
    RootPanel.get().add(appWidget);
    historyHandler.handleCurrentHistory();
}

From source file:com.acme.gwt.client.ioc.TvGuideClientModule.java

License:Apache License

@Provides
ActivityManager provideActivityManager(ActivityMapper mapper, EventBus eventBus) {
    return new ActivityManager(mapper, eventBus);
}

From source file:com.appspot.socialinquirer.client.SocialInquirer.java

License:Apache License

public void onModuleLoad() {
    final EventBus eventBus = clientFactory.getEventBus();
    final PlaceController placeController = clientFactory.getPlaceController();
    final UserRpcServiceAsync userService = clientFactory.getUserService();
    final EverScribeConstants constants = clientFactory.getConstants();
    GWT.runAsync(new RunAsyncCallback() {
        public void onFailure(Throwable caught) {
            UiUtils.showErrorDialog(constants, constants.errorCodeDownloadFailed());
        }/*from  w w w .ja  v a  2s .  com*/

        public void onSuccess() {

            // Start ActivityManager for the main widget with our
            // ActivityMapper
            ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
            ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
            // TODO-NM: Fix this.
            activityManager.setDisplay(appWidget);

            // Start PlaceHistoryHandler with our PlaceHistoryMapper
            final AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
            final PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);

            userService.getRandomQuote(new AsyncCallback<String>() {

                @Override
                public void onFailure(Throwable caught) {
                    RootPanel.get("quots").add(new HTML(
                            "<p>There is nothing more powerful than an idea whose time has come.</p>", true));
                }

                @Override
                public void onSuccess(String result) {
                    RootPanel.get("quots").add(new HTML("<p>" + result + "</p>", true));
                }
            });

            userService.getCurrentUser(new AsyncCallback<User>() {

                @Override
                public void onFailure(Throwable caught) {
                    MenuBar menu = createMenuBar(constants, null);

                    RootPanel.get("menu").add(menu);

                    RootPanel.get("content").add(appWidget);
                    // RootPanel.get("loginPanel").add(new HTML("<a
                    // href=\"/Auth?command=EvernoteAuth\"
                    // class=\"login\">Login with Evernote</a>"));

                    // handle exception;
                    historyHandler.register(placeController, eventBus, homePlace);
                    // Goes to place represented on URL or default place
                    historyHandler.handleCurrentHistory();
                }

                @Override
                public void onSuccess(User result) {
                    RootPanel.get("content").add(appWidget);

                    if (result != null) {
                        MenuBar menu = createMenuBar(constants, result);

                        RootPanel.get("menu").add(menu);
                        clientFactory.setUser(result);
                        historyHandler.register(placeController, eventBus, homePlace);
                    } else {
                        MenuBar menu = createMenuBar(constants, null);

                        RootPanel.get("menu").add(menu);
                        historyHandler.register(placeController, eventBus, homePlace);
                    }
                    // Goes to place represented on URL or default place
                    historyHandler.handleCurrentHistory();
                }
            });
        }
    });
    SearchUtils.loadSearchApi(new Runnable() {
        public void run() {
        }
    });
}

From source file:com.ariesmcrae.rel.client.RelationshipClient.java

License:Open Source License

public void onModuleLoad() {
    SimplePanel appWidget = new SimplePanel();
    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();

    new ActivityManager(new RelationshipActivityMapper(clientFactory), eventBus).setDisplay(appWidget);

    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(clientFactory.getPlaceController(), eventBus, new RelationshipPlace());

    RootPanel.get().add(appWidget);/*  www.ja v  a2  s  .com*/

    historyHandler.handleCurrentHistory();
}

From source file:com.eatrightapp.admin.client.Admin.java

License:Apache License

public void onModuleLoad() {
    AdminClientFactory clientFactory = GWT.create(AdminClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();
    requestFactory = GWT.create(EatRightAppRequestFactory.class);
    requestFactory.initialize(eventBus);

    // Start ActivityManager for the main widget with our ActivityMapper
    ActivityMapper activityMapper = new AppActivityMapper(clientFactory, requestFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appWidget);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, userAccountsPlace);

    DOM.removeChild(RootPanel.getBodyElement(), DOM.getElementById("admin_content"));
    RootLayoutPanel.get().add(appWidget);

    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();
}

From source file:com.eatrightapp.publicweb.client.PublicWeb.java

License:Apache License

public void onModuleLoad() {
    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    // Start ActivityManager for the main widget with our ActivityMapper
    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(appWidget);

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, userAccountsPlace);

    DOM.removeChild(RootPanel.getBodyElement(), DOM.getElementById("publicweb_content"));
    RootPanel.get().add(appWidget);//from   ww w .  j a v  a2  s  . co  m

    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();
}

From source file:com.emitrom.gwt4.touch2.demo.client.KitchenSinkEntryPoint.java

License:Open Source License

@SuppressWarnings("deprecation")
private void loadTouch() {

    ClientFactory clientFactory = GWT.create(ClientFactory.class);
    EventBus eventBus = clientFactory.getEventBus();
    PlaceController placeController = clientFactory.getPlaceController();

    // Start ActivityManager for the main widget with our ActivityMapper
    ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
    ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
    activityManager.setDisplay(vp);/*w ww . ja va  2s .co m*/

    // Start PlaceHistoryHandler with our PlaceHistoryMapper
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(placeController, eventBus, defaultPlace);

    RootPanel.get().add(vp);
    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();

}

From source file:com.eucalyptus.webui.client.ClientFactoryImpl.java

License:Open Source License

@Override
public ActivityManager getMainActivityManager() {
    if (mainActivityManager == null) {
        ActivityMapper activityMapper = new MainActivityMapper(this);
        mainActivityManager = new ActivityManager(activityMapper, mainEventBus);
    }/*www .  j  a v a  2s  .  c  o m*/
    return mainActivityManager;
}

From source file:com.eucalyptus.webui.client.EucalyptusApp.java

License:Open Source License

public void start(final AcceptsOneWidget container) {
    ActivityMapper activityMapper = new LifecycleActivityMapper(this.clientFactory);
    lifecycleActivityManager = new ActivityManager(activityMapper, this.clientFactory.getLifecycleEventBus());
    lifecycleActivityManager.setDisplay(container);
    // First check special action activities
    checkAction();/*from w  w  w  .j  a v  a2 s.  co m*/
}