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