001package votorola.s.gwt.wic; // 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.
002
003import com.google.gwt.core.client.JavaScriptObject;
004import votorola.a.web.gwt.*;
005import votorola.g.web.gwt.*;
006import votorola.s.gwt.stage.*;
007
008
009/** The GWT entry module for embedding the Crossforum Theatre {@linkplain
010  * votorola.s.gwt.stage.Stage stage} in Wicket count pages.  An instance of this class is
011  * automatically constructed and invoked per module definition <a
012  * href='../../../../../../s/gwt/wic/CountIn.gwt.xml'>CountIn.gwt.xml</a>.
013  */
014public final class CountIn implements EntryPointS
015{
016
017
018   // - E n t r y - P o i n t ------------------------------------------------------------
019
020
021    public final void onModuleLoad()
022    {
023        StageIn.insertStageV();
024        EntryPointS.U.schedule( CountIn.this );
025        EntryPointS.U.execute(); // because all modules are now loaded
026        Stage.i().addInitializer( new TheatreInitializerC() // auto-removed
027        {
028            public @Override void initFrom( final Stage stage, boolean _rPending )
029            {
030                if( stage.getDefaultPollName() != null ) stage.setPollName( null );
031                  // ensure it's at default despite any glitch that persists the wrong
032                  // name, because stage is not independent of scene in count pages.
033                  // Would do same for actor, but actor default not set for reasons given
034                  // in votorola.s.wic.count.WP_Votespace
035            }
036            public @Override void initComplete( final Stage stage, boolean _rPending )
037            {
038                final String pageJClass;
039                {
040                    final JavaScriptObject voc = WindowX.js()._get( "voc" );
041                    pageJClass = voc == null? null: voc._getString( "pageJClass" );
042                      // per a.web.wic.VPageHTML
043                }
044                if( "votorola.s.wic.count.WP_Poll".equals(pageJClass) )
045                {
046                    new ActorLinker( stage );
047                    new PollPager( stage );
048                }
049                else
050                {
051                    assert "votorola.s.wic.count.WP_Votespace".equals(pageJClass)
052                        || "votorola.s.wic.count.WP_Rank".equals(pageJClass);
053                        // changing these?  change also in s.gwt.stage.VoteTrack
054                    new PositionPager( stage );
055                }
056            }
057        });
058    }
059
060
061
062   // - 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 ----------------------------
063
064
065    public void execute() { StageV.i().initEmbeddedDisplay(); }
066
067
068}