1 |
|
package org.kuali.student.common.ui.client.configurable.mvc.multiplicity; |
2 |
|
|
3 |
|
import java.util.List; |
4 |
|
import java.util.Map; |
5 |
|
|
6 |
|
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; |
7 |
|
import org.kuali.student.common.ui.client.configurable.mvc.sections.GroupSection; |
8 |
|
import org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract; |
9 |
|
import org.kuali.student.common.ui.client.widgets.search.KSPicker; |
10 |
|
|
11 |
|
import com.google.gwt.user.client.ui.Widget; |
12 |
|
|
|
|
| 0% |
Uncovered Elements: 39 (39) |
Complexity: 14 |
Complexity Density: 0.67 |
|
13 |
|
public class SwapCondition { |
14 |
|
private FieldDescriptor fd; |
15 |
|
private String value; |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
16 |
0
|
public FieldDescriptor getFd() {... |
17 |
0
|
return fd; |
18 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
19 |
0
|
public void setFd(FieldDescriptor fd) {... |
20 |
0
|
this.fd = fd; |
21 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
22 |
0
|
public String getValue() {... |
23 |
0
|
return value; |
24 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
25 |
0
|
public void setValue(String value) {... |
26 |
0
|
this.value = value; |
27 |
|
} |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
28 |
0
|
private String nvl(String inString) {... |
29 |
0
|
return (inString == null)? "" : inString; |
30 |
|
} |
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 8 |
Complexity Density: 0.5 |
|
31 |
0
|
public boolean evaluate(GroupSection section, Map<String, String> helperFieldKeys) {... |
32 |
0
|
boolean result = false; |
33 |
0
|
String widgetValue = null; |
34 |
|
|
35 |
|
|
36 |
0
|
List<FieldDescriptor> sectionFds = section.getFields(); |
37 |
0
|
Widget fieldWidget = null; |
38 |
0
|
if (sectionFds != null) { |
39 |
0
|
for (FieldDescriptor sectionFd : sectionFds) { |
40 |
0
|
if (sectionFd.getFieldKey().equals(helperFieldKeys.get(fd.getFieldKey()))) { |
41 |
0
|
fieldWidget = sectionFd.getFieldWidget(); |
42 |
|
} |
43 |
|
} |
44 |
|
} |
45 |
0
|
if (fieldWidget != null && fieldWidget instanceof KSSelectItemWidgetAbstract) { |
46 |
0
|
widgetValue = ((KSSelectItemWidgetAbstract)fieldWidget).getSelectedItem(); |
47 |
0
|
} else if (fieldWidget != null && fieldWidget instanceof KSPicker) { |
48 |
0
|
Widget inputWidget = ((KSPicker)fieldWidget).getInputWidget(); |
49 |
0
|
widgetValue = ((KSSelectItemWidgetAbstract)inputWidget).getSelectedItem(); |
50 |
|
} |
51 |
0
|
if (nvl(this.value).equals(widgetValue)) { |
52 |
0
|
result = true; |
53 |
|
} |
54 |
0
|
return result; |
55 |
|
} |
56 |
|
} |