View Javadoc

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.dom.client.ClickHandler;
10  import com.google.gwt.event.logical.shared.CloseHandler;
11  import com.google.gwt.event.shared.HandlerRegistration;
12  import com.google.gwt.user.client.ui.FlowPanel;
13  
14  public class ButtonMessageDialog<T extends ButtonEnum> {
15  	
16  	private KSLabel messageLabel = new KSLabel();
17  	private SectionTitle title = SectionTitle.generateH3Title("");
18  	
19  	private FlowPanel layout = new FlowPanel();
20  	
21  	private KSLightBox dialog;
22  	private ButtonGroup<T> buttons;
23  	
24  	public ButtonMessageDialog(String titleText, String message, ButtonGroup<T> buttons){
25  		this.buttons = buttons;
26  		setupLayout(titleText, message);
27  	}
28  	
29  	private void setupLayout(String titleText, String message){
30  		//title.setText();
31  		dialog = new KSLightBox();	
32  		SectionTitle sectionTitle = SectionTitle.generateH2Title(titleText);
33  		dialog.setNonCaptionHeader(sectionTitle);
34  		messageLabel.setText(message);
35  		layout.add(messageLabel);
36  		dialog.addButtonGroup(buttons);
37  		layout.addStyleName("ks-confirmation-message-layout");
38  		messageLabel.setStyleName("ks-confirmation-message-label");
39  		dialog.setWidget(layout);
40  		dialog.setSize(600, 155);
41  	}
42  	
43  	public void show(){
44  		dialog.show();
45  	}
46  	
47  	public void hide(){
48  		dialog.hide();
49  	}
50  	
51  	public void removeCloseLink(){
52  		dialog.removeCloseLink();
53  	}
54  	
55  	public HandlerRegistration addCloseLinkClickHandler(ClickHandler clickHandler) {
56          return dialog.addCloseLinkClickHandler(clickHandler);
57      }
58  	
59  	public HandlerRegistration addCloseHandler(CloseHandler handler){
60  		return dialog.addCloseHandler(handler);
61  	}
62  	
63  	public void setMessageText(String text){
64  		messageLabel.setText(text);
65  	}
66  	
67  	public ButtonGroup<T> getButtonGroup(){
68  		return buttons;
69  	}
70  }