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.renderkit.html;
21  
22  /**
23   * Custom data attributes.
24   * These attributes may transport data to DOM which are not standardized.
25   * The format is "data-tobago-*" which is conform to HTML 5, but also works in older browsers.
26   */
27  public enum DataAttributes implements MarkupLanguageAttributes {
28  
29    /**
30     * Ajax behaviors execute and render attributes for TabGroup and Sheet reload
31     * @deprecated since 3.0.0, please use COMMANDS
32     */
33    @Deprecated
34    BEHAVIOR_COMMANDS("data-tobago-behavior-commands"),
35  
36    /**
37     * Contains the closed tree icon or style.
38     */
39    CLOSED("data-tobago-closed"),
40  
41    /**
42     * The index of the column of a sheet. This index means the position of the rendered column. It can differ, if there
43     * are tc:column with rendered=false.
44     */
45    COLUMN_INDEX("data-tobago-column-index"),
46  
47    /**
48     * Custom command attribute. Is used to mark different client side JavaScript buttons.
49     * Should only contain the command name as a keyword, for security reasons.
50     */
51    COMMAND("data-tobago-command"),
52  
53    /**
54     * The list of commands attached to an element.
55     */
56    COMMANDS("data-tobago-commands"),
57  
58    CONTENT("data-content"),
59  
60    /**
61     * The context path of the application, may be needed in the Client.
62     */
63    CONTEXT_PATH("data-tobago-context-path"),
64  
65    DATE_TIME_I18N("data-tobago-date-time-i18n"),
66  
67    /**
68     * Holds the day of a calendar control.
69     */
70    DAY("data-tobago-day"),
71  
72    /**
73     * Custom disabled attribute. Use for element, that don't have the disabled attribute.
74     */
75    DISABLED("data-tobago-disabled"),
76  
77    DISMISS("data-dismiss"),
78  
79    /**
80     * Custom form attribute. Used to show the virtual form of the component.
81     */
82    DEFAULT("data-tobago-default"),
83  
84    DELAY("data-tobago-delay"),
85  
86    FOR("data-tobago-for"),
87  
88    /**
89     * Holds the id of the first row in a sheet.
90     */
91    FIRST("data-tobago-first"),
92  
93    /**
94     * Holds the first day of a week of a calendar control.
95     */
96    FIRST_DAY_OF_WEEK("data-tobago-first-day-of-week"),
97  
98    /**
99     * Defines a maximum value.
100    */
101   LAYOUT("data-tobago-layout"),
102 
103   /**
104    * Defines the depth level of a tree node.
105    */
106   LEVEL("data-tobago-level"),
107 
108   /**
109    * Defines the markup of the component.
110    */
111   MARKUP("data-tobago-markup"),
112 
113   /**
114    * Defines a maximum value.
115    */
116   MAX("data-tobago-max"),
117 
118   /**
119    * Holds the month of a calendar control.
120    */
121   MONTH("data-tobago-month"),
122 
123   /**
124    * Holds the names of the months of a calendar control.
125    */
126   MONTH_NAMES("data-tobago-month-names"),
127 
128   /**
129    * Contains the open tree icon or style.
130    */
131   OPEN("data-tobago-open"),
132 
133   PARTIAL_IDS("data-tobago-partial-ids"),
134 
135   PARTIAL_ACTION("data-tobago-partial-action"),
136 
137   /**
138    * Custom attribute to describe a pattern, e. g. for an date input field.
139    */
140   PATTERN("data-tobago-pattern"),
141 
142   /**
143    * Custom reload attribute. Used to reload a panel.
144    */
145   RELOAD("data-tobago-reload"),
146 
147   ROW_ACTION("data-tobago-row-action"),
148 
149   /*
150    * Holds the index of the row in a sheet, if the sheed has a rowRendered attribute.
151    */
152   ROW_INDEX("data-tobago-row-index"),
153 
154   SELECTION_MODE("data-tobago-selection-mode"),
155 
156   /**
157    * The selectable attribute e. g. for trees.
158    */
159   SELECTABLE("data-tobago-selectable"),
160 
161   /**
162    * Reference to a sheet.
163    */
164   SHEET_ID("data-tobago-sheet-id"),
165 
166   /**
167    * A way to transport style data in JSON format to the browser. With CSP the normal style attribute isn't allowed.
168    * @deprecated since 4.0.0. UIStyle now renders itself.
169    */
170   @Deprecated
171   STYLE("data-tobago-style"),
172 
173   SCROLL_PANEL("data-tobago-scroll-panel"),
174 
175   SCROLL_POSITION("data-tobago-scroll-position"),
176 
177   SUGGEST_DATA("data-tobago-suggest-data"),
178 
179   SUGGEST_DELAY("data-tobago-suggest-delay"),
180 
181   SUGGEST_FOR("data-tobago-suggest-for"),
182 
183   SUGGEST_MAX_ITEMS("data-tobago-suggest-max-items"),
184 
185   SUGGEST_MIN_CHARS("data-tobago-suggest-min-chars"),
186 
187   SUGGEST_TOTAL_COUNT("data-tobago-suggest-total-count"),
188 
189   SUGGEST_UPDATE("data-tobago-suggest-update"),
190 
191   TARGET("data-target"),
192 
193   TITLE("data-title"),
194 
195   TO_PAGE("data-tobago-to-page"),
196 
197   TODAY("data-tobago-today"),
198 
199   TOGGLE("data-toggle"),
200 
201   TRANSITION("data-tobago-transition"),
202 
203   /**
204    * Id of the parent node in a tree node.
205    */
206   TREE_PARENT("data-tobago-tree-parent"),
207 
208   /**
209    * Defines the unit, e. g. to differ between hours, minutes and seconds in a time control.
210    */
211   UNIT("data-tobago-unit"),
212 
213   /**
214    * Holds the value (for tags, that don't have a value in HTML).
215    */
216   VALUE("data-tobago-value"),
217 
218   /**
219    * Holds the year of a calendar control.
220    */
221   YEAR("data-tobago-year");
222 
223   private final String value;
224 
225   DataAttributes(final String value) {
226     this.value = value;
227   }
228 
229   @Override
230   public String getValue() {
231     return value;
232   }
233 
234   public static MarkupLanguageAttributes dynamic(final String withoutPrefix) {
235     return new MarkupLanguageAttributes() {
236       @Override
237       public String getValue() {
238         return "data-" + withoutPrefix;
239       }
240     };
241   }
242 
243 }