litesoft
@ 713
litesoft / trunk / GWT_Sandbox / MultiModuleSingleSrc / main / src / org / litesoft / sandbox / multimodule / client / main / Main.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
package org.litesoft.sandbox.multimodule.client.main; import org.litesoft.GWT.client.pavsupport.*; import org.litesoft.GWT.client.util.*; import org.litesoft.GWT.client.widgets.*; import org.litesoft.sandbox.multimodule.client.foundation.places.*; import org.litesoft.sandbox.multimodule.client.foundation.support.*; import org.litesoft.sandbox.multimodule.client.main.home.*; import com.google.gwt.core.client.*; import com.google.gwt.user.client.*; import com.google.gwt.user.client.ui.*; import com.googlecode.gwtphonegap.client.*; /** * Entry point classes define <code>onModuleLoad()</code> */ public class Main implements EntryPoint { public static final String VERSION = "1.0"; @Override public void onModuleLoad() { System.out.println( "Main.onModuleLoad" ); ActivityFactoryRegistry.register( new CachedViewSynchronousActivityFactory<ClientFactory, HomeView, PlaceHome>( EnumPlaces.Home ) { @Override public HomeView createView() { return new HomeViewImpl(); } @Override public Activity createActivity( ClientFactory pCommonActivityParam, HomeView pView, PlaceHome pPlace ) { return new HomeActivity( pCommonActivityParam, pView, pPlace ); } } ); GWT.setUncaughtExceptionHandler( new GWT.UncaughtExceptionHandler() { @Override public void onUncaughtException( Throwable e ) { Window.alert( "uncaught: " + // e.getLocalizedMessage() ); e.getMessage() ); } } ); final PhoneGap phoneGap = GWT.create( PhoneGap.class ); phoneGap.addHandler( new PhoneGapAvailableHandler() { @Override public void onPhoneGapAvailable( PhoneGapAvailableEvent event ) { startShowCase( phoneGap ); } } ); phoneGap.addHandler( new PhoneGapTimeoutHandler() { @Override public void onPhoneGapTimeout( PhoneGapTimeoutEvent event ) { Window.alert( "can not load Phonegap\nvs " + VERSION ); } } ); phoneGap.initializePhoneGap(); } private void startShowCase( PhoneGap phoneGap ) { NeverEmptyHtmlEscapingLabel zMessageUserSinkLabel = new NeverEmptyHtmlEscapingLabel(); SimplePanel zAppWidget = new SimplePanel(); RootPanel.get( "CenteredContent" ).add( zAppWidget ); RootPanel.get( "Message" ).add( zMessageUserSinkLabel ); ClientFactoryImpl clientFactory = new ClientFactoryImpl(); // GWT.create( ClientFactory.class ); PlaceChangerWithCurrentUrlSupport pam = new PlaceActivityManager<ClientFactory>( zAppWidget, clientFactory ); clientFactory.setPlaceChanger( pam ); clientFactory.setMessageUserSink( new StyledSafeTextMessageUserSink( zMessageUserSinkLabel ) ); // Goes to the place represented on URL else default place pam.goToCurrentUrl(); } } |