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    @Deprecated
67    column,
68    columnSpan,
69    columnSpacing,
70    columns,
71    compact,
72    confirmation,
73    content,
74    converter,
75    customClass,
76    createSpan,
77    css,
78    cssClassesBlocks,
79    dateStyle,
80    defaultCommand,
81    delay,
82    directLinkCount,
83    disabled,
84    display,
85    enctype,
86    escape,
87    expanded,
88    execute,
89    event,
90    extraLarge,
91    extraSmall,
92    fieldId,
93    file,
94    filter,
95    first,
96    fixed,
97    flexGrow,
98    flexShrink,
99    flexBasis,
100   fragment,
101   frequency,
102   focus,
103   focusId,
104   formatPattern,
105   forValue("for"),
106   globalOnly,
107   gridColumn,
108   gridRow,
109   gridTemplateColumns,
110   gridTemplateRows,
111   height,
112   hidden,
113   hover,
114   httpEquiv,
115   i18n,
116   iconSize,
117   id,
118   immediate,
119   image,
120   inline,
121   itemDescription,
122   itemDisabled,
123   itemLabel,
124   itemImage,
125   itemValue,
126   justifyContent,
127   label,
128   labelLayout,
129   labelPosition,
130   labelWidth,
131   large,
132   layoutOrder,
133   left,
134   lang,
135   link,
136   /** @deprecated since 2.0.0 */
137   @Deprecated
138   margin,
139   /**
140    * Used by a layout manager
141    */
142   marginBottom,
143   /**
144    * Used by a layout manager
145    */
146   marginExtraLarge,
147   /**
148    * Used by a layout manager
149    */
150   marginExtraSmall,
151   /**
152    * Used by a layout manager
153    */
154   marginLarge,
155   /**
156    * Used by a layout manager
157    */
158   marginLeft,
159   /**
160    * Used by a layout manager
161    */
162   marginMedium,
163   /**
164    * Used by a layout manager
165    */
166   marginRight,
167   /**
168    * Used by a layout manager
169    */
170   marginSmall,
171   /**
172    * Used by a layout manager
173    */
174   marginTop,
175   marked,
176   markup,
177   max,
178   maxSeverity,
179   maxNumber,
180   maximumItems,
181   maximumHeight,
182   maximumWidth,
183   maxHeight,
184   maxWidth,
185   method,
186   min,
187   minHeight,
188   minWidth,
189   minSeverity,
190   minimumCharacters,
191   minimumHeight,
192   minimumWidth,
193   medium,
194   modal,
195   mode,
196   multiple,
197   mutable,
198   name,
199   navigate,
200   numberStyle,
201   /**
202    * Used by a layout manager
203    */
204   offsetExtraSmall,
205   /**
206    * Used by a layout manager
207    */
208   offsetExtraLarge,
209   /**
210    * Used by a layout manager
211    */
212   offsetLarge,
213   /**
214    * Used by a layout manager
215    */
216   offsetMedium,
217   /**
218    * Used by a layout manager
219    */
220   offsetSmall,
221   /**
222    * Used by a layout manager
223    */
224   overwriteExtraLarge,
225   /**
226    * Used by a layout manager
227    */
228   overwriteExtraSmall,
229   /**
230    * Used by a layout manager
231    */
232   overwriteLarge,
233   /**
234    * Used by a layout manager
235    */
236   overwriteMarginExtraLarge,
237   /**
238    * Used by a layout manager
239    */
240   overwriteMarginExtraSmall,
241   /**
242    * Used by a layout manager
243    */
244   overwriteMarginLarge,
245   /**
246    * Used by a layout manager
247    */
248   overwriteMarginMedium,
249   /**
250    * Used by a layout manager
251    */
252   overwriteMarginSmall,
253   /**
254    * Used by a layout manager
255    */
256   overwriteMedium,
257   /**
258    * Used by a layout manager
259    */
260   overwriteSmall,
261   omit,
262   /** @deprecated */
263   @Deprecated
264   onclick,
265   /** @deprecated */
266   @Deprecated
267   onchange,
268   open,
269   orderBy,
270   orientation,
271   outcome,
272   overflowX,
273   overflowY,
274   /**
275    * Used by a layout manager
276    */
277   paddingBottom,
278   /**
279    * Used by a layout manager
280    */
281   paddingLeft,
282   /**
283    * Used by a layout manager
284    */
285   paddingRight,
286   /**
287    * Used by a layout manager
288    */
289   paddingTop,
290   pagingTarget,
291   password,
292   placeholder,
293   popupClose,
294   popupList,
295   popupReset,
296   popupCalendarId,
297   position,
298   preferredHeight,
299   preferredWidth,
300   preformated,
301   readonly,
302   reference,
303   relative,
304   rendered,
305   renderedIndex,
306   rendererType,
307   renderAs,
308   renderRange,
309   renderRangeExtern,
310   required,
311   resizable,
312   right,
313   @Deprecated
314   rigid,
315   rowId,
316   @Deprecated
317   row,
318   rowSpan,
319   rowSpacing,
320   rows,
321   sanitize,
322   scriptFiles,
323   scrollbarHeight,
324   scrollbars,
325   // Attribute name could not be the same as the method name
326   // this cause an infinite loop on attribute map
327   scrollPosition,
328   selectable,
329   selectedIndex,
330   selectedLabel,
331   selectedListString,
332   selector,
333   sheetAction,
334   showCheckbox,
335   showDirectLinks,
336   showDirectLinksArrows,
337   showHeader,
338   showJunctions,
339   showNavigationBar,
340   showPageRange,
341   showPageRangeArrows,
342   showPagingAlways,
343   showRoot,
344   showRootJunction,
345   showRowRange,
346   showSummary,
347   showDetail,
348   size,
349   sortable,
350   sortActionListener,
351   sortActionListenerExpression,
352   small,
353   spanX,
354   spanY,
355   src,
356   state,
357   stateChangeListener,
358   stateChangeListenerExpression,
359   statePreview,
360   style,
361   suggestMethod,
362   suggestMethodExpression,
363   switchType,
364   tabChangeListener,
365   tabChangeListenerExpression,
366   tabIndex,
367   target,
368   timeStyle,
369   textAlign,
370   timezone,
371   title,
372   tip,
373   top,
374   totalCount,
375   transition,
376   type,
377   value,
378   valueChangeListener,
379   var,
380   unit,
381   unselectedLabel,
382   update,
383   validator,
384   viewport,
385   width,
386   widthList,
387   zIndex;
388 
389   /** This constants are needed for annotations, because they can't use the enums. */
390   public static final String EXECUTE = "execute";
391 
392   private static final Logger LOG = LoggerFactory.getLogger(Attributes.class);
393 
394   private final String explicit;
395 
396   Attributes() {
397     this(null);
398   }
399 
400   Attributes(final String explicit) {
401     this.explicit = explicit;
402   }
403 
404   public String getName() {
405     if (explicit != null) {
406       return explicit;
407     } else {
408       return name();
409     }
410   }
411 
412   public static Attributes valueOfFailsafe(final String name) {
413     try {
414       return Attributes.valueOf(name);
415     } catch (final IllegalArgumentException e) {
416       LOG.warn("Can't find enum for {} with name '{}'", Attributes.class.getName(), name);
417       return null;
418     }
419   }
420 
421 }