View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import org.slf4j.Logger;
23  import org.slf4j.LoggerFactory;
24  
25  /**
26   * Name constants of the attributes of the Tobago components.
27   */
28  public enum Attributes {
29  
30    accessKey,
31    action,
32    actionExpression,
33    actionListener,
34    actionListenerExpression,
35    align,
36    alignItems,
37    alt,
38    applicationIcon,
39    autocomplete,
40    autoReload,
41    backgroundImage,
42    bodyContent,
43    border,
44    /**
45     * Used by a layout manager
46     */
47    borderBottom,
48    /**
49     * Used by a layout manager
50     */
51    borderLeft,
52    /**
53     * Used by a layout manager
54     */
55    borderRight,
56    /**
57     * Used by a layout manager
58     */
59    borderTop,
60    bottom,
61    charset,
62    clientProperties,
63    closed,
64    collapsed,
65    collapsedMode,
66    /**
67     * @deprecated since 4.0.0
68     */
69    @Deprecated
70    column,
71    columnSpan,
72    columnSpacing,
73    columns,
74    compact,
75    confirmation,
76    content,
77    converter,
78    customClass,
79    createSpan,
80    css,
81    cssClassesBlocks,
82    dateStyle,
83    defaultCommand,
84    delay,
85    directLinkCount,
86    disabled,
87    display,
88    enctype,
89    escape,
90    expanded,
91    execute,
92    event,
93    extraLarge,
94    extraSmall,
95    fieldId,
96    file,
97    filter,
98    first,
99    fixed,
100   flexGrow,
101   flexShrink,
102   flexBasis,
103   fragment,
104   frequency,
105   focus,
106   focusId,
107   formatPattern,
108   forValue("for"),
109   globalOnly,
110   gridColumn,
111   gridRow,
112   gridTemplateColumns,
113   gridTemplateRows,
114   height,
115   hidden,
116   hover,
117   httpEquiv,
118   i18n,
119   iconSize,
120   id,
121   immediate,
122   image,
123   inline,
124   itemDescription,
125   itemDisabled,
126   itemLabel,
127   itemImage,
128   itemValue,
129   justifyContent,
130   label,
131   labelLayout,
132   labelPosition,
133   labelWidth,
134   large,
135   layoutOrder,
136   left,
137   lang,
138   link,
139   /** @deprecated since 2.0.0 */
140   @Deprecated
141   margin,
142   /**
143    * Used by a layout manager
144    */
145   marginBottom,
146   /**
147    * Used by a layout manager
148    */
149   marginExtraLarge,
150   /**
151    * Used by a layout manager
152    */
153   marginExtraSmall,
154   /**
155    * Used by a layout manager
156    */
157   marginLarge,
158   /**
159    * Used by a layout manager
160    */
161   marginLeft,
162   /**
163    * Used by a layout manager
164    */
165   marginMedium,
166   /**
167    * Used by a layout manager
168    */
169   marginRight,
170   /**
171    * Used by a layout manager
172    */
173   marginSmall,
174   /**
175    * Used by a layout manager
176    */
177   marginTop,
178   marked,
179   markup,
180   max,
181   maxSeverity,
182   maxNumber,
183   maximumItems,
184   maximumHeight,
185   maximumWidth,
186   maxHeight,
187   maxWidth,
188   method,
189   min,
190   minHeight,
191   minWidth,
192   minSeverity,
193   minimumCharacters,
194   minimumHeight,
195   minimumWidth,
196   medium,
197   modal,
198   mode,
199   multiple,
200   mutable,
201   name,
202   navigate,
203   numberStyle,
204   /**
205    * Used by a layout manager
206    */
207   offsetExtraSmall,
208   /**
209    * Used by a layout manager
210    */
211   offsetExtraLarge,
212   /**
213    * Used by a layout manager
214    */
215   offsetLarge,
216   /**
217    * Used by a layout manager
218    */
219   offsetMedium,
220   /**
221    * Used by a layout manager
222    */
223   offsetSmall,
224   /**
225    * Used by a layout manager
226    */
227   overwriteExtraLarge,
228   /**
229    * Used by a layout manager
230    */
231   overwriteExtraSmall,
232   /**
233    * Used by a layout manager
234    */
235   overwriteLarge,
236   /**
237    * Used by a layout manager
238    */
239   overwriteMarginExtraLarge,
240   /**
241    * Used by a layout manager
242    */
243   overwriteMarginExtraSmall,
244   /**
245    * Used by a layout manager
246    */
247   overwriteMarginLarge,
248   /**
249    * Used by a layout manager
250    */
251   overwriteMarginMedium,
252   /**
253    * Used by a layout manager
254    */
255   overwriteMarginSmall,
256   /**
257    * Used by a layout manager
258    */
259   overwriteMedium,
260   /**
261    * Used by a layout manager
262    */
263   overwriteSmall,
264   omit,
265   /**
266    * @deprecated since 3.0.0
267    */
268   @Deprecated
269   onclick,
270   /**
271    * @deprecated since 3.0.0
272    */
273   @Deprecated
274   onchange,
275   open,
276   orderBy,
277   orientation,
278   outcome,
279   overflowX,
280   overflowY,
281   /**
282    * Used by a layout manager
283    */
284   paddingBottom,
285   /**
286    * Used by a layout manager
287    */
288   paddingLeft,
289   /**
290    * Used by a layout manager
291    */
292   paddingRight,
293   /**
294    * Used by a layout manager
295    */
296   paddingTop,
297   pagingTarget,
298   password,
299   placeholder,
300   popupClose,
301   popupList,
302   popupReset,
303   popupCalendarId,
304   position,
305   preferredHeight,
306   preferredWidth,
307   preformated,
308   readonly,
309   reference,
310   relative,
311   rendered,
312   renderedIndex,
313   rendererType,
314   renderAs,
315   renderRange,
316   renderRangeExtern,
317   required,
318   resizable,
319   right,
320   /**
321    * @deprecated since 4.0.0
322    */
323   @Deprecated
324   rigid,
325   rowId,
326   /**
327    * @deprecated since 4.0.0
328    */
329   @Deprecated
330   row,
331   rowSpan,
332   rowSpacing,
333   rows,
334   sanitize,
335   scriptFiles,
336   scrollbarHeight,
337   scrollbars,
338   // Attribute name could not be the same as the method name
339   // this cause an infinite loop on attribute map
340   scrollPosition,
341   selectable,
342   selectedIndex,
343   selectedLabel,
344   selectedListString,
345   selector,
346   sheetAction,
347   showCheckbox,
348   showDirectLinks,
349   showDirectLinksArrows,
350   showHeader,
351   showJunctions,
352   showNavigationBar,
353   showPageRange,
354   showPageRangeArrows,
355   showPagingAlways,
356   showRoot,
357   showRootJunction,
358   showRowRange,
359   showSummary,
360   showDetail,
361   size,
362   sortable,
363   sortActionListener,
364   sortActionListenerExpression,
365   small,
366   spanX,
367   spanY,
368   src,
369   state,
370   stateChangeListener,
371   stateChangeListenerExpression,
372   statePreview,
373   style,
374   suggestMethod,
375   suggestMethodExpression,
376   switchType,
377   tabChangeListener,
378   tabChangeListenerExpression,
379   tabIndex,
380   target,
381   timeStyle,
382   textAlign,
383   timezone,
384   title,
385   tip,
386   top,
387   totalCount,
388   transition,
389   type,
390   value,
391   valueChangeListener,
392   var,
393   unit,
394   unselectedLabel,
395   update,
396   validator,
397   viewport,
398   width,
399   widthList,
400   zIndex;
401 
402   /** This constants are needed for annotations, because they can't use the enums. */
403   public static final String EXECUTE = "execute";
404 
405   private static final Logger LOG = LoggerFactory.getLogger(Attributes.class);
406 
407   private final String explicit;
408 
409   Attributes() {
410     this(null);
411   }
412 
413   Attributes(final String explicit) {
414     this.explicit = explicit;
415   }
416 
417   public String getName() {
418     if (explicit != null) {
419       return explicit;
420     } else {
421       return name();
422     }
423   }
424 
425   public static Attributes valueOfFailsafe(final String name) {
426     try {
427       return Attributes.valueOf(name);
428     } catch (final IllegalArgumentException e) {
429       LOG.warn("Can't find enum for {} with name '{}'", Attributes.class.getName(), name);
430       return null;
431     }
432   }
433 
434 }