KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > navmenu > jscookmenu > HtmlCommandJSCookMenu


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.navmenu.jscookmenu;
17
18 import org.apache.myfaces.component.UserRoleUtils;
19 import org.apache.myfaces.component.UserRoleAware;
20
21 import javax.faces.component.UICommand;
22 import javax.faces.el.ValueBinding;
23 import javax.faces.context.FacesContext;
24
25 /**
26  * @author Thomas Spiegl (latest modification by $Author: matze $)
27  * @version $Revision: 1.5 $ $Date: 2004/10/13 11:50:57 $
28  * $Log: HtmlCommandJSCookMenu.java,v $
29  * Revision 1.5 2004/10/13 11:50:57 matze
30  * renamed packages to org.apache
31  *
32  * Revision 1.4 2004/07/01 21:53:09 mwessendorf
33  * ASF switch
34  *
35  * Revision 1.3 2004/06/24 08:02:10 royalts
36  * no message
37  *
38  * Revision 1.2 2004/06/23 14:35:18 royalts
39  * no message
40  *
41  * Revision 1.1 2004/06/23 13:44:31 royalts
42  * no message
43  *
44  */

45 public class HtmlCommandJSCookMenu
46     extends UICommand
47     implements UserRoleAware
48 {
49     //private static final Log log = LogFactory.getLog(HtmlCommandJSCookMenu.class);
50

51     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
52

53     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.JSCookMenu";
54     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Command";
55
56     private String JavaDoc _layout = null;
57     private String JavaDoc _theme = null;
58     private String JavaDoc _enabledOnUserRole = null;
59     private String JavaDoc _visibleOnUserRole = null;
60
61     public HtmlCommandJSCookMenu()
62     {
63     }
64
65     public String JavaDoc getFamily()
66     {
67         return COMPONENT_FAMILY;
68     }
69
70     public boolean isImmediate()
71     {
72         return true;
73     }
74
75     public void setLayout(String JavaDoc layout)
76     {
77         _layout = layout;
78     }
79
80     public String JavaDoc getLayout()
81     {
82         if (_layout != null) return _layout;
83         ValueBinding vb = getValueBinding("layout");
84         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
85     }
86
87     public void setTheme(String JavaDoc theme)
88     {
89         _theme = theme;
90     }
91
92     public String JavaDoc getTheme()
93     {
94         if (_theme != null) return _theme;
95         ValueBinding vb = getValueBinding("theme");
96         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
97     }
98
99     public void setEnabledOnUserRole(String JavaDoc enabledOnUserRole)
100     {
101         _enabledOnUserRole = enabledOnUserRole;
102     }
103
104     public String JavaDoc getEnabledOnUserRole()
105     {
106         if (_enabledOnUserRole != null) return _enabledOnUserRole;
107         ValueBinding vb = getValueBinding("enabledOnUserRole");
108         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
109     }
110
111     public void setVisibleOnUserRole(String JavaDoc visibleOnUserRole)
112     {
113         _visibleOnUserRole = visibleOnUserRole;
114     }
115
116     public String JavaDoc getVisibleOnUserRole()
117     {
118         if (_visibleOnUserRole != null) return _visibleOnUserRole;
119         ValueBinding vb = getValueBinding("visibleOnUserRole");
120         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
121     }
122
123     public boolean isRendered()
124     {
125         if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
126         return super.isRendered();
127     }
128
129     public Object JavaDoc saveState(FacesContext context)
130     {
131         Object JavaDoc values[] = new Object JavaDoc[5];
132         values[0] = super.saveState(context);
133         values[1] = _layout;
134         values[2] = _theme;
135         values[3] = _enabledOnUserRole;
136         values[4] = _visibleOnUserRole;
137         return ((Object JavaDoc) (values));
138     }
139
140     public void restoreState(FacesContext context, Object JavaDoc state)
141     {
142         Object JavaDoc values[] = (Object JavaDoc[])state;
143         super.restoreState(context, values[0]);
144         _layout = (String JavaDoc)values[1];
145         _theme = (String JavaDoc)values[2];
146         _enabledOnUserRole = (String JavaDoc)values[3];
147         _visibleOnUserRole = (String JavaDoc)values[4];
148     }
149     //------------------ GENERATED CODE END ---------------------------------------
150
}
151
Popular Tags