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