KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > tabbedpane > HtmlPanelTab


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.tabbedpane;
17
18 import javax.faces.component.html.HtmlPanelGroup;
19 import javax.faces.context.FacesContext;
20 import javax.faces.el.ValueBinding;
21
22 import org.apache.myfaces.component.UserRoleUtils;
23
24 /**
25  * @author Manfred Geiler (latest modification by $Author: oros $)
26  * @version $Revision: 1.4 $ $Date: 2004/11/26 14:29:12 $
27  */

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

33
34     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
35

36     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.HtmlPanelTab";
37     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Panel";
38     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "javax.faces.Group";
39
40     private String JavaDoc _label = null;
41
42     public HtmlPanelTab()
43     {
44         setRendererType(DEFAULT_RENDERER_TYPE);
45     }
46
47     public String JavaDoc getFamily()
48     {
49         return COMPONENT_FAMILY;
50     }
51
52     public void setLabel(String JavaDoc label)
53     {
54         _label = label;
55     }
56
57     public String JavaDoc getLabel()
58     {
59         if (_label != null) return _label;
60         ValueBinding vb = getValueBinding("label");
61         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
62     }
63
64
65     public Object JavaDoc saveState(FacesContext context)
66     {
67         Object JavaDoc values[] = new Object JavaDoc[2];
68         values[0] = super.saveState(context);
69         values[1] = _label;
70         return ((Object JavaDoc) (values));
71     }
72
73     public void restoreState(FacesContext context, Object JavaDoc state)
74     {
75         Object JavaDoc values[] = (Object JavaDoc[])state;
76         super.restoreState(context, values[0]);
77         _label = (String JavaDoc)values[1];
78     }
79     //------------------ GENERATED CODE END ---------------------------------------
80

81
82     public boolean isRendered()
83     {
84         if (!UserRoleUtils.isVisibleOnUserRole(this)) {
85             return false;
86         }
87         return super.isRendered();
88     }
89 }
90
Popular Tags