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

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

Introduction

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

Prototype

public void setDisplay(AcceptsOneWidget display) 

Source Link

Document

Sets the display for the receiver, and has the side effect of starting or stopping its monitoring the event bus for place change events.

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);//w  ww .  j a v a  2s  .c  om

    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   w  w w. jav a 2  s  .c  o m*/
    RootPanel.get().add(appWidget);
    historyHandler.handleCurrentHistory();
}

From source file:com.acme.gwt.client.widget.TvGuideAppShell.java

License:Apache License

@Inject
public TvGuideAppShell(ActivityManager activityManager) {
    initWidget(uiBinder.createAndBindUi(this));

    activityManager.setDisplay(this);
}

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  www.jav a2s  .c  o m*/

        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.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 ava  2s .c o  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);

    // 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);//  w ww .j  a  v  a  2 s.  co m
    // Goes to the place represented on URL else default place
    historyHandler.handleCurrentHistory();

}

From source file:com.github.gwtbootstrap.showcase.client.Showcase.java

License:Apache License

public void onModuleLoad() {

    CustomResources res = GWT.create(CustomResources.class);
    res.showcase().ensureInjected();// ww w  .jav  a2s  . c  om
    ClientFactory factory = GWT.create(ClientFactory.class);

    subnav = factory.getSubnav();

    initWidget(uiBinder.createAndBindUi(this));

    ActivityMapper activityMapper = new AppActivityMapper(factory);

    ActivityManager activityManager = new ActivityManager(activityMapper, factory.getEventBus());

    activityManager.setDisplay(main);
    PlaceHistoryMapper mapper = factory.getPlaceHistoryMapper();
    final PlaceHistoryHandler handler = new PlaceHistoryHandler(mapper);
    handler.register(factory.getPlaceController(), factory.getEventBus(), new OverviewPlace(""));

    final Map<Menus, NavLink> map = new EnumMap<Menus, NavLink>(Menus.class);
    for (Menus menu : Menus.values()) {
        NavLink link = new NavLink(menu.getDisplay());
        link.setHref("#" + menu.getName() + ":");

        if (menu == Menus.GWT) {
            nav.add(new Divider());
        }
        nav.add(link);

        map.put(menu, link);
    }

    factory.getEventBus().addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() {

        @Override
        public void onPlaceChange(PlaceChangeEvent event) {
            Place place = event.getNewPlace();

            if (place instanceof HasMenuPlace) {
                HasMenuPlace menuPlace = (HasMenuPlace) place;

                for (Map.Entry<Menus, NavLink> entry : map.entrySet()) {
                    if (entry.getKey().equals(menuPlace.getMenu())) {
                        entry.getValue().setActive(true);
                    } else {
                        entry.getValue().setActive(false);
                    }
                }

            }
        }
    });

    // addSectionToContainer("Get Started", "setup", new Setup());
    // addSectionToContainer("Get Support", "support", new Support());
    // addSectionToContainer("Buttons", "buttons", new Buttons());
    // addSectionToContainer("Grid System", "gridSystem", new GridSystem());
    // addSectionToContainer("Navigation", "navigation", new Navigation());
    // addSectionToContainer("Hero Unit", "hero", new HeroUnit());
    // addSectionToContainer("Forms", "forms", new Forms());
    // addSectionToContainer("Page Header", "pageheader", new PageHeader());
    // addSectionToContainer("Progress Bar", "progressbar", new
    // ProgressBar());
    // addSectionToContainer("Alerts", "alerts", new Alerts());
    // addSectionToContainer("Pagination", "pagination", new Pagination());
    // addSectionToContainer("Dropdown", "dropdown", new Dropdown());
    // addSectionToContainer("Modal", "modal", new Modal());
    // addSectionToContainer("Datepicker", "datepicker", new Datepicker());
    // addSectionToContainer("Tooltip", "tooltip", new Tooltips());
    // addSectionToContainer("Popover", "popover", new Popovers());
    // addSectionToContainer("Icons", "icons", new Icons());

    RootPanel.get("content").add(this);
    Document doc = Document.get();
    ScriptElement script = doc.createScriptElement();
    script.setSrc("https://apis.google.com/js/plusone.js");
    script.setType("text/javascript");
    script.setLang("javascript");
    doc.getBody().appendChild(script);

    //        github_buttons
    //                .getElement()
    //                .setInnerHTML(
    //                        "<iframe src=\"http://ghbtns.com/github-btn.html?user=gwtbootstrap&repo=gwt-bootstrap&type=watch&count=true\"\n"
    //                                + "                                allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"110px\" height=\"20px\"></iframe>"
    //                                + "<br /><iframe src=\"http://ghbtns.com/github-btn.html?user=gwtbootstrap&repo=gwt-bootstrap&type=fork&count=true\"\n"
    //                                + "  allowtransparency=\"true\" frameborder=\"0\" scrolling=\"0\" width=\"95px\" height=\"20px\"></iframe>");

    JavaScriptInjector.inject(
            "!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"//platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");");
    JavaScriptInjector.inject(
            "(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = \"//connect.facebook.net/en_US/all.js#xfbml=1\";fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));");

    String token = History.getToken();
    if (!token.equals("")) {
        History.newItem("");
        History.newItem(token);
    }
}

From source file:com.goodow.wave.client.shell.WaveShell.java

License:Apache License

@Inject
WaveShell(@Default final SimpleActivityMapper centerActivityMapper, final EventBus eventBus) {
    logger.finest("init start");
    initWidget(uiBinder.createAndBindUi(this));
    // topBar.add(waveWarning);
    Element loading = Document.get().getElementById("loading");
    if (loading != null) {
        loading.removeFromParent();/*from   www . ja v a2  s . c o m*/
    }
    RootPanel.get().add(this);

    ActivityManager activityManager = new ActivityManager(centerActivityMapper, eventBus);
    activityManager.setDisplay(container);

    logger.finest("init end");
}

From source file:com.goodow.web.dev.client.ui.ShellUiDev.java

License:Apache License

@Inject
ShellUiDev(@Default final SimpleActivityMapper centerActivityMapper, final EventBus eventBus) {
    logger.finest("init start");
    ActivityManager activityManager = new ActivityManager(centerActivityMapper, eventBus);
    this.ensureDebugId("root");
    getElement().getStyle().setOverflowY(Overflow.SCROLL);
    activityManager.setDisplay(this);
    logger.finest("init end");
}