| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 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 | |
|
| 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); |
| 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 | |
|
| 90 | 0 | ApplicationPanel.get().add(app); |
| 91 | 0 | if(manager.getCurrentView() == null) |
| 92 | 0 | manager.showDefaultView(Controller.NO_OP_CALLBACK); |
| 93 | 0 | } |
| 94 | |
} |