1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
package org.kuali.student.common.ui.client.configurable.mvc.multiplicity; |
19 |
|
|
20 |
|
import java.util.List; |
21 |
|
|
22 |
|
import org.kuali.student.common.ui.client.application.Application; |
23 |
|
import org.kuali.student.common.ui.client.widgets.field.layout.element.MessageKeyInfo; |
24 |
|
|
25 |
|
import com.google.gwt.user.client.ui.FlexTable; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
|
|
| 0% |
Uncovered Elements: 54 (54) |
Complexity: 17 |
Complexity Density: 0.53 |
|
34 |
|
public class MultiplicityTable extends FlexTable { |
35 |
|
|
36 |
|
private MultiplicityConfiguration config; |
37 |
|
|
38 |
|
private static final String STYLE_TABLE = "KS-MultiplicityTable"; |
39 |
|
private static final String STYLE_TABLE_BORDER = "KS-MultiplicityTableBorder"; |
40 |
|
private static final String STYLE_CELL = "KS-MultiplicityTableCell"; |
41 |
|
private static final String STYLE_CELL_BORDER = "KS-MultiplicityTableCellBorder"; |
42 |
|
private static final String STYLE_HEADER_CELL = "KS-MultiplicityTableHeaderCell"; |
43 |
|
private static final String BLANK_STRING = " "; |
44 |
|
private int col = 0; |
45 |
|
protected int row = 0; |
46 |
|
|
47 |
|
private String parentPath; |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@param |
55 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
56 |
0
|
public MultiplicityTable(MultiplicityConfiguration config) {... |
57 |
0
|
this.config = config; |
58 |
0
|
setStyleName(STYLE_TABLE); |
59 |
0
|
if (config.getStyleType() == MultiplicityConfiguration.StyleType.BORDERED_TABLE){ |
60 |
0
|
addStyleName(STYLE_TABLE_BORDER); |
61 |
|
} |
62 |
|
} |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
64 |
0
|
public void initTable() {... |
65 |
0
|
clear(); |
66 |
0
|
while (getRowCount() > 0) { |
67 |
0
|
removeRow(0); |
68 |
|
} |
69 |
0
|
row = 0; |
70 |
0
|
col = 0; |
71 |
|
} |
72 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
73 |
0
|
public void buildHeaders() {... |
74 |
0
|
if (config.isShowHeaders()) { |
75 |
|
|
76 |
0
|
for (Integer row : config.getFields().keySet()) { |
77 |
0
|
List<MultiplicityFieldConfiguration> fieldConfigs = config.getFields().get(row); |
78 |
0
|
for (MultiplicityFieldConfiguration fieldConfig : fieldConfigs) { |
79 |
0
|
MessageKeyInfo info = fieldConfig.getMessageKeyInfo(); |
80 |
0
|
String title = Application.getApplicationContext().getUILabel(info.getGroup(), info.getType(), info.getState(), info.getId()); |
81 |
0
|
addHeaderCell(title); |
82 |
|
} |
83 |
|
} |
84 |
0
|
nextRow(); |
85 |
|
} |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
88 |
0
|
public void addHeaderCell(String fieldValue) {... |
89 |
0
|
if (config.isShowHeaders()) { |
90 |
0
|
setCellText(row, col, fieldValue); |
91 |
0
|
getCellFormatter().addStyleName(row, col++, STYLE_HEADER_CELL); |
92 |
|
} |
93 |
|
} |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
0
|
public void addNextCell(String fieldValue) {... |
96 |
0
|
setCellText(row, col++, fieldValue); |
97 |
|
} |
98 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
99 |
0
|
private void setCellText(int row, int cell, String fieldValue) {... |
100 |
0
|
setText(row, cell, fieldValue); |
101 |
0
|
getCellFormatter().addStyleName(row, cell, STYLE_CELL); |
102 |
0
|
if (config.getStyleType() == MultiplicityConfiguration.StyleType.BORDERED_TABLE) { |
103 |
0
|
getCellFormatter().addStyleName(row, cell, STYLE_CELL_BORDER); |
104 |
|
} |
105 |
|
} |
106 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
0
|
public void addEmptyCell() {... |
108 |
0
|
addNextCell(BLANK_STRING); |
109 |
|
} |
110 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
111 |
0
|
public void nextRow() {... |
112 |
0
|
row++; |
113 |
0
|
col = 0; |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0
|
public MultiplicityConfiguration getConfig() {... |
117 |
0
|
return config; |
118 |
|
} |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0
|
public void setConfig(MultiplicityConfiguration config) {... |
121 |
0
|
this.config = config; |
122 |
|
} |
123 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
0
|
public String getParentPath() {... |
125 |
0
|
return parentPath; |
126 |
|
} |
127 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
128 |
0
|
public void setParentPath(String parentPath) {... |
129 |
0
|
this.parentPath = parentPath; |
130 |
|
} |
131 |
|
} |