1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package javax.faces.component.html;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 import javax.faces.component.UIComponent;
25
26
27
28
29
30
31
32
33
34 class _CommonPropertyConstants
35 {
36 public static final String COMMON_PROPERTIES_MARKED = "oam.COMMON_PROPERTIES_MARKED";
37
38
39 public static final long STYLE_PROP = 0x1L;
40 public static final long STYLECLASS_PROP = 0x2L;
41
42
43
44 public static final long DIR_PROP = 0x4L;
45 public static final long LANG_PROP = 0x8L;
46 public static final long TITLE_PROP = 0x10L;
47
48
49 public static final long ESCAPE_PROP = 0x20L;
50
51
52
53 public static final long DISABLED_PROP = 0x40L;
54 public static final long ENABLED_PROP = 0x80L;
55 public static final long READONLY_PROP = 0x100L;
56
57
58 public static final long ACCESSKEY_PROP = 0x200L;
59
60
61 public static final long ALT_PROP = 0x400L;
62
63
64 public static final long ONCHANGE_PROP = 0x800L;
65 public static final long ONSELECT_PROP = 0x1000L;
66
67
68 public static final long ONCLICK_PROP = 0x2000L;
69 public static final long ONDBLCLICK_PROP = 0x4000L;
70 public static final long ONMOUSEDOWN_PROP = 0x8000L;
71 public static final long ONMOUSEUP_PROP = 0x10000L;
72 public static final long ONMOUSEOVER_PROP = 0x20000L;
73 public static final long ONMOUSEMOVE_PROP = 0x40000L;
74 public static final long ONMOUSEOUT_PROP = 0x80000L;
75 public static final long ONKEYPRESS_PROP = 0x100000L;
76 public static final long ONKEYDOWN_PROP = 0x200000L;
77 public static final long ONKEYUP_PROP = 0x400000L;
78
79
80 public static final long ONFOCUS_PROP = 0x800000L;
81 public static final long ONBLUR_PROP = 0x1000000L;
82
83
84 public static final long LABEL_PROP = 0x2000000L;
85
86
87 public static final long CHARSET_PROP = 0x4000000L;
88 public static final long COORDS_PROP = 0x8000000L;
89 public static final long HREFLANG_PROP = 0x10000000L;
90 public static final long REL_PROP = 0x20000000L;
91 public static final long REV_PROP = 0x40000000L;
92 public static final long SHAPE_PROP = 0x80000000L;
93 public static final long TARGET_PROP = 0x100000000L;
94 public static final long TYPE_PROP = 0x200000000L;
95
96
97 public static final long TABINDEX_PROP = 0x400000000L;
98
99
100 public static final long ALIGN_PROP = 0x800000000L;
101 public static final long CHECKED_PROP = 0x1000000000L;
102 public static final long MAXLENGTH_PROP = 0x2000000000L;
103 public static final long SIZE_PROP = 0x4000000000L;
104
105 public static final long ROLE_PROP = 0x8000000000L;
106
107 public static final Map<String, Long> COMMON_PROPERTIES_KEY_BY_NAME = new HashMap<String, Long>(64,1);
108
109 static
110 {
111 COMMON_PROPERTIES_KEY_BY_NAME.put("style", STYLE_PROP);
112
113 COMMON_PROPERTIES_KEY_BY_NAME.put("styleClass", STYLECLASS_PROP);
114
115
116
117 COMMON_PROPERTIES_KEY_BY_NAME.put("dir", DIR_PROP);
118 COMMON_PROPERTIES_KEY_BY_NAME.put("lang", LANG_PROP);
119 COMMON_PROPERTIES_KEY_BY_NAME.put("title", TITLE_PROP);
120
121
122 COMMON_PROPERTIES_KEY_BY_NAME.put("escape", ESCAPE_PROP);
123
124
125
126 COMMON_PROPERTIES_KEY_BY_NAME.put("disabled", DISABLED_PROP);
127 COMMON_PROPERTIES_KEY_BY_NAME.put("enabled", ENABLED_PROP);
128 COMMON_PROPERTIES_KEY_BY_NAME.put("readonly", READONLY_PROP);
129
130
131 COMMON_PROPERTIES_KEY_BY_NAME.put("accesskey", ACCESSKEY_PROP);
132
133
134 COMMON_PROPERTIES_KEY_BY_NAME.put("alt", ALT_PROP);
135
136
137 COMMON_PROPERTIES_KEY_BY_NAME.put("onchange", ONCHANGE_PROP);
138 COMMON_PROPERTIES_KEY_BY_NAME.put("onselect", ONSELECT_PROP);
139
140
141 COMMON_PROPERTIES_KEY_BY_NAME.put("onclick", ONCLICK_PROP);
142 COMMON_PROPERTIES_KEY_BY_NAME.put("ondblclick", ONDBLCLICK_PROP);
143 COMMON_PROPERTIES_KEY_BY_NAME.put("onmousedown",ONMOUSEDOWN_PROP);
144 COMMON_PROPERTIES_KEY_BY_NAME.put("onmouseup", ONMOUSEUP_PROP);
145 COMMON_PROPERTIES_KEY_BY_NAME.put("onmouseover",ONMOUSEOVER_PROP);
146 COMMON_PROPERTIES_KEY_BY_NAME.put("onmousemove",ONMOUSEMOVE_PROP);
147 COMMON_PROPERTIES_KEY_BY_NAME.put("onmouseout", ONMOUSEOUT_PROP);
148 COMMON_PROPERTIES_KEY_BY_NAME.put("onkeypress", ONKEYPRESS_PROP);
149 COMMON_PROPERTIES_KEY_BY_NAME.put("onkeydown", ONKEYDOWN_PROP);
150 COMMON_PROPERTIES_KEY_BY_NAME.put("onkeyup", ONKEYUP_PROP);
151
152
153 COMMON_PROPERTIES_KEY_BY_NAME.put("onfocus", ONFOCUS_PROP);
154 COMMON_PROPERTIES_KEY_BY_NAME.put("onblur", ONBLUR_PROP);
155
156
157 COMMON_PROPERTIES_KEY_BY_NAME.put("label", LABEL_PROP);
158
159
160 COMMON_PROPERTIES_KEY_BY_NAME.put("charset", CHARSET_PROP);
161 COMMON_PROPERTIES_KEY_BY_NAME.put("coords", COORDS_PROP);
162 COMMON_PROPERTIES_KEY_BY_NAME.put("hreflang", HREFLANG_PROP);
163 COMMON_PROPERTIES_KEY_BY_NAME.put("rel", REL_PROP);
164 COMMON_PROPERTIES_KEY_BY_NAME.put("rev", REV_PROP);
165 COMMON_PROPERTIES_KEY_BY_NAME.put("shape", SHAPE_PROP);
166 COMMON_PROPERTIES_KEY_BY_NAME.put("target", TARGET_PROP);
167 COMMON_PROPERTIES_KEY_BY_NAME.put("type", TYPE_PROP);
168
169
170 COMMON_PROPERTIES_KEY_BY_NAME.put("tabindex", TABINDEX_PROP);
171
172
173 COMMON_PROPERTIES_KEY_BY_NAME.put("align", ALIGN_PROP);
174 COMMON_PROPERTIES_KEY_BY_NAME.put("checked", CHECKED_PROP);
175 COMMON_PROPERTIES_KEY_BY_NAME.put("maxlength", MAXLENGTH_PROP);
176 COMMON_PROPERTIES_KEY_BY_NAME.put("size", SIZE_PROP);
177
178
179 COMMON_PROPERTIES_KEY_BY_NAME.put("role", ROLE_PROP);
180 }
181
182 public static void markProperty(UIComponent component, String name)
183 {
184 Long propertyConstant = COMMON_PROPERTIES_KEY_BY_NAME.get(name);
185 if (propertyConstant == null)
186 {
187 return;
188 }
189 Long commonPropertiesSet = (Long) component.getAttributes().get(COMMON_PROPERTIES_MARKED);
190 if (commonPropertiesSet == null)
191 {
192 commonPropertiesSet = 0L;
193 }
194 component.getAttributes().put(COMMON_PROPERTIES_MARKED, commonPropertiesSet | propertyConstant);
195 }
196
197 public static void markProperty(UIComponent component, long propertyConstant)
198 {
199 Long commonPropertiesSet = (Long) component.getAttributes().get(COMMON_PROPERTIES_MARKED);
200 if (commonPropertiesSet == null)
201 {
202 commonPropertiesSet = 0L;
203 }
204 component.getAttributes().put(COMMON_PROPERTIES_MARKED, commonPropertiesSet | propertyConstant);
205 }
206 }