Coverage Report - org.kuali.student.common.ui.client.configurable.mvc.sections.WarnContainer
 
Classes in this File Line Coverage Branch Coverage Complexity
WarnContainer
0%
0/37
0%
0/2
1.143
 
 1  
 package org.kuali.student.common.ui.client.configurable.mvc.sections;
 2  
 
 3  
 import org.kuali.student.common.ui.client.theme.Theme;
 4  
 
 5  
 import com.google.gwt.user.client.ui.Composite;
 6  
 import com.google.gwt.user.client.ui.FlowPanel;
 7  
 import com.google.gwt.user.client.ui.Image;
 8  
 import com.google.gwt.user.client.ui.Widget;
 9  
 
 10  
 /**
 11  
  * An information message which can change its style to appear with a warning around the
 12  
  * content and add additional information to its layout when it needs to warn the user about the contained
 13  
  * information/widget functionality before they interact with it.
 14  
  * @author Kuali Student Team
 15  
  *
 16  
  */
 17  
 public class WarnContainer extends Composite{
 18  0
         private Image icon = Theme.INSTANCE.getCommonImages().getWarningDiamondIcon();
 19  0
         private FlowPanel layout = new FlowPanel();
 20  0
         private FlowPanel normalLayout = new FlowPanel();
 21  0
         private FlowPanel warnLayout = new FlowPanel();
 22  
         
 23  0
         public WarnContainer(){
 24  0
                 icon.addStyleName("ks-message-static-image");
 25  0
                 normalLayout.addStyleName("ks-message-static-margin");
 26  0
                 layout.add(icon);
 27  0
                 layout.add(normalLayout);
 28  0
                 layout.add(warnLayout);
 29  0
                 this.initWidget(layout);
 30  0
         }
 31  
         
 32  0
         public WarnContainer(boolean shown){
 33  0
                 icon.addStyleName("ks-message-static-image");
 34  0
                 normalLayout.addStyleName("ks-message-static-margin");
 35  0
                 layout.add(icon);
 36  0
                 layout.add(normalLayout);
 37  0
                 layout.add(warnLayout);
 38  0
                 this.initWidget(layout);
 39  0
                 this.showWarningLayout(shown);
 40  0
         }
 41  
         
 42  
         public void add(Widget w){
 43  0
                 normalLayout.add(w);
 44  0
         }
 45  
         
 46  
         //Adds to same line
 47  
         public void addWarnWidget(Widget w){
 48  0
                 warnLayout.add(w);
 49  0
                 w.getElement().setAttribute("style", "display: inline");
 50  0
         }
 51  
         
 52  
         //Adds to newline
 53  
         public void addWarnWidgetBlock(Widget w){        // KSLAB-1985
 54  0
                 warnLayout.add(w);
 55  0
                 w.getElement().setAttribute("style", "display: block");
 56  0
         }
 57  
         
 58  
         public void clearWarnLayout(){        
 59  0
                 warnLayout.clear();
 60  0
         }
 61  
         
 62  
         public void showWarningLayout(boolean show){
 63  0
                 icon.setVisible(show);
 64  0
                 warnLayout.setVisible(show);
 65  0
                 if(show){
 66  0
                         layout.addStyleName("ks-message-static");
 67  
                 }
 68  
                 else{
 69  
 
 70  0
                         layout.removeStyleName("ks-message-static");
 71  
                 }
 72  0
         }
 73  
 
 74  
 }