Clover Coverage Report - KS Common 1.3.0-SNAPSHOT (Aggregated)
Coverage timestamp: Thu Apr 28 2011 06:00:36 EDT
../../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
20   63   7   5
6   49   0.35   4
4     1.75  
1    
 
  CheckBoxTextArea       Line # 16 20 0% 7 30 0% 0.0
 
No Tests
 
1    package org.kuali.student.common.ui.client.widgets;
2   
3    import org.kuali.student.common.ui.client.widgets.layout.VerticalFlowPanel;
4   
5    import com.google.gwt.event.logical.shared.ValueChangeEvent;
6    import com.google.gwt.event.logical.shared.ValueChangeHandler;
7    import com.google.gwt.user.client.ui.Composite;
8    import com.google.gwt.user.client.ui.HasText;
9    /**
10    * CheckBoxTextArea is for linking a master text area with a slave text area.
11    * A check box is used to control when to use the text from master or from
12    * slave text area.
13    *
14    *
15    * */
 
16    public class CheckBoxTextArea extends Composite implements HasText{
17    HasText master;
18    KSTextArea slave = new KSTextArea();
19    KSCheckBox checkBox = new KSCheckBox();
 
20  0 toggle public CheckBoxTextArea(HasText master, String checkBoxText){
21  0 this.master = master;
22  0 VerticalFlowPanel flowPanel = new VerticalFlowPanel();
23   
24  0 flowPanel.add(checkBox);
25  0 flowPanel.add(slave);
26  0 super.initWidget(flowPanel);
27   
28  0 checkBox.setStyleName("CheckBoxTextArea-CheckBox");
29  0 slave.setStyleName("CheckBoxTextArea-TextArea");
30   
31   
32  0 checkBox.addValueChangeHandler(new ValueChangeHandler(){
 
33  0 toggle @Override
34    public void onValueChange(ValueChangeEvent event) {
35  0 if(checkBox.getValue() == true){
36  0 slave.setVisible(false);
37    }else{
38  0 slave.setVisible(true);
39    }
40    }
41    });
42  0 checkBox.setValue(true);
43  0 checkBox.setText(checkBoxText);
44    }
 
45  0 toggle @Override
46    public String getText() {
47  0 if(checkBox.getValue() == true){
48  0 return master.getText();
49    }else{
50  0 return slave.getText();
51    }
52    }
53   
 
54  0 toggle @Override
55    public void setText(String text) {
56  0 if(master.getText().equals(text)){
57  0 checkBox.setValue(true);
58    }else{
59  0 checkBox.setValue(false);
60  0 slave.setText(text);
61    }
62    }
63    }