001package votorola.s.gwt.stage; // Copyright 2011-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.
002
003import votorola.a.web.gwt.*;
004import com.google.gwt.user.client.ui.RootPanel;
005
006
007/** The GWT entry module for embedding the stage in a non-GWT web page.  An instance of
008  * this class is automatically constructed and invoked per module definition
009  * <a href='../../../../../../s/gwt/stage/StageIn.gwt.xml'>StageIn.gwt.xml</a>.  It
010  * constructs a {@linkplain votorola.s.gwt.stage.StageV stage view} and ordinarily
011  * inserts it as the first child of the body element, as detailed for {@linkplain
012  * #insertStageV() insertStageV}().  To install it, add the following lines as
013  * <a href='https://developers.google.com/web-toolkit/doc/latest/DevGuideOrganizingProjects#DevGuideBootstrap' target='_top'>high as possible</a>
014  * in the head of the page, substituting the correct
015  * value for <var>CONTEXT</var>: (links to working examples are provided farther
016  * below)<pre>
017  *
018  *   &lt;!-- - -
019  *    ! Crossforum Theatre stage of Votorola
020  *    ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
021  *    ! http://reluk.ca/project/votorola/_/javadoc/votorola/s/gwt/stage/StageIn.html
022  *    ! The GWT config script must precede the "nocache.js" boot script.
023  *    ! The style sheet must too, or layout may be unstable:
024  *    ! http://mail.zelea.com/list/votorola/2012-November/001540.html
025  *    ! Following is a standards-compliant downlevel-revealed conditional comment:
026  *    --&gt;
027  *   &lt;!--[if !IE]&gt;--&gt;
028  *       &lt;script src='<var>{@linkplain App#getServletContextLocation() CONTEXT}</var>/w/publicConfig/gwt.js'&gt;&lt;/script&gt;
029  *       &lt;link rel='stylesheet' type='text/css' href='<var>{@linkplain App#getServletContextLocation() CONTEXT}</var>/stage/module.css'/&gt;
030  *       &lt;script src='<var>{@linkplain App#getServletContextLocation() CONTEXT}</var>/votorola.s.gwt.stage.StageIn/votorola.s.gwt.stage.StageIn.nocache.js'&gt;&lt;/script&gt;
031  *       &lt;!--&lt;![endif]--&gt;</pre>
032  *
033  *
034  * <h3>Working examples</h3>
035  *
036  * <li><a href='http://reluk.ca/project/votorola/home.html' target='_top'>project/votorola/home.html</a></li>
037  * <li><a href='http://havoc.zelea.com/system/host/havoc/etc/apache2/modules.d/50_mailman.conf'>apache2/modules.d/50_mailman.conf</a></li>
038  */
039public final class StageIn implements EntryPointS
040{
041
042
043    /** Constructs a {@linkplain StageV stage view} and inserts it as the first child of
044      * {@code <ELEMENT id='stageTopHolder'/>}, where ELEMENT denotes any type of HTML
045      * element.  If no element with that ID exists, then the document's body element is
046      * used instead.  You must subsequently call StageV.i().{@linkplain
047      * StageV#initEmbeddedDisplay() initEmbeddedDisplay}() to actually display it.
048      */
049    public static void insertStageV()
050    {
051        RootPanel parent = RootPanel.get( "stageTopHolder" );
052        if( parent == null ) parent = RootPanel.get();
053        parent.insert( new StageV( /*toDisplay*/false ), 0 );
054    }
055
056
057
058   // - E n t r y - P o i n t ------------------------------------------------------------
059
060
061    public void onModuleLoad()
062    {
063        insertStageV();
064        EntryPointS.U.schedule( StageIn.this );
065        EntryPointS.U.execute();
066    }
067
068
069
070   // - 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 ----------------------------
071
072
073    public void execute() { StageV.i().initEmbeddedDisplay(); }
074
075
076}