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 27 public class UIMessages 28 extends UIComponentBase 29 { 30 32 public static final String COMPONENT_TYPE = "javax.faces.Messages"; 33 public static final String COMPONENT_FAMILY = "javax.faces.Messages"; 34 private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Messages"; 35 private static final boolean DEFAULT_GLOBALONLY = false; 36 private static final boolean DEFAULT_SHOWDETAIL = false; 37 private static final boolean DEFAULT_SHOWSUMMARY = true; 38 39 private Boolean _globalOnly = null; 40 private Boolean _showDetail = null; 41 private Boolean _showSummary = null; 42 43 public UIMessages() 44 { 45 setRendererType(DEFAULT_RENDERER_TYPE); 46 } 47 48 public String getFamily() 49 { 50 return COMPONENT_FAMILY; 51 } 52 53 public void setGlobalOnly(boolean globalOnly) 54 { 55 _globalOnly = Boolean.valueOf(globalOnly); 56 } 57 58 public boolean isGlobalOnly() 59 { 60 if (_globalOnly != null) return _globalOnly.booleanValue(); 61 ValueBinding vb = getValueBinding("globalOnly"); 62 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 63 return v != null ? v.booleanValue() : DEFAULT_GLOBALONLY; 64 } 65 66 public void setShowDetail(boolean showDetail) 67 { 68 _showDetail = Boolean.valueOf(showDetail); 69 } 70 71 public boolean isShowDetail() 72 { 73 if (_showDetail != null) return _showDetail.booleanValue(); 74 ValueBinding vb = getValueBinding("showDetail"); 75 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 76 return v != null ? v.booleanValue() : DEFAULT_SHOWDETAIL; 77 } 78 79 public void setShowSummary(boolean showSummary) 80 { 81 _showSummary = Boolean.valueOf(showSummary); 82 } 83 84 public boolean isShowSummary() 85 { 86 if (_showSummary != null) return _showSummary.booleanValue(); 87 ValueBinding vb = getValueBinding("showSummary"); 88 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 89 return v != null ? v.booleanValue() : DEFAULT_SHOWSUMMARY; 90 } 91 92 93 public Object saveState(FacesContext context) 94 { 95 Object values[] = new Object [4]; 96 values[0] = super.saveState(context); 97 values[1] = _globalOnly; 98 values[2] = _showDetail; 99 values[3] = _showSummary; 100 return ((Object ) (values)); 101 } 102 103 public void restoreState(FacesContext context, Object state) 104 { 105 Object values[] = (Object [])state; 106 super.restoreState(context, values[0]); 107 _globalOnly = (Boolean )values[1]; 108 _showDetail = (Boolean )values[2]; 109 _showSummary = (Boolean )values[3]; 110 } 111 } 113
| Popular Tags
|