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
12
13
14
15
16
17 public class WarnContainer extends Composite{
18 private Image icon = Theme.INSTANCE.getCommonImages().getWarningDiamondIcon();
19 private FlowPanel layout = new FlowPanel();
20 private FlowPanel normalLayout = new FlowPanel();
21 private FlowPanel warnLayout = new FlowPanel();
22
23 public WarnContainer(){
24 icon.addStyleName("ks-message-static-image");
25 normalLayout.addStyleName("ks-message-static-margin");
26 layout.add(icon);
27 layout.add(normalLayout);
28 layout.add(warnLayout);
29 this.initWidget(layout);
30 }
31
32 public WarnContainer(boolean shown){
33 icon.addStyleName("ks-message-static-image");
34 normalLayout.addStyleName("ks-message-static-margin");
35 layout.add(icon);
36 layout.add(normalLayout);
37 layout.add(warnLayout);
38 this.initWidget(layout);
39 this.showWarningLayout(shown);
40 }
41
42 public void add(Widget w){
43 normalLayout.add(w);
44 }
45
46 public void addWarnWidget(Widget w){
47 warnLayout.add(w);
48 w.getElement().setAttribute("style", "display: inline");
49 }
50
51 public void showWarningLayout(boolean show){
52 icon.setVisible(show);
53 warnLayout.setVisible(show);
54 if(show){
55 layout.addStyleName("ks-message-static");
56 }
57 else{
58
59 layout.removeStyleName("ks-message-static");
60 }
61 }
62
63 }