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