Coverage Report - org.kuali.student.common.ui.client.widgets.search.AdvancedSearchWindow
 
Classes in this File Line Coverage Branch Coverage Complexity
AdvancedSearchWindow
0%
0/32
N/A
1.222
AdvancedSearchWindow$1
0%
0/6
0%
0/4
1.222
 
 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.widgets.search;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import org.kuali.student.common.ui.client.mvc.Callback;
 21  
 import org.kuali.student.common.ui.client.widgets.KSLightBox;
 22  
 import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations;
 23  
 import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.ButtonEnum;
 24  
 import org.kuali.student.common.ui.client.widgets.field.layout.button.ActionCancelGroup;
 25  
 import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonGroup;
 26  
 import org.kuali.student.common.ui.client.widgets.layout.VerticalFlowPanel;
 27  
 import org.kuali.student.core.search.dto.SearchRequest;
 28  
 
 29  0
 public class AdvancedSearchWindow {
 30  
     
 31  0
     private VerticalFlowPanel layout = new VerticalFlowPanel();
 32  
         private KSLightBox dialog;
 33  
         private SearchPanel searchPanel;
 34  
                 
 35  0
         private ActionCancelGroup actionCancelButtons = new ActionCancelGroup(ButtonEnumerations.SearchCancelEnum.SEARCH, ButtonEnumerations.SearchCancelEnum.CANCEL);   
 36  
 
 37  
     public List<SelectedResults> getSelectedValues() {
 38  0
         return searchPanel.getSelectedValues();
 39  
     }
 40  
 
 41  
     public SearchRequest getSearchRequest() {
 42  0
         return searchPanel.getSearchRequest();
 43  
     }
 44  
     
 45  
     public String getSelectedLookupName() {
 46  0
         return searchPanel.getSelectedLookupName();
 47  
     }
 48  
 
 49  0
         public AdvancedSearchWindow(String title, SearchPanel panel){
 50  
             
 51  0
             actionCancelButtons.addStyleName("KS-Advanced-Search-Buttons");
 52  0
             addCancelCompleteCallback(null);
 53  0
         searchPanel = panel;
 54  0
         searchPanel.setActionCancelButtonGroup(actionCancelButtons);
 55  0
         searchPanel.setupButtons();
 56  
         
 57  0
             dialog = new KSLightBox(title);            
 58  0
             layout.addStyleName("KS-Advanced-Search-Window");
 59  0
                 layout.add(panel);
 60  0
                 layout.add(actionCancelButtons);
 61  
                 //dialog.setWidget(layout);
 62  0
                 dialog.setMaxHeight(600);
 63  0
                 ButtonGroup buttons = panel.getButtons();
 64  0
                 buttons.removeFromParent();
 65  0
                 dialog.addButtonGroup(buttons);
 66  0
         }
 67  
         
 68  
     public void show(){
 69  0
         searchPanel.setupSearch();
 70  0
         dialog.setWidget(layout);
 71  0
         dialog.setMaxHeight(600);
 72  0
         dialog.show();
 73  0
     }
 74  
 
 75  
     public void hide(){
 76  0
         dialog.hide();
 77  0
     }
 78  
     
 79  
     public void addCancelCompleteCallback(final Callback<Boolean> callback){
 80  
         //actionCompletedCallbacks.add(callback);
 81  0
         actionCancelButtons.addCallback(new Callback<ButtonEnumerations.ButtonEnum>(){
 82  
              @Override
 83  
             public void exec(ButtonEnum result) {
 84  0
                  if (result == ButtonEnumerations.SearchCancelEnum.CANCEL) {
 85  0
                      if (callback != null) {
 86  0
                          callback.exec(true);   
 87  
                      }
 88  0
                      dialog.hide();
 89  
                  }
 90  0
             }
 91  
         });
 92  0
     }    
 93  
     
 94  
     public void addActionCompleteCallback(Callback<Boolean> callback){
 95  0
         searchPanel.addActionCompleteCallback(callback);
 96  0
     }    
 97  
 }