KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > jsvalueset > HtmlJsValueSet


1 /*
2  * Copyright (c) 2004 Your Corporation. All Rights Reserved.
3  */

4 package org.apache.myfaces.custom.jsvalueset;
5
6 import org.apache.myfaces.component.UserRoleUtils;
7
8 import javax.faces.component.UIOutput;
9 import javax.faces.el.ValueBinding;
10 import javax.faces.context.FacesContext;
11
12 /**
13  * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
14  * @version $Revision: 1.1 $ $Date: 2004/12/19 00:50:55 $
15  * $Log: HtmlJsValueSet.java,v $
16  * Revision 1.1 2004/12/19 00:50:55 mmarinschek
17  * JsValueSetTag
18  *
19  *
20  */

21 public class HtmlJsValueSet extends UIOutput
22 {
23
24
25     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
26

27     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.HtmlJsValueSet";
28     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Output";
29     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "org.apache.myfaces.JsValueSet";
30
31     private String JavaDoc _name = null;
32
33     public HtmlJsValueSet()
34     {
35         setRendererType(DEFAULT_RENDERER_TYPE);
36     }
37
38     public String JavaDoc getFamily()
39     {
40         return COMPONENT_FAMILY;
41     }
42
43     public void setName(String JavaDoc name)
44     {
45         _name = name;
46     }
47
48     public String JavaDoc getName()
49     {
50         if (_name != null) return _name;
51         ValueBinding vb = getValueBinding("name");
52         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
53     }
54
55
56     public boolean isRendered()
57     {
58         if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
59         return super.isRendered();
60     }
61
62     public Object JavaDoc saveState(FacesContext context)
63     {
64         Object JavaDoc values[] = new Object JavaDoc[2];
65         values[0] = super.saveState(context);
66         values[1] = _name;
67         return ((Object JavaDoc) (values));
68     }
69
70     public void restoreState(FacesContext context, Object JavaDoc state)
71     {
72         Object JavaDoc values[] = (Object JavaDoc[])state;
73         super.restoreState(context, values[0]);
74         _name = (String JavaDoc)values[1];
75     }
76     //------------------ GENERATED CODE END ---------------------------------------
77
}
78
79
80
Popular Tags