Coverage Report - org.kuali.student.lum.common.client.lo.LOPicker
 
Classes in this File Line Coverage Branch Coverage Complexity
LOPicker
0%
0/30
0%
0/2
1
LOPicker$1
0%
0/3
N/A
1
LOPicker$2
0%
0/3
N/A
1
 
 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.common.client.lo;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import org.kuali.student.common.assembly.data.Data;
 21  
 import org.kuali.student.common.ui.client.widgets.KSLabel;
 22  
 import org.kuali.student.common.ui.client.widgets.KSTextArea;
 23  
 import org.kuali.student.common.ui.client.widgets.layout.VerticalFlowPanel;
 24  
 import org.kuali.student.common.ui.client.widgets.list.HasSelectionChangeHandlers;
 25  
 import org.kuali.student.common.ui.client.widgets.list.SelectionChangeEvent;
 26  
 import org.kuali.student.common.ui.client.widgets.list.SelectionChangeHandler;
 27  
 import org.kuali.student.lum.lo.dto.LoCategoryInfo;
 28  
 
 29  
 import com.google.gwt.event.dom.client.KeyUpEvent;
 30  
 import com.google.gwt.event.dom.client.KeyUpHandler;
 31  
 import com.google.gwt.event.logical.shared.ValueChangeEvent;
 32  
 import com.google.gwt.event.logical.shared.ValueChangeHandler;
 33  
 import com.google.gwt.event.shared.HandlerRegistration;
 34  
 import com.google.gwt.user.client.Window;
 35  
 import com.google.gwt.user.client.ui.HorizontalPanel;
 36  
 import com.google.gwt.user.client.ui.TextArea;
 37  
 
 38  
 /**
 39  
  * This is a description of what this class does - hjohnson don't forget to fill this in. 
 40  
  * 
 41  
  * @author Kuali Student Team (kuali-student@googlegroups.com)
 42  
  *
 43  
  */
 44  0
 public class LOPicker extends HorizontalPanel implements HasSelectionChangeHandlers{
 45  0
         KSLabel countLabel = new KSLabel();
 46  0
     KSTextArea loTextArea = new KSTextArea(countLabel, 250);
 47  0
     VerticalFlowPanel vp = new VerticalFlowPanel();
 48  
     LOCategoryBuilder loCategoryBuilder;
 49  
     Data metaInfoData; // temporary storage of metaInfo data this is needed when LO is updated
 50  
     public LOPicker(String messageGroup, String type, String state, String loRepoKey) {
 51  0
         super();
 52  0
         loCategoryBuilder = new LOCategoryBuilder(messageGroup, type, state, loRepoKey);
 53  0
         loTextArea.removeStyleName("ks-form-module-elements");
 54  0
         loTextArea.addStyleName("KS-LOTextArea");
 55  0
         countLabel.addStyleName("ks-form-module-elements-help-text");
 56  0
         countLabel.addStyleName("loText-count-label");
 57  0
         vp.add(loTextArea);
 58  0
         vp.add(countLabel);
 59  0
         super.add(vp);
 60  0
         super.add(loCategoryBuilder);
 61  
         
 62  0
         loTextArea.addValueChangeHandler(new ValueChangeHandler<String>(){
 63  
                         public void onValueChange(ValueChangeEvent<String> event) {
 64  0
                                 fireChangeEvent();
 65  0
                         }                
 66  
         });
 67  
         
 68  0
         loCategoryBuilder.addValueChangeHandler(new ValueChangeHandler<List<LoCategoryInfo>>(){
 69  
                         public void onValueChange(
 70  
                                         ValueChangeEvent<List<LoCategoryInfo>> event) {
 71  0
                                 fireChangeEvent();
 72  0
                         }                
 73  
         });
 74  0
     }
 75  
     public void setLOCategories(List<LoCategoryInfo> categories){
 76  0
         loCategoryBuilder.setValue(categories);
 77  0
     }
 78  
     public List<LoCategoryInfo> getLoCategories(){
 79  0
         return loCategoryBuilder.getValue();
 80  
     }
 81  
     public String getLOText(){
 82  0
         return loTextArea.getText();
 83  
     }
 84  
     public void setLOText(String value){
 85  0
         loTextArea.setText(value);
 86  0
     }
 87  
     public Data getMetaInfoData() {
 88  0
         return metaInfoData;
 89  
     }
 90  
     public void setMetaInfoData(Data metaInfoData) {
 91  0
         this.metaInfoData = metaInfoData;
 92  0
     }
 93  
         
 94  
     @Override
 95  
         public HandlerRegistration addSelectionChangeHandler(SelectionChangeHandler handler) {
 96  0
             return addHandler(handler, SelectionChangeEvent.getType());
 97  
     }
 98  
     
 99  
     public boolean hasChangeHandler(){
 100  0
             return this.getHandlerCount(SelectionChangeEvent.getType()) > 0;
 101  
     }
 102  
         
 103  
     private void fireChangeEvent(){
 104  0
             SelectionChangeEvent.fire(this);
 105  0
     }
 106  
 }