Clover Coverage Report - Kuali Student 1.2-M6-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Sep 12 2011 05:03:53 EDT
../../../../../../../../../img/srcFileCovDistChart0.png 42% of files have more coverage
21   79   9   2.33
0   68   0.43   9
9     1  
1    
 
  EditableLabel       Line # 17 21 0% 9 30 0% 0.0
 
No Tests
 
1    package org.kuali.student.common.ui.client.widgets.table.scroll;
2   
3    import com.google.gwt.event.dom.client.BlurEvent;
4    import com.google.gwt.event.dom.client.BlurHandler;
5    import com.google.gwt.event.dom.client.ChangeEvent;
6    import com.google.gwt.event.dom.client.ChangeHandler;
7    import com.google.gwt.event.dom.client.ClickEvent;
8    import com.google.gwt.event.dom.client.ClickHandler;
9    import com.google.gwt.event.dom.client.HasChangeHandlers;
10    import com.google.gwt.event.dom.client.HasClickHandlers;
11    import com.google.gwt.event.shared.HandlerRegistration;
12    import com.google.gwt.user.client.ui.HasText;
13    import com.google.gwt.user.client.ui.Label;
14    import com.google.gwt.user.client.ui.SimplePanel;
15    import com.google.gwt.user.client.ui.TextBox;
16   
 
17    public class EditableLabel extends SimplePanel implements HasClickHandlers, HasText, HasChangeHandlers {
18    Label label = new Label();
19    TextBox textBox = new TextBox();
20   
 
21  0 toggle public EditableLabel() {
22  0 super.setWidget(label);
23  0 textBox.addChangeHandler(new ChangeHandler() {
 
24  0 toggle @Override
25    public void onChange(ChangeEvent event) {
26  0 label.setText(textBox.getText());
27    }
28    });
29  0 textBox.addClickHandler(new ClickHandler(){
 
30  0 toggle @Override
31    public void onClick(ClickEvent event) {
32  0 event.stopPropagation();
33    }
34   
35    });
36  0 textBox.addBlurHandler(new BlurHandler() {
 
37  0 toggle @Override
38    public void onBlur(BlurEvent event) {
39  0 label.setText(textBox.getText());
40  0 EditableLabel.this.setWidget(label);
41   
42    }
43    });
44  0 label.addClickHandler(new ClickHandler() {
 
45  0 toggle @Override
46    public void onClick(ClickEvent event) {
47  0 textBox.setText(label.getText());
48  0 int width = label.getOffsetWidth();
49  0 int height = label.getOffsetHeight()+3;
50  0 EditableLabel.this.setWidget(textBox);
51  0 textBox.setWidth(""+width+"px");
52  0 textBox.setHeight(""+height+"px");
53  0 textBox.selectAll();
54  0 textBox.setFocus(true);
55    }
56    });
57    }
58   
 
59  0 toggle @Override
60    public String getText() {
61  0 return label.getText();
62   
63    }
64   
 
65  0 toggle @Override
66    public void setText(String text) {
67  0 label.setText(text);
68    }
69   
 
70  0 toggle @Override
71    public HandlerRegistration addChangeHandler(ChangeHandler handler) {
72  0 return textBox.addChangeHandler(handler);
73    }
74   
 
75  0 toggle @Override
76    public HandlerRegistration addClickHandler(ClickHandler handler) {
77  0 return label.addClickHandler(handler);
78    }
79    }