Coverage Report - org.kuali.student.lum.lu.ui.main.client.widgets.ActionList
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionList
0%
0/15
0%
0/4
1.75
ActionList$1
0%
0/8
0%
0/2
1.75
 
 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.lum.lu.ui.main.client.widgets;
 17  
 
 18  
 import java.util.Arrays;
 19  
 import java.util.List;
 20  
 import java.util.Map;
 21  
 
 22  
 import org.kuali.student.common.ui.client.application.KSAsyncCallback;
 23  
 import org.kuali.student.common.ui.client.service.ServerPropertiesRpcService;
 24  
 import org.kuali.student.common.ui.client.service.ServerPropertiesRpcServiceAsync;
 25  
 
 26  
 import com.google.gwt.core.client.GWT;
 27  
 import com.google.gwt.user.client.ui.Composite;
 28  
 import com.google.gwt.user.client.ui.Frame;
 29  
 
 30  0
 public class ActionList extends Composite {
 31  
     private static final String ACTION_LIST_URL        = "ks.rice.actionList.serviceAddress";
 32  
         
 33  0
     private ServerPropertiesRpcServiceAsync serverPropertiesRpcService = GWT.create(ServerPropertiesRpcService.class);
 34  
     
 35  0
         private Frame actionList = new Frame();
 36  0
         private boolean loaded = false;
 37  
         
 38  0
         private String actionListUrl = null;
 39  
         
 40  0
         public ActionList() {
 41  0
                 actionList.addStyleName("KS-Action-List");
 42  0
                 initWidget(actionList);
 43  0
         }
 44  
 
 45  
         @Override
 46  
         protected void onLoad() {
 47  0
             if (!loaded && actionListUrl == null){
 48  0
                         List<String> serverPropertyList = Arrays.asList(ACTION_LIST_URL);
 49  
                         
 50  0
                 serverPropertiesRpcService.get(serverPropertyList, new KSAsyncCallback<Map<String,String>>() {
 51  
                     public void handleFailure(Throwable caught) {
 52  0
                             loaded = false;
 53  0
                     }
 54  
                     
 55  
                     public void onSuccess(Map<String,String> result) {
 56  0
                         if(result != null){
 57  0
                                 actionListUrl = result.get(ACTION_LIST_URL);
 58  0
                                 actionList.setUrl(actionListUrl);
 59  0
                                 loaded = true;
 60  
                         }
 61  0
                     }                    
 62  
                 });                    
 63  0
             } else {
 64  0
                     actionList.setUrl(actionListUrl);
 65  
             }
 66  0
         }
 67  
 
 68  
 }