001    /**
002     * Copyright 2010 The Kuali Foundation Licensed under the
003     * Educational Community License, Version 2.0 (the "License"); you may
004     * not use this file except in compliance with the License. You may
005     * obtain a copy of the License at
006     *
007     * http://www.osedu.org/licenses/ECL-2.0
008     *
009     * Unless required by applicable law or agreed to in writing,
010     * software distributed under the License is distributed on an "AS IS"
011     * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012     * or implied. See the License for the specific language governing
013     * permissions and limitations under the License.
014     */
015    
016    package org.kuali.student.common.ui.client.application;
017    
018    import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
019    
020    
021    /**
022     * Application contains the instance of the ApplicationContext which contain information about the
023     * current context, also a method that does the same thing as HistoryManager.navigate for convenience
024     */
025    public class Application {
026            private static ApplicationContext applicationContext;
027            
028            public static ApplicationContext getApplicationContext() {
029                if(applicationContext == null){
030                    applicationContext = new ApplicationContext();
031                }
032                    return applicationContext;
033            }
034            public static void setApplicationContext(ApplicationContext applicationContext) {
035                    Application.applicationContext = applicationContext;
036            }
037            
038            public static void navigate(String viewPath){
039                    HistoryManager.navigate(viewPath);
040            }
041            
042            public static void navigate(String viewPath, ViewContext context){
043                    HistoryManager.navigate(viewPath, context);
044            }
045            
046    }