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