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