1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.control;
17
18 import org.kuali.rice.krad.datadictionary.validator.ErrorReport;
19 import org.kuali.rice.krad.datadictionary.validator.TracerToken;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.element.Message;
22 import org.kuali.rice.krad.uif.util.ComponentFactory;
23 import org.kuali.rice.krad.uif.view.View;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28
29
30
31
32
33
34 public class CheckboxControl extends ControlBase implements ValueConfiguredControl {
35 private static final long serialVersionUID = -1397028958569144230L;
36
37 private String value;
38 private String checkboxLabel;
39
40 private Message richLabelMessage;
41 private List<Component> inlineComponents;
42
43 public CheckboxControl() {
44 super();
45 }
46
47
48
49
50
51
52 @Override
53 public void performApplyModel(View view, Object model, Component parent) {
54 super.performApplyModel(view, model, parent);
55
56 if (richLabelMessage == null) {
57 Message message = ComponentFactory.getMessage();
58 view.assignComponentIds(message);
59 message.setMessageText(checkboxLabel);
60 message.setInlineComponents(inlineComponents);
61 message.setGenerateSpan(false);
62 view.getViewHelperService().performComponentInitialization(view, model, message);
63 this.setRichLabelMessage(message);
64 }
65 }
66
67
68
69
70 @Override
71 public List<Component> getComponentsForLifecycle() {
72 List<Component> components = super.getComponentsForLifecycle();
73
74 components.add(richLabelMessage);
75
76 return components;
77 }
78
79
80
81
82
83
84
85
86
87
88
89
90 public String getValue() {
91 return value;
92 }
93
94
95
96
97
98
99 public void setValue(String value) {
100 this.value = value;
101 }
102
103
104
105
106
107
108 public String getCheckboxLabel() {
109 return checkboxLabel;
110 }
111
112
113
114
115
116
117 public void setCheckboxLabel(String checkboxLabel) {
118 this.checkboxLabel = checkboxLabel;
119 }
120
121
122
123
124
125
126
127
128 public Message getRichLabelMessage() {
129 return richLabelMessage;
130 }
131
132
133
134
135
136
137
138
139 public void setRichLabelMessage(Message richLabelMessage) {
140 this.richLabelMessage = richLabelMessage;
141 }
142
143
144
145
146
147
148 public List<Component> getInlineComponents() {
149 return inlineComponents;
150 }
151
152
153
154
155
156
157 public void setInlineComponents(List<Component> inlineComponents) {
158 this.inlineComponents = inlineComponents;
159 }
160
161
162
163
164 @Override
165 public ArrayList<ErrorReport> completeValidation(TracerToken tracer){
166 ArrayList<ErrorReport> reports=new ArrayList<ErrorReport>();
167 tracer.addBean(this);
168
169 reports.addAll(super.completeValidation(tracer.getCopy()));
170
171 return reports;
172 }
173 }