1 16 package org.apache.myfaces.custom.layout; 17 18 import javax.faces.component.UIComponent; 19 import javax.faces.component.html.HtmlPanelGroup; 20 import javax.faces.context.FacesContext; 21 import javax.faces.el.ValueBinding; 22 23 27 public class HtmlPanelLayout 28 extends HtmlPanelGroup 29 { 30 32 35 37 public UIComponent getHeader() 38 { 39 return (UIComponent)getFacet("header"); 40 } 41 42 public UIComponent getNavigation() 43 { 44 return (UIComponent)getFacet("navigation"); 45 } 46 47 public UIComponent getBody() 48 { 49 return (UIComponent)getFacet("body"); 50 } 51 52 public UIComponent getFooter() 53 { 54 return (UIComponent)getFacet("footer"); 55 } 56 57 58 60 public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlPanelLayout"; 61 public static final String COMPONENT_FAMILY = "javax.faces.Panel"; 62 private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Layout"; 63 64 private String _layout = null; 65 private String _headerClass = null; 66 private String _navigationClass = null; 67 private String _bodyClass = null; 68 private String _footerClass = null; 69 private String _headerStyle = null; 70 private String _navigationStyle = null; 71 private String _bodyStyle = null; 72 private String _footerStyle = null; 73 74 public HtmlPanelLayout() 75 { 76 setRendererType(DEFAULT_RENDERER_TYPE); 77 } 78 79 public String getFamily() 80 { 81 return COMPONENT_FAMILY; 82 } 83 84 public void setLayout(String layout) 85 { 86 _layout = layout; 87 } 88 89 public String getLayout() 90 { 91 if (_layout != null) return _layout; 92 ValueBinding vb = getValueBinding("layout"); 93 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 94 } 95 96 public void setHeaderClass(String headerClass) 97 { 98 _headerClass = headerClass; 99 } 100 101 public String getHeaderClass() 102 { 103 if (_headerClass != null) return _headerClass; 104 ValueBinding vb = getValueBinding("headerClass"); 105 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 106 } 107 108 public void setNavigationClass(String navigationClass) 109 { 110 _navigationClass = navigationClass; 111 } 112 113 public String getNavigationClass() 114 { 115 if (_navigationClass != null) return _navigationClass; 116 ValueBinding vb = getValueBinding("navigationClass"); 117 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 118 } 119 120 public void setBodyClass(String bodyClass) 121 { 122 _bodyClass = bodyClass; 123 } 124 125 public String getBodyClass() 126 { 127 if (_bodyClass != null) return _bodyClass; 128 ValueBinding vb = getValueBinding("bodyClass"); 129 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 130 } 131 132 public void setFooterClass(String footerClass) 133 { 134 _footerClass = footerClass; 135 } 136 137 public String getFooterClass() 138 { 139 if (_footerClass != null) return _footerClass; 140 ValueBinding vb = getValueBinding("footerClass"); 141 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 142 } 143 144 public void setHeaderStyle(String headerStyle) 145 { 146 _headerStyle = headerStyle; 147 } 148 149 public String getHeaderStyle() 150 { 151 if (_headerStyle != null) return _headerStyle; 152 ValueBinding vb = getValueBinding("headerStyle"); 153 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 154 } 155 156 public void setNavigationStyle(String navigationStyle) 157 { 158 _navigationStyle = navigationStyle; 159 } 160 161 public String getNavigationStyle() 162 { 163 if (_navigationStyle != null) return _navigationStyle; 164 ValueBinding vb = getValueBinding("navigationStyle"); 165 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 166 } 167 168 public void setBodyStyle(String bodyStyle) 169 { 170 _bodyStyle = bodyStyle; 171 } 172 173 public String getBodyStyle() 174 { 175 if (_bodyStyle != null) return _bodyStyle; 176 ValueBinding vb = getValueBinding("bodyStyle"); 177 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 178 } 179 180 public void setFooterStyle(String footerStyle) 181 { 182 _footerStyle = footerStyle; 183 } 184 185 public String getFooterStyle() 186 { 187 if (_footerStyle != null) return _footerStyle; 188 ValueBinding vb = getValueBinding("footerStyle"); 189 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 190 } 191 192 193 public Object saveState(FacesContext context) 194 { 195 Object values[] = new Object [10]; 196 values[0] = super.saveState(context); 197 values[1] = _layout; 198 values[2] = _headerClass; 199 values[3] = _navigationClass; 200 values[4] = _bodyClass; 201 values[5] = _footerClass; 202 values[6] = _headerStyle; 203 values[7] = _navigationStyle; 204 values[8] = _bodyStyle; 205 values[9] = _footerStyle; 206 return ((Object ) (values)); 207 } 208 209 public void restoreState(FacesContext context, Object state) 210 { 211 Object values[] = (Object [])state; 212 super.restoreState(context, values[0]); 213 _layout = (String )values[1]; 214 _headerClass = (String )values[2]; 215 _navigationClass = (String )values[3]; 216 _bodyClass = (String )values[4]; 217 _footerClass = (String )values[5]; 218 _headerStyle = (String )values[6]; 219 _navigationStyle = (String )values[7]; 220 _bodyStyle = (String )values[8]; 221 _footerStyle = (String )values[9]; 222 } 223 } 225 | Popular Tags |