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