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    bodyContent,
42    border,
43    /**
44     * Used by a layout manager
45     */
46    borderBottom,
47    /**
48     * Used by a layout manager
49     */
50    borderLeft,
51    /**
52     * Used by a layout manager
53     */
54    borderRight,
55    /**
56     * Used by a layout manager
57     */
58    borderTop,
59    bottom,
60    charset,
61    clientProperties,
62    closed,
63    collapsed,
64    collapsedMode,
65    column,
66    columnSpacing,
67    columns,
68    confirmation,
69    converter,
70    customClass,
71    createSpan,
72    css,
73    cssClassesBlocks,
74    dateStyle,
75    defaultCommand,
76    delay,
77    directLinkCount,
78    disabled,
79    display,
80    enctype,
81    escape,
82    expanded,
83    execute,
84    event,
85    extraSmall,
86    fieldId,
87    file,
88    filter,
89    first,
90    fixed,
91    frequency,
92    focus,
93    focusId,
94    formatPattern,
95    forValue("for"),
96    globalOnly,
97    height,
98    hidden,
99    hover,
100   i18n,
101   iconSize,
102   id,
103   immediate,
104   image,
105   inline,
106   itemDescription,
107   itemDisabled,
108   itemLabel,
109   itemImage,
110   itemValue,
111   justifyContent,
112   label,
113   labelLayout,
114   labelPosition,
115   labelWidth,
116   large,
117   layoutOrder,
118   left,
119   link,
120   /** @deprecated since Tobago 2.0.0 */
121   @Deprecated
122   margin,
123   /**
124    * Used by a layout manager
125    */
126   marginBottom,
127   /**
128    * Used by a layout manager
129    */
130   marginLeft,
131   /**
132    * Used by a layout manager
133    */
134   marginRight,
135   /**
136    * Used by a layout manager
137    */
138   marginTop,
139   marked,
140   markup,
141   max,
142   maxSeverity,
143   maxNumber,
144   maximumItems,
145   maximumHeight,
146   maximumWidth,
147   maxHeight,
148   maxWidth,
149   method,
150   min,
151   minHeight,
152   minWidth,
153   minSeverity,
154   minimumCharacters,
155   minimumHeight,
156   minimumWidth,
157   medium,
158   modal,
159   mode,
160   multiple,
161   mutable,
162   name,
163   navigate,
164   numberStyle,
165   /**
166    * Used by a layout manager
167    */
168   offsetExtraSmall,
169   /**
170    * Used by a layout manager
171    */
172   offsetLarge,
173   /**
174    * Used by a layout manager
175    */
176   offsetMedium,
177   /**
178    * Used by a layout manager
179    */
180   offsetSmall,
181   omit,
182   /** @deprecated */
183   @Deprecated
184   onclick,
185   /** @deprecated */
186   @Deprecated
187   onchange,
188   open,
189   orderBy,
190   orientation,
191   overflowX,
192   overflowY,
193   /**
194    * Used by a layout manager
195    */
196   paddingBottom,
197   /**
198    * Used by a layout manager
199    */
200   paddingLeft,
201   /**
202    * Used by a layout manager
203    */
204   paddingRight,
205   /**
206    * Used by a layout manager
207    */
208   paddingTop,
209   pagingTarget,
210   password,
211   placeholder,
212   popupClose,
213   popupList,
214   popupReset,
215   popupCalendarId,
216   position,
217   preferredHeight,
218   preferredWidth,
219   preformated,
220   readonly,
221   reference,
222   relative,
223   rendered,
224   renderedIndex,
225   rendererType,
226   renderAs,
227   renderRange,
228   renderRangeExtern,
229   required,
230   resizable,
231   right,
232   rigid,
233   rowId,
234   row,
235   rowSpacing,
236   rows,
237   sanitize,
238   scriptFiles,
239   scrollbarHeight,
240   scrollbars,
241   // Attribute name could not be the same as the method name
242   // this cause an infinite loop on attribute map
243   scrollPosition,
244   selectedIndex,
245   selectedLabel,
246   selectedListString,
247   selectable,
248   sheetAction,
249   showCheckbox,
250   showDirectLinks,
251   showDirectLinksArrows,
252   showHeader,
253   showJunctions,
254   showNavigationBar,
255   showPageRange,
256   showPageRangeArrows,
257   showPagingAlways,
258   showRoot,
259   showRootJunction,
260   showRowRange,
261   showSummary,
262   showDetail,
263   size,
264   sortable,
265   sortActionListener,
266   sortActionListenerExpression,
267   small,
268   spanX,
269   spanY,
270   src,
271   state,
272   stateChangeListener,
273   stateChangeListenerExpression,
274   statePreview,
275   style,
276   suggestMethod,
277   suggestMethodExpression,
278   switchType,
279   tabChangeListener,
280   tabChangeListenerExpression,
281   tabIndex,
282   target,
283   timeStyle,
284   textAlign,
285   timezone,
286   title,
287   tip,
288   top,
289   totalCount,
290   transition,
291   type,
292   value,
293   valueChangeListener,
294   var,
295   unit,
296   unselectedLabel,
297   update,
298   validator,
299   viewport,
300   width,
301   widthList,
302   zIndex;
303 
304   /** This constants are needed for annotations, because they can't use the enums. */
305   public static final String EXECUTE = "execute";
306 
307   private static final Logger LOG = LoggerFactory.getLogger(Attributes.class);
308 
309   private final String explicit;
310 
311   Attributes() {
312     this(null);
313   }
314 
315   Attributes(String explicit) {
316     this.explicit = explicit;
317   }
318 
319   public String getName() {
320     if (explicit != null) {
321       return explicit;
322     } else {
323       return name();
324     }
325   }
326 
327   public static Attributes valueOfFailsafe(String name) {
328     try {
329       return Attributes.valueOf(name);
330     } catch (IllegalArgumentException e) {
331       LOG.warn("Can't find enum for {} with name '{}'", Attributes.class.getName(), name);
332       return null;
333     }
334   }
335 
336 }