package votorola.a.web.gwt; // Copyright 2012-2013, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Window; import votorola.g.web.gwt.*; /** The GWT library module for Votorola specific application code. An instance of this * class is automatically constructed and invoked per module definition AMod.gwt.xml. It then calls * global JavaScript function voGWTConfig.a if it is defined. Here is an * example function definition suitable for use in the configuration script {@linkplain * GWTConfig gwt.js}:
  *
  *     voGWTConfig.a = function()
  *     {
  *         a_web_gwt_App_setServletContextLocation( 'http://YOUR.DOM:8080/v' );
  *         a_web_gwt_PollwikiG_setLocation( 'http://YOUR.DOM/wiki' );
  *         a_web_gwt_PollwikiG_setPipeRecognizer( 'PREFIX', 'SUFFIX' );
  *         // and so on
  *     };
* * @see List of GWTConfigCallback methods */ public final @GWTConfig class AMod implements EntryPointS { /** Answers whether this module's {@linkplain GWTConfigCallback configurable classes} are * currently being forced to initialize in preparation for configuration. This is * for asserting in boilerplate code that is liable to be incorrectly copied. If you * see the corresponding assertion error, then simply add the offending class to * {@linkplain #onModuleLoad() onModuleLoad}'s forced initialization. */ static boolean isForcedInit() { return isForcedInit; } private static boolean isForcedInit; // - E n t r y - P o i n t ------------------------------------------------------------ public void onModuleLoad() { // if( 1 == 2 ) // TEST GWT.setUncaughtExceptionHandler( new GWT.UncaughtExceptionHandler() { public void onUncaughtException( final Throwable t ) { GWTX.handleUncaughtException( t ); } }); isForcedInit = true; try // force class init prior to callback from config script gwt.js { App.forceInitClass(); PollwikiG.forceInitClass(); } finally { isForcedInit = false; } configureJS(); new App(); EntryPointS.U.schedule( AMod.this ); } // - S c h e d u l e r . S c h e d u l e d - C o m m a n d ---------------------------- public void execute() { if( App.getServletContextLocation() == null ) { Window.alert( // fail quickly "no servlet context, did page author call a_web_gwt_App_setServletContextLocation?" ); } } //// P r i v a t e /////////////////////////////////////////////////////////////////////// private static native void configureJS() /*-{ var f; try{ f = $wnd.voGWTConfig.a; } catch( e ) {} // in case parents undefined if( f ) f(); }-*/; }