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(titleText); |
31 | 0 | messageLabel.setText(message); |
32 | 0 | layout.add(messageLabel); |
33 | 0 | dialog.addButtonGroup(buttons); |
34 | 0 | layout.addStyleName("ks-confirmation-message-layout"); |
35 | 0 | messageLabel.setStyleName("ks-confirmation-message-label"); |
36 | 0 | dialog.setWidget(layout); |
37 | 0 | dialog.setSize(600, 100); |
38 | 0 | } |
39 | |
|
40 | |
public void show(){ |
41 | 0 | dialog.show(); |
42 | 0 | } |
43 | |
|
44 | |
public void hide(){ |
45 | 0 | dialog.hide(); |
46 | 0 | } |
47 | |
|
48 | |
public void removeCloseLink(){ |
49 | 0 | dialog.removeCloseLink(); |
50 | 0 | } |
51 | |
|
52 | |
public HandlerRegistration addCloseHandler(CloseHandler handler){ |
53 | 0 | return dialog.addCloseHandler(handler); |
54 | |
} |
55 | |
|
56 | |
public void setMessageText(String text){ |
57 | 0 | messageLabel.setText(text); |
58 | 0 | } |
59 | |
|
60 | |
public ButtonGroup<T> getButtonGroup(){ |
61 | 0 | return buttons; |
62 | |
} |
63 | |
} |