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.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
40
41
42
43
44 public class LOPicker extends HorizontalPanel implements HasSelectionChangeHandlers{
45 KSLabel countLabel = new KSLabel();
46 KSTextArea loTextArea = new KSTextArea(countLabel, 250);
47 VerticalFlowPanel vp = new VerticalFlowPanel();
48 LOCategoryBuilder loCategoryBuilder;
49 Data metaInfoData;
50 public LOPicker(String messageGroup, String type, String state, String loRepoKey) {
51 super();
52 loCategoryBuilder = new LOCategoryBuilder(messageGroup, type, state, loRepoKey);
53 loTextArea.removeStyleName("ks-form-module-elements");
54 loTextArea.addStyleName("KS-LOTextArea");
55 countLabel.addStyleName("ks-form-module-elements-help-text");
56 countLabel.addStyleName("loText-count-label");
57 vp.add(loTextArea);
58 vp.add(countLabel);
59 super.add(vp);
60 super.add(loCategoryBuilder);
61
62 loTextArea.addValueChangeHandler(new ValueChangeHandler<String>(){
63 public void onValueChange(ValueChangeEvent<String> event) {
64 fireChangeEvent();
65 }
66 });
67
68 loCategoryBuilder.addValueChangeHandler(new ValueChangeHandler<List<LoCategoryInfo>>(){
69 public void onValueChange(
70 ValueChangeEvent<List<LoCategoryInfo>> event) {
71 fireChangeEvent();
72 }
73 });
74 }
75 public void setLOCategories(List<LoCategoryInfo> categories){
76 loCategoryBuilder.setValue(categories);
77 }
78 public List<LoCategoryInfo> getLoCategories(){
79 return loCategoryBuilder.getValue();
80 }
81 public String getLOText(){
82 return loTextArea.getText();
83 }
84 public void setLOText(String value){
85 loTextArea.setText(value);
86 }
87 public Data getMetaInfoData() {
88 return metaInfoData;
89 }
90 public void setMetaInfoData(Data metaInfoData) {
91 this.metaInfoData = metaInfoData;
92 }
93
94 @Override
95 public HandlerRegistration addSelectionChangeHandler(SelectionChangeHandler handler) {
96 return addHandler(handler, SelectionChangeEvent.getType());
97 }
98
99 public boolean hasChangeHandler(){
100 return this.getHandlerCount(SelectionChangeEvent.getType()) > 0;
101 }
102
103 private void fireChangeEvent(){
104 SelectionChangeEvent.fire(this);
105 }
106 }