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