package votorola.s.gwt.scene; // Copyright 2011-2012, 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.dom.client.*; import votorola.a.web.gwt.*; /** The GWT entry module for launching Crossforum Theatre (both stage and scenes) as a * stand-alone GWT application. An instance of this class is automatically constructed * and invoked per module definition SceneIn.gwt.xml. It then calls global JavaScript function * voGWTConfig.s_gwt_scene if it is defined. Here is an example function * definition suitable for use in the configuration script {@linkplain GWTConfig * gwt.js}:
  *
  *     voGWTConfig.s_gwt_scene = function()
  *     {
  *         s_gwt_scene_Scenes_setUseRAC( true );
  *         s_gwt_scene_geo_Geomap_setDefaultBaseLayerName( 'Osmarender OSM' );
  *         // and so on
  *     };
* *

See the complete list of configuration * callacks. Usage instructions are provided for each.

*/ public final @GWTConfig class SceneIn 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. */ public static boolean isForcedInit() { return isForcedInit; } private static boolean isForcedInit; // - E n t r y - P o i n t ------------------------------------------------------------ public final void onModuleLoad() { isForcedInit = true; try // force class init prior to callback from config script gwt.js { votorola.s.gwt.scene.Scenes.forceInitClass(); votorola.s.gwt.scene.geo.Geomap.forceInitClass(); } finally { isForcedInit = false; } configureJS(); if( App.getServletContextLocation() == null ) // default to relative URL: { String loc = Document.get().getURL(); // http://n.t/v/xf/default.html?q=t#frag // maybe OPT with GWT.getHostPageBaseURL or getModuleBaseURL int endBound = loc.length(); int c = loc.indexOf( '#' ); if( c >= 0 && c < endBound ) endBound = c; // http://n.t/v/xf/default.html?q=t c = loc.lastIndexOf( '?', endBound - 1 ); if( c >= 0 && c < endBound ) endBound = c; // http://n.t/v/xf/default.html endBound = loc.lastIndexOf( '/', endBound - 1 ); // http://n.t/v/xf endBound = loc.lastIndexOf( '/', endBound - 1 ); // http://n.t/v loc = loc.substring( 0, endBound ); App.setServletContextLocation( loc ); } EntryPointS.U.schedule( SceneIn.this ); EntryPointS.U.execute(); // because all modules are now loaded } // - 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() { new Scenes(); new ScenesV(); } //// P r i v a t e /////////////////////////////////////////////////////////////////////// private static native void configureJS() /*-{ var f; try{ f = $wnd.voGWTConfig.s_gwt_scene; } catch( e ) {} // in case parents undefined if( f ) f(); }-*/; }