Example usage for com.google.gwt.gwtpages.client Pages init

List of usage examples for com.google.gwt.gwtpages.client Pages init

Introduction

In this page you can find the example usage for com.google.gwt.gwtpages.client Pages init.

Prototype

public static Pages init(PageLoader pageLoader, ApplicationPresenter applicationPresenter, HandlerManager bus,
            boolean monitorHistoryEvents) 

Source Link

Usage

From source file:com.google.gwt.gwtpages.demo.client.GWT_Pages_Demo.java

/**
 * This is the entry point method.//w  ww.j a v a2s.  c  o  m
 */
public void onModuleLoad() {
    // composite application presenter for use with the layouts demo page
    CompositeLayoutApplicationPresenter presenter = new CompositeLayoutApplicationPresenter(
            PageConstants.LAYOUT_DEFAULT).register(PageConstants.LAYOUT_DEFAULT, new DefaultLayoutPage())
                    .register(PageConstants.LAYOUT_NONE, new NoLayoutPage())
                    .register(PageConstants.LAYOUT_NAV_RIGHT, new RightNavLayoutPage());

    // initialize the pages settings
    Pages.init((DemoPageLoader) GWT.create(DemoPageLoader.class), // the class responsible for mapping page tokens to pages
            presenter, // the component that will actually render the pages
            new HandlerManager(null), true) // the event bus
            .addDefaultEventHandlers().add(this); // add default behavior if desired

    // make the initial page show up (and check the history token to go directly to a requested page and bypass the start
    // page if necessary
    Pages.get().showStartPage(true);
}

From source file:hudson.gwtmarketplace.client.GWT_Marketplace.java

License:Open Source License

/**
 * This is the entry point method./*w w w.j  a v a 2  s  . c o m*/
 */
public void onModuleLoad() {
    Pages.init((PageLoader) GWT.create(PageLoader.class), this.layoutPage = new LayoutPage(),
            new HandlerManager(null), true).addDefaultEventHandlers().add(new AuthenticationPageEventHandler());

    // load the current logged in user
    new LoginCommand() {
        @Override
        public void onSuccess(UserInfo result) {
            clearContent();
            RootPanel.get("content").add(layoutPage);
            Pages.get().showStartPage(true);
        }

        public void onFailure(Throwable e) {
            clearContent();
            RootPanel.get("content").add(layoutPage);
            Pages.get().showStartPage(false);
        };
    }.execute();
}