1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.client.configurable.mvc.sections; |
17 | |
|
18 | |
import org.kuali.student.common.ui.client.theme.Theme; |
19 | |
import org.kuali.student.common.ui.client.widgets.layout.HorizontalBlockFlowPanel; |
20 | |
|
21 | |
import com.google.gwt.user.client.ui.Composite; |
22 | |
import com.google.gwt.user.client.ui.HTMLPanel; |
23 | |
import com.google.gwt.user.client.ui.Image; |
24 | |
import com.google.gwt.user.client.ui.Widget; |
25 | |
|
26 | |
public class InfoMessage extends Composite{ |
27 | 0 | private HorizontalBlockFlowPanel layout = new HorizontalBlockFlowPanel(); |
28 | 0 | private Image icon = Theme.INSTANCE.getCommonImages().getWarningDiamondIcon(); |
29 | 0 | private HTMLPanel message = new HTMLPanel(""); |
30 | |
|
31 | 0 | public InfoMessage(String text, boolean visible){ |
32 | 0 | layout.add(icon); |
33 | 0 | message.getElement().setInnerHTML(text); |
34 | 0 | layout.add(message); |
35 | 0 | icon.addStyleName("ks-message-static-image"); |
36 | 0 | layout.addStyleName("ks-message-static"); |
37 | 0 | this.initWidget(layout); |
38 | 0 | this.setVisible(visible); |
39 | 0 | } |
40 | |
|
41 | |
|
42 | 0 | public InfoMessage(){ |
43 | 0 | icon.addStyleName("ks-message-static-image"); |
44 | 0 | layout.add(icon); |
45 | 0 | layout.add(message); |
46 | 0 | this.initWidget(layout); |
47 | 0 | this.setVisible(false); |
48 | 0 | } |
49 | |
|
50 | 0 | public InfoMessage(boolean visible, boolean showStyling){ |
51 | 0 | icon.addStyleName("ks-message-static-image"); |
52 | 0 | layout.add(icon); |
53 | 0 | layout.add(message); |
54 | 0 | this.initWidget(layout); |
55 | 0 | this.showWarnStyling(showStyling); |
56 | 0 | this.setVisible(visible); |
57 | 0 | } |
58 | |
|
59 | |
public void setMessage(String text, boolean messageVisible){ |
60 | 0 | message.getElement().setInnerHTML(text); |
61 | 0 | this.setVisible(messageVisible); |
62 | 0 | } |
63 | |
|
64 | |
public void insert(Widget w, int beforeIndex){ |
65 | 0 | layout.insert(w, beforeIndex); |
66 | 0 | } |
67 | |
|
68 | |
public void add(Widget w){ |
69 | 0 | layout.add(w); |
70 | 0 | } |
71 | |
|
72 | |
public void showWarnStyling(boolean showStyling){ |
73 | 0 | icon.setVisible(showStyling); |
74 | 0 | if(showStyling){ |
75 | 0 | layout.addStyleName("ks-message-static"); |
76 | |
} |
77 | |
else{ |
78 | 0 | layout.removeStyleName("ks-message-static"); |
79 | |
} |
80 | 0 | } |
81 | |
} |