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 | 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 | |
public void addWarnWidget(Widget w){ |
47 | 0 | warnLayout.add(w); |
48 | 0 | w.getElement().setAttribute("style", "display: inline"); |
49 | 0 | } |
50 | |
|
51 | |
public void showWarningLayout(boolean show){ |
52 | 0 | icon.setVisible(show); |
53 | 0 | warnLayout.setVisible(show); |
54 | 0 | if(show){ |
55 | 0 | layout.addStyleName("ks-message-static"); |
56 | |
} |
57 | |
else{ |
58 | |
|
59 | 0 | layout.removeStyleName("ks-message-static"); |
60 | |
} |
61 | 0 | } |
62 | |
|
63 | |
} |