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 org.kuali.student.common.ui.client.util.DebugIdUtils;
19
20 import com.google.gwt.event.dom.client.BlurEvent;
21 import com.google.gwt.event.dom.client.BlurHandler;
22 import com.google.gwt.event.dom.client.FocusEvent;
23 import com.google.gwt.event.dom.client.FocusHandler;
24 import com.google.gwt.event.logical.shared.ValueChangeEvent;
25 import com.google.gwt.event.logical.shared.ValueChangeHandler;
26 import com.google.gwt.user.client.ui.RadioButton;
27
28
29
30
31
32
33
34
35 @Deprecated
36 public class KSRadioButton extends RadioButton{
37
38
39
40
41
42
43
44
45 public KSRadioButton(String group, String label, boolean asHTML) {
46 super(group, label, asHTML);
47 ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(group + "-" + label));
48 setupDefaultStyle();
49 }
50
51
52
53
54
55
56
57 public KSRadioButton(String group, String label) {
58 super(group, label);
59 ensureDebugId(DebugIdUtils.createWebDriverSafeDebugId(group + "-" + label));
60 setupDefaultStyle();
61 }
62
63
64
65
66
67
68 public KSRadioButton(String group) {
69 super(group);
70 setupDefaultStyle();
71 }
72
73
74
75
76
77 private void setupDefaultStyle() {
78 addStyleName("KS-Radio");
79
80 this.addBlurHandler(new BlurHandler(){
81 public void onBlur(BlurEvent event) {
82 KSRadioButton.this.removeStyleName("KS-Radio-Focus");
83
84 }
85 });
86
87 this.addFocusHandler(new FocusHandler(){
88 public void onFocus(FocusEvent event) {
89 KSRadioButton.this.addStyleName("KS-Radio-Focus");
90
91 }
92 });
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111 this.addValueChangeHandler(new ValueChangeHandler<Boolean>(){
112 @Override
113
114 public void onValueChange(ValueChangeEvent<Boolean> event) {
115 if(KSRadioButton.this.getValue()){
116 KSRadioButton.this.addStyleName("KS-Radio-Selected");
117 }
118 else{
119 KSRadioButton.this.removeStyleName("KS-Radio-Selected");
120 KSRadioButton.this.setFocus(false);
121 }
122
123 }
124 });
125
126 }
127
128
129 }
130
131