Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 16 package javax.faces.component; 17 18 import javax.faces.context.FacesContext; 19 import javax.faces.el.ValueBinding; 20 21 39 public class UIMessage 40 extends UIComponentBase 41 { 42 44 public static final String COMPONENT_TYPE = "javax.faces.Message"; 45 public static final String COMPONENT_FAMILY = "javax.faces.Message"; 46 private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Message"; 47 private static final boolean DEFAULT_SHOWDETAIL = true; 48 private static final boolean DEFAULT_SHOWSUMMARY = false; 49 50 private String _for = null; 51 private Boolean _showDetail = null; 52 private Boolean _showSummary = null; 53 54 public UIMessage() 55 { 56 setRendererType(DEFAULT_RENDERER_TYPE); 57 } 58 59 public String getFamily() 60 { 61 return COMPONENT_FAMILY; 62 } 63 64 public void setFor(String forValue) 65 { 66 _for = forValue; 67 } 68 69 public String getFor() 70 { 71 if (_for != null) return _for; 72 ValueBinding vb = getValueBinding("for"); 73 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 74 } 75 76 public void setShowDetail(boolean showDetail) 77 { 78 _showDetail = Boolean.valueOf(showDetail); 79 } 80 81 public boolean isShowDetail() 82 { 83 if (_showDetail != null) return _showDetail.booleanValue(); 84 ValueBinding vb = getValueBinding("showDetail"); 85 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 86 return v != null ? v.booleanValue() : DEFAULT_SHOWDETAIL; 87 } 88 89 public void setShowSummary(boolean showSummary) 90 { 91 _showSummary = Boolean.valueOf(showSummary); 92 } 93 94 public boolean isShowSummary() 95 { 96 if (_showSummary != null) return _showSummary.booleanValue(); 97 ValueBinding vb = getValueBinding("showSummary"); 98 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 99 return v != null ? v.booleanValue() : DEFAULT_SHOWSUMMARY; 100 } 101 102 103 public Object saveState(FacesContext context) 104 { 105 Object values[] = new Object [4]; 106 values[0] = super.saveState(context); 107 values[1] = _for; 108 values[2] = _showDetail; 109 values[3] = _showSummary; 110 return ((Object ) (values)); 111 } 112 113 public void restoreState(FacesContext context, Object state) 114 { 115 Object values[] = (Object [])state; 116 super.restoreState(context, values[0]); 117 _for = (String )values[1]; 118 _showDetail = (Boolean )values[2]; 119 _showSummary = (Boolean )values[3]; 120 } 121 } 123
| Popular Tags
|