Coverage Report - org.kuali.student.core.organization.ui.client.view.OrgEntryPoint
 
Classes in this File Line Coverage Branch Coverage Complexity
OrgEntryPoint
0%
0/28
0%
0/4
1.6
OrgEntryPoint$1
0%
0/3
N/A
1.6
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.core.organization.ui.client.view;
 17  
 
 18  
 
 19  
 import org.kuali.student.common.messages.dto.MessageList;
 20  
 import org.kuali.student.common.ui.client.application.Application;
 21  
 import org.kuali.student.common.ui.client.application.ApplicationComposite;
 22  
 import org.kuali.student.common.ui.client.application.ApplicationContext;
 23  
 import org.kuali.student.common.ui.client.mvc.Callback;
 24  
 import org.kuali.student.common.ui.client.mvc.Controller;
 25  
 import org.kuali.student.common.ui.client.service.MessagesRpcService;
 26  
 import org.kuali.student.common.ui.client.util.BrowserUtils;
 27  
 import org.kuali.student.common.ui.client.widgets.ApplicationPanel;
 28  
 import org.kuali.student.core.organization.ui.client.mvc.controller.OrgApplicationManager;
 29  
 import org.kuali.student.core.organization.ui.client.theme.OrgTheme;
 30  
 
 31  
 import com.google.gwt.core.client.EntryPoint;
 32  
 import com.google.gwt.core.client.GWT;
 33  
 import com.google.gwt.dom.client.StyleInjector;
 34  
 import com.google.gwt.user.client.DOM;
 35  
 import com.google.gwt.user.client.History;
 36  
 import com.google.gwt.user.client.rpc.SerializationException;
 37  
 import com.google.gwt.user.client.rpc.SerializationStreamFactory;
 38  
 import com.google.gwt.user.client.ui.SimplePanel;
 39  
 
 40  0
 public class OrgEntryPoint implements EntryPoint{
 41  
 
 42  
     ApplicationComposite app;
 43  0
     private OrgApplicationManager manager = null;
 44  0
     SimplePanel content = new SimplePanel();
 45  
 //    private OrgMenu orgMenu = new OrgMenu(content);;
 46  
 
 47  
     public void onModuleLoad() {
 48  0
         final ApplicationContext context = Application.getApplicationContext();
 49  0
         final String injectString = OrgTheme.INSTANCE.getOrgCss().getCssString();
 50  0
         StyleInjector.injectStylesheet(injectString);
 51  
 
 52  0
         loadApp(context);
 53  
 
 54  
         try {
 55  0
             MessageList messageList =  getSerializedObject( "i18nMessages");
 56  0
             context.addMessages(messageList.getMessages());
 57  
 
 58  0
         } catch (Exception e) {
 59  0
             GWT.log("Error on ModuleLoad",e);
 60  0
         }
 61  
 
 62  0
         History.fireCurrentHistoryState();
 63  
 
 64  0
         if(DOM.getElementById("loadingSpinner") != null)
 65  0
             DOM.removeChild(ApplicationPanel.get().getElement(), DOM.getElementById("loadingSpinner"));
 66  0
     }
 67  
 
 68  
     @SuppressWarnings("unchecked")
 69  
     public  <T> T getSerializedObject( String name ) throws SerializationException
 70  
     {
 71  0
         String serialized = BrowserUtils.getString( name );
 72  0
         SerializationStreamFactory ssf = GWT.create( MessagesRpcService.class); // magic
 73  0
         return (T)ssf.createStreamReader( serialized ).readObject();
 74  
     }
 75  
 
 76  
     public void loadApp(final ApplicationContext context){
 77  0
         context.initializeContext(new Callback<Boolean>(){
 78  
                         @Override
 79  
                         public void exec(Boolean result) {
 80  0
                 initScreen();                                
 81  0
                         }                
 82  
         });
 83  0
     }
 84  
 
 85  
     private void initScreen(){
 86  0
         app = new ApplicationComposite();
 87  0
         manager = new OrgApplicationManager();
 88  0
         app.setContent(manager);
 89  
 //        app.setContent(getContent());
 90  0
         ApplicationPanel.get().add(app);
 91  0
         if(manager.getCurrentView() == null)
 92  0
             manager.showDefaultView(Controller.NO_OP_CALLBACK);
 93  0
     }
 94  
 }