| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |   | 
  | 10 |  |   | 
  | 11 |  |   | 
  | 12 |  |   | 
  | 13 |  |   | 
  | 14 |  |   | 
  | 15 |  |   | 
  | 16 |  |  package org.kuali.student.lum.common.client.lo; | 
  | 17 |  |   | 
  | 18 |  |  import java.util.List; | 
  | 19 |  |   | 
  | 20 |  |  import org.kuali.student.common.ui.client.widgets.KSLabel; | 
  | 21 |  |  import org.kuali.student.common.ui.client.widgets.KSTextArea; | 
  | 22 |  |  import org.kuali.student.common.ui.client.widgets.layout.VerticalFlowPanel; | 
  | 23 |  |  import org.kuali.student.common.ui.client.widgets.list.HasSelectionChangeHandlers; | 
  | 24 |  |  import org.kuali.student.common.ui.client.widgets.list.SelectionChangeEvent; | 
  | 25 |  |  import org.kuali.student.common.ui.client.widgets.list.SelectionChangeHandler; | 
  | 26 |  |  import org.kuali.student.core.assembly.data.Data; | 
  | 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 |  |   | 
  | 40 |  |   | 
  | 41 |  |   | 
  | 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;  | 
  | 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 |  |  } |