Coverage Report - org.kuali.student.common.ui.client.mvc.DelegatingViewComposite
 
Classes in this File Line Coverage Branch Coverage Complexity
DelegatingViewComposite
0%
0/28
0%
0/8
1.417
 
 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.common.ui.client.mvc;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import org.kuali.student.common.rice.authorization.PermissionType;
 21  
 import org.kuali.student.common.ui.client.security.AuthorizationCallback;
 22  
 import org.kuali.student.common.ui.client.security.RequiresAuthorization;
 23  
 
 24  
 
 25  
 /**
 26  
  * This is a simple view composite that delegates all view operations to nested
 27  
  * controller. Use of this view allows you to nest controllers in the view
 28  
  * hierarchy.  This class is deprecated for all future development.
 29  
  * 
 30  
  * @author Kuali Student Team
 31  
  *
 32  
  */
 33  
 @Deprecated
 34  
 public class DelegatingViewComposite extends ViewComposite implements RequiresAuthorization {
 35  
     Controller childController;
 36  
     
 37  
     /**
 38  
      * @param controller
 39  
      * @param name
 40  
      */
 41  
     public DelegatingViewComposite(Controller parentController, Controller childController, Enum<?> viewType) {
 42  0
         super(parentController, "DelegatingViewComposite", viewType);
 43  0
         initWidget(childController);
 44  0
         this.childController = childController;
 45  0
     }
 46  
 
 47  
     /**
 48  
      * Delegates beforeHide to the nested controllers current view
 49  
      * 
 50  
      * @see org.kuali.student.common.ui.client.mvc.View#beforeHide()
 51  
      */
 52  
     @Override
 53  
     public boolean beforeHide() {
 54  0
         return childController.getCurrentView().beforeHide();
 55  
     }
 56  
 
 57  
     /**
 58  
      * @see org.kuali.student.common.ui.client.mvc.View#beforeShow()
 59  
      */
 60  
     @Override
 61  
     public void beforeShow(final Callback<Boolean> onReadyCallback) {
 62  0
         if (childController.getCurrentView() == null){
 63  0
             childController.showDefaultView(onReadyCallback);
 64  
         } else {
 65  0
             childController.getCurrentView().beforeShow(onReadyCallback);
 66  
         }
 67  0
     }
 68  
     
 69  
     public Controller getChildController(){
 70  0
         return childController;
 71  
     }
 72  
     
 73  
     public void setChildController(Controller controller){
 74  0
         this.childController = controller;
 75  0
     }
 76  
     
 77  
     @Override
 78  
         public String collectHistory(String historyStack) {
 79  0
                 return childController.collectHistory(historyStack);
 80  
         }
 81  
 
 82  
         @Override
 83  
         public void onHistoryEvent(String historyStack) {
 84  0
                 childController.onHistoryEvent(historyStack);
 85  0
         }
 86  
 
 87  
         @Override
 88  
     public void clear() {
 89  0
             childController.resetCurrentView();
 90  0
     }
 91  
 
 92  
         @Override
 93  
         public void checkAuthorization(AuthorizationCallback callback) {
 94  0
                 if (childController instanceof RequiresAuthorization){
 95  0
                         ((RequiresAuthorization)childController).checkAuthorization(callback);
 96  
                 }                                
 97  0
         }
 98  
 
 99  
         @Override
 100  
         public boolean isAuthorizationRequired() {
 101  0
                 if (childController instanceof RequiresAuthorization){
 102  0
                         return ((RequiresAuthorization)childController).isAuthorizationRequired();
 103  
                 } else {
 104  0
                         return false;
 105  
                 }
 106  
         }
 107  
 
 108  
         @Override
 109  
         public void setAuthorizationRequired(boolean required) {
 110  0
                 if (childController instanceof RequiresAuthorization){
 111  0
                         ((RequiresAuthorization)childController).setAuthorizationRequired(required);
 112  
                 }                
 113  0
         }
 114  
 
 115  
         @Override
 116  
         public void collectBreadcrumbNames(List<String> names) {
 117  0
                 childController.collectBreadcrumbNames(names);
 118  
                 
 119  0
         }
 120  
 
 121  
 }