1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.ui.client.widgets; |
17 |
|
|
18 |
|
import com.google.gwt.event.dom.client.BlurEvent; |
19 |
|
import com.google.gwt.event.dom.client.BlurHandler; |
20 |
|
import com.google.gwt.event.dom.client.FocusEvent; |
21 |
|
import com.google.gwt.event.dom.client.FocusHandler; |
22 |
|
import com.google.gwt.event.logical.shared.ValueChangeEvent; |
23 |
|
import com.google.gwt.event.logical.shared.ValueChangeHandler; |
24 |
|
import com.google.gwt.user.client.ui.CheckBox; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@author |
31 |
|
|
32 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 7 |
Complexity Density: 0.5 |
|
33 |
|
public class KSCheckBox extends CheckBox{ |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
39 |
0
|
public KSCheckBox(){... |
40 |
0
|
super(); |
41 |
0
|
setupDefaultStyle(); |
42 |
|
} |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
@param |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
49 |
0
|
public KSCheckBox(String label){... |
50 |
0
|
super(label); |
51 |
0
|
setupDefaultStyle(); |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
58 |
0
|
private void setupDefaultStyle(){... |
59 |
0
|
addStyleName("KS-Checkbox"); |
60 |
|
|
61 |
0
|
this.addBlurHandler(new BlurHandler(){ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0
|
public void onBlur(BlurEvent event) {... |
63 |
0
|
KSCheckBox.this.removeStyleName("KS-Checkbox-Focus"); |
64 |
|
|
65 |
|
} |
66 |
|
}); |
67 |
|
|
68 |
0
|
this.addFocusHandler(new FocusHandler(){ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
69 |
0
|
public void onFocus(FocusEvent event) {... |
70 |
0
|
KSCheckBox.this.addStyleName("KS-Checkbox-Focus"); |
71 |
|
|
72 |
|
} |
73 |
|
}); |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
0
|
this.addValueChangeHandler(new ValueChangeHandler<Boolean>(){ |
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
93 |
0
|
@Override... |
94 |
|
|
95 |
|
public void onValueChange(ValueChangeEvent<Boolean> event) { |
96 |
0
|
if(KSCheckBox.this.getValue()){ |
97 |
0
|
KSCheckBox.this.addStyleName("KS-Checkbox-Checked"); |
98 |
|
} |
99 |
|
else{ |
100 |
0
|
KSCheckBox.this.removeStyleName("KS-Checkbox-Checked"); |
101 |
0
|
KSCheckBox.this.setFocus(false); |
102 |
|
} |
103 |
|
} |
104 |
|
}); |
105 |
|
} |
106 |
|
|
107 |
|
} |