1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.ui.client.configurable.mvc.multiplicity; |
17 |
|
|
18 |
|
import org.kuali.student.common.ui.client.widgets.KSButton; |
19 |
|
import org.kuali.student.common.ui.client.widgets.KSLabel; |
20 |
|
import org.kuali.student.common.ui.client.widgets.layout.VerticalFlowPanel; |
21 |
|
|
22 |
|
import com.google.gwt.event.dom.client.ClickEvent; |
23 |
|
import com.google.gwt.event.dom.client.ClickHandler; |
24 |
|
import com.google.gwt.user.client.ui.HorizontalPanel; |
25 |
|
import com.google.gwt.user.client.ui.Label; |
26 |
|
import com.google.gwt.user.client.ui.Widget; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@author |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@deprecated |
36 |
|
|
|
|
| 0% |
Uncovered Elements: 46 (46) |
Complexity: 12 |
Complexity Density: 0.39 |
|
37 |
|
public class RemovableItemWithHeader extends MultiplicityItem { |
38 |
|
private String itemLabel = "Item "; |
39 |
|
private boolean useDeleteLabel = false; |
40 |
|
private boolean loaded = false; |
41 |
|
private KSLabel headerLabel; |
42 |
|
private boolean readOnly=false; |
43 |
|
protected VerticalFlowPanel itemPanel = new VerticalFlowPanel(); |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
0
|
public RemovableItemWithHeader(){... |
46 |
0
|
initWidget(itemPanel); |
47 |
|
} |
48 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
49 |
0
|
public void onLoad(){... |
50 |
|
} |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
0
|
public void isReadOnly(boolean readOnly){... |
53 |
0
|
this.readOnly=readOnly; |
54 |
|
} |
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 3 |
Complexity Density: 0.23 |
|
55 |
0
|
private Widget generateRemoveWidget() {... |
56 |
0
|
ClickHandler ch = new ClickHandler() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0
|
public void onClick(ClickEvent event) {... |
58 |
0
|
getRemoveCallback().exec(RemovableItemWithHeader.this); |
59 |
|
} |
60 |
|
}; |
61 |
|
|
62 |
0
|
Widget returnWidget; |
63 |
|
|
64 |
0
|
if (useDeleteLabel) { |
65 |
0
|
Label deleteLabel = new Label("Delete"); |
66 |
0
|
deleteLabel.addStyleName("KS-Multiplicity-Link-Label"); |
67 |
0
|
deleteLabel.addClickHandler(ch); |
68 |
0
|
returnWidget = deleteLabel; |
69 |
|
} else { |
70 |
0
|
returnWidget = new KSButton("-", ch); |
71 |
|
} |
72 |
|
|
73 |
0
|
itemPanel.addStyleName("KS-Multiplicity-Item"); |
74 |
|
|
75 |
0
|
if(readOnly){ |
76 |
0
|
returnWidget.setVisible(false); |
77 |
|
} |
78 |
|
else{ |
79 |
0
|
returnWidget.setVisible(true); |
80 |
|
} |
81 |
|
|
82 |
0
|
return returnWidget; |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
@see |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0
|
@Override... |
89 |
|
public void clear() { |
90 |
0
|
loaded = false; |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
@see |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
96 |
0
|
@Override... |
97 |
|
public void redraw() { |
98 |
0
|
Widget item = getItemWidget(); |
99 |
0
|
if (!loaded){ |
100 |
0
|
itemPanel.addStyleName("KS-Multiplicity-Item"); |
101 |
|
|
102 |
0
|
HorizontalPanel headerPanel = new HorizontalPanel(); |
103 |
0
|
headerPanel.addStyleName("KS-Multiplicity-Item-Header"); |
104 |
0
|
headerLabel = new KSLabel(itemLabel + " " + getItemKey()); |
105 |
0
|
headerPanel.add(headerLabel); |
106 |
0
|
headerPanel.add(generateRemoveWidget()); |
107 |
|
|
108 |
0
|
itemPanel.add(headerPanel); |
109 |
0
|
itemPanel.add(item); |
110 |
|
|
111 |
0
|
loaded = true; |
112 |
0
|
headerLabel.setText(itemLabel + " " + getItemKey()); |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
} |
121 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
0
|
public void setItemLabel(String itemLabel) {... |
123 |
0
|
this.itemLabel = itemLabel; |
124 |
|
} |
125 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
0
|
public void setUseDeleteLabel(boolean useDeleteLabel) {... |
127 |
0
|
this.useDeleteLabel = useDeleteLabel; |
128 |
|
} |
129 |
|
|
130 |
|
} |