1 | |
package org.kuali.student.common.ui.client.widgets.dialog; |
2 | |
|
3 | |
import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle; |
4 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
5 | |
import org.kuali.student.common.ui.client.widgets.KSLightBox; |
6 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.ButtonEnum; |
7 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonGroup; |
8 | |
|
9 | |
import com.google.gwt.event.logical.shared.CloseHandler; |
10 | |
import com.google.gwt.event.shared.HandlerRegistration; |
11 | |
import com.google.gwt.user.client.ui.FlowPanel; |
12 | |
|
13 | |
public class ButtonMessageDialog<T extends ButtonEnum> { |
14 | |
|
15 | 0 | private KSLabel messageLabel = new KSLabel(); |
16 | 0 | private SectionTitle title = SectionTitle.generateH3Title(""); |
17 | |
|
18 | 0 | private FlowPanel layout = new FlowPanel(); |
19 | |
|
20 | |
private KSLightBox dialog; |
21 | |
private ButtonGroup<T> buttons; |
22 | |
|
23 | 0 | public ButtonMessageDialog(String titleText, String message, ButtonGroup<T> buttons){ |
24 | 0 | this.buttons = buttons; |
25 | 0 | setupLayout(titleText, message); |
26 | 0 | } |
27 | |
|
28 | |
private void setupLayout(String titleText, String message){ |
29 | |
|
30 | 0 | dialog = new KSLightBox(); |
31 | 0 | SectionTitle sectionTitle = SectionTitle.generateH2Title(titleText); |
32 | 0 | layout.add(sectionTitle); |
33 | 0 | messageLabel.setText(message); |
34 | 0 | layout.add(messageLabel); |
35 | 0 | dialog.addButtonGroup(buttons); |
36 | 0 | layout.addStyleName("ks-confirmation-message-layout"); |
37 | 0 | messageLabel.setStyleName("ks-confirmation-message-label"); |
38 | 0 | dialog.setWidget(layout); |
39 | 0 | dialog.setSize(600, 120); |
40 | 0 | } |
41 | |
|
42 | |
public void show(){ |
43 | 0 | dialog.show(); |
44 | 0 | } |
45 | |
|
46 | |
public void hide(){ |
47 | 0 | dialog.hide(); |
48 | 0 | } |
49 | |
|
50 | |
public void removeCloseLink(){ |
51 | 0 | dialog.removeCloseLink(); |
52 | 0 | } |
53 | |
|
54 | |
public HandlerRegistration addCloseHandler(CloseHandler handler){ |
55 | 0 | return dialog.addCloseHandler(handler); |
56 | |
} |
57 | |
|
58 | |
public void setMessageText(String text){ |
59 | 0 | messageLabel.setText(text); |
60 | 0 | } |
61 | |
|
62 | |
public ButtonGroup<T> getButtonGroup(){ |
63 | 0 | return buttons; |
64 | |
} |
65 | |
} |