1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package javax.faces.webapp;
20
21 import javax.el.ValueExpression;
22 import javax.faces.application.Application;
23 import javax.faces.component.UIComponent;
24 import javax.faces.context.FacesContext;
25 import javax.servlet.jsp.JspException;
26 import javax.servlet.jsp.tagext.Tag;
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public abstract class UIComponentELTag extends UIComponentClassicTagBase
47 implements Tag
48 {
49
50 private ValueExpression _binding = null;
51 private ValueExpression _rendered = null;
52
53 public UIComponentELTag()
54 {
55
56 }
57
58 public void release()
59 {
60 super.release();
61 _binding = null;
62 _rendered = null;
63 }
64
65
66 protected void setProperties(UIComponent component)
67 {
68 if (getRendererType() != null)
69 {
70 component.setRendererType(getRendererType());
71 }
72
73 if (_rendered != null)
74 {
75 if (_rendered.isLiteralText())
76 {
77 boolean b = Boolean.valueOf(_rendered.getExpressionString()).booleanValue();
78 component.setRendered(b);
79 }
80 else
81 {
82 component.setValueExpression("rendered", _rendered);
83 }
84 }
85 }
86
87 protected UIComponent createComponent(FacesContext context, String newId) throws JspException
88 {
89 UIComponent component;
90 Application application = context.getApplication();
91
92 if (_binding != null)
93 {
94 component = application.createComponent(_binding, context, getComponentType());
95 component.setValueExpression("binding", _binding);
96 }
97 else
98 {
99 component = application.createComponent(getComponentType());
100 }
101
102 component.setId(newId);
103 setProperties(component);
104
105 return component;
106 }
107
108 public void setBinding(ValueExpression binding) throws JspException
109 {
110 _binding = binding;
111 }
112
113 protected boolean hasBinding()
114 {
115 return _binding != null;
116 }
117
118 public void setRendered(ValueExpression rendered)
119 {
120 _rendered = rendered;
121 }
122 }