KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > layout > HtmlPanelLayout


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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 /**
24  * @author Manfred Geiler (latest modification by $Author: matze $)
25  * @version $Revision: 1.3 $ $Date: 2004/10/13 11:50:57 $
26  */

27 public class HtmlPanelLayout
28         extends HtmlPanelGroup
29 {
30     //private static final Log log = LogFactory.getLog(HtmlPanelLayout.class);
31

32     //HTML table attributes
33
//TODO!
34

35     // typesafe facet getters
36

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     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
59

60     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.HtmlPanelLayout";
61     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Panel";
62     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Layout";
63
64     private String JavaDoc _layout = null;
65     private String JavaDoc _headerClass = null;
66     private String JavaDoc _navigationClass = null;
67     private String JavaDoc _bodyClass = null;
68     private String JavaDoc _footerClass = null;
69     private String JavaDoc _headerStyle = null;
70     private String JavaDoc _navigationStyle = null;
71     private String JavaDoc _bodyStyle = null;
72     private String JavaDoc _footerStyle = null;
73
74     public HtmlPanelLayout()
75     {
76         setRendererType(DEFAULT_RENDERER_TYPE);
77     }
78
79     public String JavaDoc getFamily()
80     {
81         return COMPONENT_FAMILY;
82     }
83
84     public void setLayout(String JavaDoc layout)
85     {
86         _layout = layout;
87     }
88
89     public String JavaDoc getLayout()
90     {
91         if (_layout != null) return _layout;
92         ValueBinding vb = getValueBinding("layout");
93         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
94     }
95
96     public void setHeaderClass(String JavaDoc headerClass)
97     {
98         _headerClass = headerClass;
99     }
100
101     public String JavaDoc getHeaderClass()
102     {
103         if (_headerClass != null) return _headerClass;
104         ValueBinding vb = getValueBinding("headerClass");
105         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
106     }
107
108     public void setNavigationClass(String JavaDoc navigationClass)
109     {
110         _navigationClass = navigationClass;
111     }
112
113     public String JavaDoc getNavigationClass()
114     {
115         if (_navigationClass != null) return _navigationClass;
116         ValueBinding vb = getValueBinding("navigationClass");
117         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
118     }
119
120     public void setBodyClass(String JavaDoc bodyClass)
121     {
122         _bodyClass = bodyClass;
123     }
124
125     public String JavaDoc getBodyClass()
126     {
127         if (_bodyClass != null) return _bodyClass;
128         ValueBinding vb = getValueBinding("bodyClass");
129         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
130     }
131
132     public void setFooterClass(String JavaDoc footerClass)
133     {
134         _footerClass = footerClass;
135     }
136
137     public String JavaDoc getFooterClass()
138     {
139         if (_footerClass != null) return _footerClass;
140         ValueBinding vb = getValueBinding("footerClass");
141         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
142     }
143
144     public void setHeaderStyle(String JavaDoc headerStyle)
145     {
146         _headerStyle = headerStyle;
147     }
148
149     public String JavaDoc getHeaderStyle()
150     {
151         if (_headerStyle != null) return _headerStyle;
152         ValueBinding vb = getValueBinding("headerStyle");
153         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
154     }
155
156     public void setNavigationStyle(String JavaDoc navigationStyle)
157     {
158         _navigationStyle = navigationStyle;
159     }
160
161     public String JavaDoc getNavigationStyle()
162     {
163         if (_navigationStyle != null) return _navigationStyle;
164         ValueBinding vb = getValueBinding("navigationStyle");
165         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
166     }
167
168     public void setBodyStyle(String JavaDoc bodyStyle)
169     {
170         _bodyStyle = bodyStyle;
171     }
172
173     public String JavaDoc getBodyStyle()
174     {
175         if (_bodyStyle != null) return _bodyStyle;
176         ValueBinding vb = getValueBinding("bodyStyle");
177         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
178     }
179
180     public void setFooterStyle(String JavaDoc footerStyle)
181     {
182         _footerStyle = footerStyle;
183     }
184
185     public String JavaDoc getFooterStyle()
186     {
187         if (_footerStyle != null) return _footerStyle;
188         ValueBinding vb = getValueBinding("footerStyle");
189         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
190     }
191
192
193     public Object JavaDoc saveState(FacesContext context)
194     {
195         Object JavaDoc values[] = new Object JavaDoc[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 JavaDoc) (values));
207     }
208
209     public void restoreState(FacesContext context, Object JavaDoc state)
210     {
211         Object JavaDoc values[] = (Object JavaDoc[])state;
212         super.restoreState(context, values[0]);
213         _layout = (String JavaDoc)values[1];
214         _headerClass = (String JavaDoc)values[2];
215         _navigationClass = (String JavaDoc)values[3];
216         _bodyClass = (String JavaDoc)values[4];
217         _footerClass = (String JavaDoc)values[5];
218         _headerStyle = (String JavaDoc)values[6];
219         _navigationStyle = (String JavaDoc)values[7];
220         _bodyStyle = (String JavaDoc)values[8];
221         _footerStyle = (String JavaDoc)values[9];
222     }
223     //------------------ GENERATED CODE END ---------------------------------------
224
}
225
Popular Tags