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 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 7 |
Complexity Density: 0.35 |
|
16 |
|
public class CheckBoxTextArea extends Composite implements HasText{ |
17 |
|
HasText master; |
18 |
|
KSTextArea slave = new KSTextArea(); |
19 |
|
KSCheckBox checkBox = new KSCheckBox(); |
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
20 |
0
|
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(){ |
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
33 |
0
|
@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 |
|
} |
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
45 |
0
|
@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 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
54 |
0
|
@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 |
|
} |