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