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.dom.client.Style.Display;
6 import com.google.gwt.user.client.ui.Composite;
7 import com.google.gwt.user.client.ui.FlowPanel;
8 import com.google.gwt.user.client.ui.Image;
9 import com.google.gwt.user.client.ui.Widget;
10
11
12
13
14
15
16
17
18 public class WarnContainer extends Composite{
19 private Image icon = Theme.INSTANCE.getCommonImages().getWarningDiamondIcon();
20 private FlowPanel layout = new FlowPanel();
21 private FlowPanel normalLayout = new FlowPanel();
22 private FlowPanel warnLayout = new FlowPanel();
23
24 public WarnContainer(){
25 icon.addStyleName("ks-message-static-image");
26 normalLayout.addStyleName("ks-message-static-margin");
27 layout.add(icon);
28 layout.add(normalLayout);
29 layout.add(warnLayout);
30 this.initWidget(layout);
31 }
32
33 public WarnContainer(boolean shown){
34 icon.addStyleName("ks-message-static-image");
35 normalLayout.addStyleName("ks-message-static-margin");
36 layout.add(icon);
37 layout.add(normalLayout);
38 layout.add(warnLayout);
39 this.initWidget(layout);
40 this.showWarningLayout(shown);
41 }
42
43 public void add(Widget w){
44 normalLayout.add(w);
45 }
46
47
48 public void addWarnWidget(Widget w){
49 warnLayout.add(w);
50 w.getElement().getStyle().setDisplay(Display.INLINE);
51 }
52
53
54 public void addWarnWidgetBlock(Widget w){
55 warnLayout.add(w);
56 w.getElement().getStyle().setDisplay(Display.BLOCK);
57 }
58
59 public void clearWarnLayout(){
60 warnLayout.clear();
61 }
62
63 public void showWarningLayout(boolean show){
64 icon.setVisible(show);
65 warnLayout.setVisible(show);
66 if(show){
67 layout.addStyleName("ks-message-static");
68 }
69 else{
70
71 layout.removeStyleName("ks-message-static");
72 }
73 }
74
75 }