-
Notifications
You must be signed in to change notification settings - Fork 807
/
AbstractUITag.java
319 lines (264 loc) · 8.84 KB
/
AbstractUITag.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts2.views.jsp.ui;
import org.apache.struts2.components.UIBean;
import org.apache.struts2.views.jsp.ComponentTagSupport;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.DynamicAttributes;
import java.util.HashMap;
import java.util.Map;
/**
* Abstract base class for all UI tags.
*/
public abstract class AbstractUITag extends ComponentTagSupport implements DynamicAttributes {
protected String cssClass;
protected String cssErrorClass;
protected String cssStyle;
protected String cssErrorStyle;
protected String title;
protected String disabled;
protected String label;
protected String labelSeparator;
protected String labelPosition;
protected String requiredPosition;
protected String errorPosition;
protected String name;
protected String requiredLabel;
protected String tabindex;
protected String value;
protected String template;
protected String theme;
protected String templateDir;
protected String onclick;
protected String ondblclick;
protected String onmousedown;
protected String onmouseup;
protected String onmouseover;
protected String onmousemove;
protected String onmouseout;
protected String onfocus;
protected String onblur;
protected String onkeypress;
protected String onkeydown;
protected String onkeyup;
protected String onselect;
protected String onchange;
protected String accesskey;
protected String id;
protected String key;
// tooltip attributes
protected String tooltip;
protected String tooltipConfig;
protected String javascriptTooltip;
protected String tooltipDelay;
protected String tooltipCssClass;
protected String tooltipIconPath;
// dynamic attributes.
protected Map<String, String> dynamicAttributes = new HashMap<>();
protected void populateParams() {
super.populateParams();
UIBean uiBean = (UIBean) component;
uiBean.setCssClass(cssClass);
uiBean.setCssStyle(cssStyle);
uiBean.setCssErrorClass(cssErrorClass);
uiBean.setCssErrorStyle(cssErrorStyle);
uiBean.setTitle(title);
uiBean.setDisabled(disabled);
uiBean.setLabel(label);
uiBean.setLabelSeparator(labelSeparator);
uiBean.setLabelPosition(labelPosition);
uiBean.setRequiredPosition(requiredPosition);
uiBean.setErrorPosition(errorPosition);
uiBean.setName(name);
uiBean.setRequiredLabel(requiredLabel);
uiBean.setTabindex(tabindex);
uiBean.setValue(value);
uiBean.setTemplate(template);
uiBean.setTheme(theme);
uiBean.setTemplateDir(templateDir);
uiBean.setOnclick(onclick);
uiBean.setOndblclick(ondblclick);
uiBean.setOnmousedown(onmousedown);
uiBean.setOnmouseup(onmouseup);
uiBean.setOnmouseover(onmouseover);
uiBean.setOnmousemove(onmousemove);
uiBean.setOnmouseout(onmouseout);
uiBean.setOnfocus(onfocus);
uiBean.setOnblur(onblur);
uiBean.setOnkeypress(onkeypress);
uiBean.setOnkeydown(onkeydown);
uiBean.setOnkeyup(onkeyup);
uiBean.setOnselect(onselect);
uiBean.setOnchange(onchange);
uiBean.setTooltip(tooltip);
uiBean.setTooltipConfig(tooltipConfig);
uiBean.setJavascriptTooltip(javascriptTooltip);
uiBean.setTooltipCssClass(tooltipCssClass);
uiBean.setTooltipDelay(tooltipDelay);
uiBean.setTooltipIconPath(tooltipIconPath);
uiBean.setAccesskey(accesskey);
uiBean.setKey(key);
uiBean.setId(id);
uiBean.setDynamicAttributes(dynamicAttributes);
}
public void setId(String id) {
this.id = id;
}
public void setCssClass(String cssClass) {
this.cssClass = cssClass;
}
/**
* @deprecated Use {@link #setCssClass(String)} instead
*/
@Deprecated
public void setClass(String cssClass) {
this.cssClass = cssClass;
}
public void setCssStyle(String cssStyle) {
this.cssStyle = cssStyle;
}
public void setStyle(String cssStyle) {
this.cssStyle = cssStyle;
}
public void setCssErrorClass(String cssErrorClass) {
this.cssErrorClass = cssErrorClass;
}
public void setCssErrorStyle(String cssErrorStyle) {
this.cssErrorStyle = cssErrorStyle;
}
public void setTitle(String title) {
this.title = title;
}
public void setDisabled(String disabled) {
this.disabled = disabled;
}
public void setLabel(String label) {
this.label = label;
}
/**
* Deprecated since 2.5.27
* @deprecated use {@link #setLabelPosition(String)} instead
*/
@Deprecated
public void setLabelposition(String labelPosition) {
this.labelPosition = labelPosition;
}
public void setLabelPosition(String labelPosition) {
this.labelPosition = labelPosition;
}
public void setRequiredPosition(String requiredPosition) {
this.requiredPosition = requiredPosition;
}
public void setErrorPosition(String errorPosition) {
this.errorPosition = errorPosition;
}
public void setName(String name) {
this.name = name;
}
public void setRequiredLabel(String requiredLabel) {
this.requiredLabel = requiredLabel;
}
public void setTabindex(String tabindex) {
this.tabindex = tabindex;
}
public void setValue(String value) {
this.value = value;
}
public void setTemplateDir(String templateDir) {
this.templateDir = templateDir;
}
public void setTemplate(String template) {
this.template = template;
}
public void setTheme(String theme) {
this.theme = theme;
}
public void setOnclick(String onclick) {
this.onclick = onclick;
}
public void setOndblclick(String ondblclick) {
this.ondblclick = ondblclick;
}
public void setOnmousedown(String onmousedown) {
this.onmousedown = onmousedown;
}
public void setOnmouseup(String onmouseup) {
this.onmouseup = onmouseup;
}
public void setOnmouseover(String onmouseover) {
this.onmouseover = onmouseover;
}
public void setOnmousemove(String onmousemove) {
this.onmousemove = onmousemove;
}
public void setOnmouseout(String onmouseout) {
this.onmouseout = onmouseout;
}
public void setOnfocus(String onfocus) {
this.onfocus = onfocus;
}
public void setOnblur(String onblur) {
this.onblur = onblur;
}
public void setOnkeypress(String onkeypress) {
this.onkeypress = onkeypress;
}
public void setOnkeydown(String onkeydown) {
this.onkeydown = onkeydown;
}
public void setOnkeyup(String onkeyup) {
this.onkeyup = onkeyup;
}
public void setOnselect(String onselect) {
this.onselect = onselect;
}
public void setOnchange(String onchange) {
this.onchange = onchange;
}
public void setTooltip(String tooltip) {
this.tooltip = tooltip;
}
public void setTooltipConfig(String tooltipConfig) {
this.tooltipConfig = tooltipConfig;
}
public void setAccesskey(String accesskey) {
this.accesskey = accesskey;
}
public void setKey(String key) {
this.key = key;
}
public void setJavascriptTooltip(String javascriptTooltip) {
this.javascriptTooltip = javascriptTooltip;
}
public void setTooltipCssClass(String tooltipCssClass) {
this.tooltipCssClass = tooltipCssClass;
}
public void setTooltipDelay(String tooltipDelay) {
this.tooltipDelay = tooltipDelay;
}
public void setTooltipIconPath(String tooltipIconPath) {
this.tooltipIconPath = tooltipIconPath;
}
public void setLabelSeparator(String labelSeparator) {
this.labelSeparator = labelSeparator;
}
public void setDynamicAttribute(String uri, String localName, Object value) throws JspException {
dynamicAttributes.put(localName, String.valueOf(value));
}
}