My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
QuickStart  

Featured
Updated Aug 14, 2010 by joe...@gmail.com

#Instructions on how get GWT Pages up and running quickly

Standard Setup

Add Inherit entry

  <inherits name="com.google.gwt.gwtpages.GWT_Pages" />
  <!-- this next part is only needed if you are using GIN -->
  <inherits name="com.google.gwt.gwtpages.GWT_Pages_GIN" />

Create a Page Loader

Page loaders (implementing ) are used retrieve page instances based on page tokens. Common page loaders are StandardPageLoader, AsyncPageLoader, StandardGinPageLoader, AsyncGinPageLoader. You would normally extend one of these and register page classes during the init(Pages) method. Note: These page loaders must be instantiated using GWT.create(...).

Create an Application Presenter

An application presenter must implement com.google.gwt.gwtpages.client.page.ApplicationPresenter. This class is responsible for adding the pages to the DOM structure of the application. You can write your own or use one of the provided classes. SimplePanelApplicationPresenter can be used if you have no layout to add to the pages. CompositeApplicationPresenter can be used if you would like more than 1 application presenter for your application (if you have different pages with different layouts).

Configure GWT Pages

To configure GWT Pages for your application (Usually done in the entry point class), you need to make the following call:

Pages.init(
	// the class responsible for mapping page tokens to pages and instantiating the page
	(MyPageLoader) GWT.create(MyPageLoader.class), 

	// this is used to add the pages to the DOM structure
	myApplicationPresenter,

 	// GWT Pages uses a HandlerManager to fire common events
	new HandlerManager(null),

	// should GWT Pages automatically monitor history token changes?
	true);

	// Pages.init(...) returns a Pages instance so the following could be chained
	// we'll add the default event handlers (to add support for Messages)
	Pages.get().addDefaultEventHandlers();

	// Now, we will tell Pages to show the start page but check the current history
	// token and just to a specific page if desired
	Pages.get().showStartPage(true);

View a Concrete Example

Powered by Google Project Hosting