1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.struts.faces.component;
23
24
25 import jakarta.el.ValueExpression;
26 import jakarta.faces.component.UIOutput;
27 import jakarta.faces.context.FacesContext;
28
29
30
31
32
33
34
35 public class WriteComponent extends UIOutput {
36
37
38
39
40
41
42
43
44 public WriteComponent() {
45
46 super();
47 setRendererType("org.apache.struts.faces.Write");
48
49 }
50
51
52
53
54
55
56
57
58 private boolean filter = true;
59 private boolean filterSet = false;
60
61
62
63
64
65 private String style = null;
66
67
68
69
70
71 private String styleClass = null;
72
73
74
75
76
77
78
79
80 public String getFamily() {
81
82 return "org.apache.struts.faces.Write";
83
84 }
85
86
87
88
89
90 public boolean isFilter() {
91
92 if (filterSet) {
93 return filter;
94 }
95 ValueExpression vb = getValueExpression("filter");
96 if (vb != null) {
97 Boolean value = (Boolean) vb.getValue(getFacesContext().getELContext());
98 if (null == value) {
99 return filter;
100 }
101 return value.booleanValue();
102 } else {
103 return filter;
104 }
105
106 }
107
108
109
110
111
112
113
114 public void setFilter(boolean filter) {
115
116 this.filter = filter;
117 this.filterSet = true;
118
119 }
120
121
122
123
124
125 public String getStyle() {
126
127 ValueExpression vb = getValueExpression("style");
128 if (vb != null) {
129 return (String) vb.getValue(getFacesContext().getELContext());
130 } else {
131 return style;
132 }
133
134 }
135
136
137
138
139
140
141
142 public void setStyle(String style) {
143
144 this.style = style;
145
146 }
147
148
149
150
151
152 public String getStyleClass() {
153
154 ValueExpression vb = getValueExpression("styleClass");
155 if (vb != null) {
156 return (String) vb.getValue(getFacesContext().getELContext());
157 } else {
158 return styleClass;
159 }
160
161 }
162
163
164
165
166
167
168
169 public void setStyleClass(String styleClass) {
170
171 this.styleClass = styleClass;
172
173 }
174
175
176
177
178
179
180
181
182
183
184
185 public void restoreState(FacesContext context, Object state) {
186
187 Object values[] = (Object[]) state;
188 super.restoreState(context, values[0]);
189 filter = ((Boolean) values[1]).booleanValue();
190 filterSet = ((Boolean) values[2]).booleanValue();
191 style = (String) values[3];
192 styleClass = (String) values[4];
193
194 }
195
196
197
198
199
200
201
202 public Object saveState(FacesContext context) {
203
204 Object values[] = new Object[5];
205 values[0] = super.saveState(context);
206 values[1] = filter ? Boolean.TRUE : Boolean.FALSE;
207 values[2] = filterSet ? Boolean.TRUE : Boolean.FALSE;
208 values[3] = style;
209 values[4] = styleClass;
210 return values;
211
212 }
213
214
215 }