Example usage for com.google.gwt.place.shared PlaceHistoryHandler PlaceHistoryHandler

List of usage examples for com.google.gwt.place.shared PlaceHistoryHandler PlaceHistoryHandler

Introduction

In this page you can find the example usage for com.google.gwt.place.shared PlaceHistoryHandler PlaceHistoryHandler.

Prototype

public PlaceHistoryHandler(PlaceHistoryMapper mapper) 

Source Link

Document

Create a new PlaceHistoryHandler with a DefaultHistorian .

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

    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.java  2s  .co  m
    RootPanel.get().add(appWidget);
    historyHandler.handleCurrentHistory();
}

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

License:Apache License

@Provides
PlaceHistoryHandler providePlaceHistoryHandler(PlaceHistoryMapper mapper, PlaceController placeController,
        EventBus eventBus, @DefaultPlace Place defaultPlace) {
    PlaceHistoryHandler phh = new PlaceHistoryHandler(mapper);
    phh.register(placeController, eventBus, defaultPlace);
    return phh;//from  w w w.j  a  v  a 2  s  . com
}

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());
        }//  ww w  . j av a  2 s  . co  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.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);/*from ww  w.  j av a 2s .c om*/

    historyHandler.handleCurrentHistory();
}

From source file:com.beyobe.client.MgwtAppEntryPoint.java

License:Apache License

private void start() {

    //set viewport and other settings for mobile
    MGWT.applySettings(MGWTSettings.getAppSetting());

    App.registerEvents();//from w  w w  .  ja v  a2  s. c om
    AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
    final PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    historyHandler.register(App.placeController, App.eventBus, new LoginPlace());

    //this will create a link element at the end of head
    MGWTStyle.getTheme().getMGWTClientBundle().getMainCss().ensureInjected();

    //append your own css as last thing in the head
    //      MGWTStyle.injectStyleSheet("tagtheday.css");

    if ((MGWT.getOsDetection().isTablet())) {
        // very nasty workaround because GWT does not corretly support
        // @media
        StyleInjector.inject(AppBundle.INSTANCE.css().getText());

        createTabletDisplay();
    } else {
        createPhoneDisplay();

    }
    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  va  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);/*from  w ww  . java 2 s.c o  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.github.gwtbootstrap.showcase.client.Showcase.java

License:Apache License

public void onModuleLoad() {

    CustomResources res = GWT.create(CustomResources.class);
    res.showcase().ensureInjected();//from   w  w w .j  a v a2s  .  c o  m
    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);
    }
}