1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.ui.client.widgets.dialog; |
17 |
|
|
18 |
|
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
19 |
|
import org.kuali.student.common.ui.client.widgets.KSButton; |
20 |
|
import org.kuali.student.common.ui.client.widgets.KSLabel; |
21 |
|
import org.kuali.student.common.ui.client.widgets.KSLightBox; |
22 |
|
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
23 |
|
import org.kuali.student.common.ui.client.widgets.layout.HorizontalBlockFlowPanel; |
24 |
|
|
25 |
|
import com.google.gwt.event.dom.client.ClickEvent; |
26 |
|
import com.google.gwt.event.dom.client.ClickHandler; |
27 |
|
import com.google.gwt.event.logical.shared.CloseHandler; |
28 |
|
import com.google.gwt.event.shared.HandlerRegistration; |
29 |
|
import com.google.gwt.user.client.ui.FlowPanel; |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 11 |
Complexity Density: 0.5 |
|
31 |
|
public class ConfirmationDialog { |
32 |
|
private KSLightBox dialog; |
33 |
|
|
34 |
|
private KSButton cancel = new KSButton("Cancel", ButtonStyle.ANCHOR_LARGE_CENTERED); |
35 |
|
private KSButton confirm = new KSButton("Confirm", ButtonStyle.PRIMARY_SMALL); |
36 |
|
private HorizontalBlockFlowPanel buttonPanel = new HorizontalBlockFlowPanel(); |
37 |
|
private KSLabel messageLabel = new KSLabel(); |
38 |
|
private SectionTitle title = SectionTitle.generateH3Title(""); |
39 |
|
|
40 |
|
private FlowPanel layout = new FlowPanel(); |
41 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
42 |
0
|
public ConfirmationDialog(String titleText, String message){... |
43 |
0
|
setupLayout(titleText, message); |
44 |
|
} |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
46 |
0
|
public ConfirmationDialog(String titleText, String message, String confirmText){... |
47 |
0
|
confirm.setText(confirmText); |
48 |
0
|
setupLayout(titleText, message); |
49 |
|
} |
50 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
|
51 |
0
|
private void setupLayout(String titleText, String message){... |
52 |
|
|
53 |
0
|
dialog = new KSLightBox(titleText); |
54 |
|
|
55 |
0
|
cancel.addClickHandler(new ClickHandler(){ |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0
|
@Override... |
58 |
|
public void onClick(ClickEvent event) { |
59 |
0
|
dialog.hide(); |
60 |
|
} |
61 |
|
}); |
62 |
|
|
63 |
0
|
messageLabel.setText(message); |
64 |
0
|
dialog.addButton(confirm); |
65 |
0
|
dialog.addButton(cancel); |
66 |
0
|
layout.add(messageLabel); |
67 |
0
|
layout.add(buttonPanel); |
68 |
0
|
layout.addStyleName("ks-confirmation-message-layout"); |
69 |
0
|
messageLabel.setStyleName("ks-confirmation-message-label"); |
70 |
0
|
dialog.setWidget(layout); |
71 |
0
|
dialog.setSize(600, 100); |
72 |
|
} |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
0
|
public void show(){... |
75 |
0
|
dialog.show(); |
76 |
|
} |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
0
|
public void hide(){... |
79 |
0
|
dialog.hide(); |
80 |
|
} |
81 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
0
|
public void removeCloseLink(){... |
83 |
0
|
dialog.removeCloseLink(); |
84 |
|
} |
85 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
0
|
public HandlerRegistration addCloseHandler(CloseHandler handler){... |
87 |
0
|
return dialog.addCloseHandler(handler); |
88 |
|
} |
89 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
0
|
public void setMessageText(String text){... |
91 |
0
|
messageLabel.setText(text); |
92 |
|
} |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
94 |
0
|
public KSButton getConfirmButton(){... |
95 |
0
|
return confirm; |
96 |
|
} |
97 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
0
|
public KSButton getCancelButton(){... |
99 |
0
|
return cancel; |
100 |
|
} |
101 |
|
} |