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