Clover Coverage Report - KS Common 1.2-M6-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Sep 12 2011 05:50:56 EDT
../../../../../../../../img/srcFileCovDistChart0.png 30% of files have more coverage
22   101   11   2
0   67   0.5   11
11     1  
1    
 
  ConfirmationDialog       Line # 31 22 0% 11 33 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    package org.kuali.student.common.ui.client.widgets.dialog;
17   
18    import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
19    import org.kuali.student.common.ui.client.widgets.KSButton;
20    import org.kuali.student.common.ui.client.widgets.KSLabel;
21    import org.kuali.student.common.ui.client.widgets.KSLightBox;
22    import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle;
23    import org.kuali.student.common.ui.client.widgets.layout.HorizontalBlockFlowPanel;
24   
25    import com.google.gwt.event.dom.client.ClickEvent;
26    import com.google.gwt.event.dom.client.ClickHandler;
27    import com.google.gwt.event.logical.shared.CloseHandler;
28    import com.google.gwt.event.shared.HandlerRegistration;
29    import com.google.gwt.user.client.ui.FlowPanel;
30   
 
31    public class ConfirmationDialog {
32    private KSLightBox dialog;
33   
34    private KSButton cancel = new KSButton("Cancel", ButtonStyle.ANCHOR_LARGE_CENTERED);
35    private KSButton confirm = new KSButton("Confirm", ButtonStyle.PRIMARY_SMALL);
36    private HorizontalBlockFlowPanel buttonPanel = new HorizontalBlockFlowPanel();
37    private KSLabel messageLabel = new KSLabel();
38    private SectionTitle title = SectionTitle.generateH3Title("");
39   
40    private FlowPanel layout = new FlowPanel();
41   
 
42  0 toggle public ConfirmationDialog(String titleText, String message){
43  0 setupLayout(titleText, message);
44    }
45   
 
46  0 toggle public ConfirmationDialog(String titleText, String message, String confirmText){
47  0 confirm.setText(confirmText);
48  0 setupLayout(titleText, message);
49    }
50   
 
51  0 toggle private void setupLayout(String titleText, String message){
52    //title.setText(titleText);
53  0 dialog = new KSLightBox(titleText);
54   
55  0 cancel.addClickHandler(new ClickHandler(){
56   
 
57  0 toggle @Override
58    public void onClick(ClickEvent event) {
59  0 dialog.hide();
60    }
61    });
62   
63  0 messageLabel.setText(message);
64  0 dialog.addButton(confirm);
65  0 dialog.addButton(cancel);
66  0 layout.add(messageLabel);
67  0 layout.add(buttonPanel);
68  0 layout.addStyleName("ks-confirmation-message-layout");
69  0 messageLabel.setStyleName("ks-confirmation-message-label");
70  0 dialog.setWidget(layout);
71  0 dialog.setSize(600, 100);
72    }
73   
 
74  0 toggle public void show(){
75  0 dialog.show();
76    }
77   
 
78  0 toggle public void hide(){
79  0 dialog.hide();
80    }
81   
 
82  0 toggle public void removeCloseLink(){
83  0 dialog.removeCloseLink();
84    }
85   
 
86  0 toggle public HandlerRegistration addCloseHandler(CloseHandler handler){
87  0 return dialog.addCloseHandler(handler);
88    }
89   
 
90  0 toggle public void setMessageText(String text){
91  0 messageLabel.setText(text);
92    }
93   
 
94  0 toggle public KSButton getConfirmButton(){
95  0 return confirm;
96    }
97   
 
98  0 toggle public KSButton getCancelButton(){
99  0 return cancel;
100    }
101    }