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

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

Introduction

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

Prototype

public void handleCurrentHistory() 

Source Link

Document

Handle the current history token.

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  ww w  .ja  v  a 2s  .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.  j a v  a 2 s .  c o m
    RootPanel.get().add(appWidget);
    historyHandler.handleCurrentHistory();
}

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 .j ava 2 s  . 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.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  .  j a  v a2  s . co  m

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

    // 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.j  ava2s .  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.google.gwt.sample.mobilewebapp.client.App.java

License:Apache License

/**
 * Initialize browser history / bookmarking. If LocalStorage is available, use
 * it to make the user's default location in the app the last one seen.
 */// w  ww  .  j a  va 2 s. c o m
private void initBrowserHistory(final AppPlaceHistoryMapper historyMapper, PlaceHistoryHandler historyHandler,
        TaskListPlace defaultPlace) {

    Place savedPlace = null;
    if (storage != null) {
        try {
            // wrap in try-catch in case stored value is invalid
            savedPlace = historyMapper.getPlace(storage.getItem(HISTORY_SAVE_KEY));
        } catch (Throwable t) {
            // ignore error and use the default-default
        }
    }
    if (savedPlace == null) {
        savedPlace = defaultPlace;
    }
    historyHandler.register(placeController, eventBus, savedPlace);

    /*
     * Go to the place represented in the URL. This is what makes bookmarks
     * work.
     */
    historyHandler.handleCurrentHistory();

    /*
     * Monitor the eventbus for place changes and note them in LocalStorage for
     * the next launch.
     */
    if (storage != null) {
        eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() {
            public void onPlaceChange(PlaceChangeEvent event) {
                storage.setItem(HISTORY_SAVE_KEY, historyMapper.getToken(event.getNewPlace()));
            }
        });
    }
}

From source file:com.google.gwt.sample.mvpademo.client.MVP_AP.java

private void startApp() {
    PhonePlaceHistoryMapper historyMapper = GWT.create(PhonePlaceHistoryMapper.class);
    final PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
    createPhoneDisplay(clientFactory);/*from   w  w w  . j  av  a  2  s  .  c  o m*/
    historyHandler.register(clientFactory.getPlaceController(), clientFactory.getEventBus(), new HomePlace());
    historyHandler.handleCurrentHistory();
}