001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.maven.doxia.sink;
020
021import javax.swing.text.MutableAttributeSet;
022
023import java.util.Map;
024import java.util.Set;
025
026/**
027 * A set of attributes for a sink event.
028 * <p>
029 * All sink methods that produce some presentation-level output should have at least
030 * one form that allows to pass in a Set of SinkEventAttributes. For instance in
031 * </p>
032 * <pre>void text(String text, SinkEventAttributes attributes);</pre>
033 * <p>
034 * the <code>attributes</code> parameter can be used to specify some text styling
035 * options, or other optional parameters.
036 * </p>
037 * <p>
038 * What kind of attributes are supported depends on the event and the sink
039 * implementation. The sink API just specifies a list of suggested attribute
040 * names, that sinks are expected to recognize, and parsers are expected to use
041 * preferably when emitting events.
042 * </p>
043 * <p>
044 * It is recommended that for simple attributes, both keys and values should be
045 * lower-case Strings, but this is not mandatory. One example of an exception is
046 * the {@link #STYLE} attribute, whose value may itself be an AttributeSet again.
047 * </p>
048 * <p>
049 * The <b>base attributes</b> that are supported by almost all events are
050 * {@link #CLASS}, {@link #ID}, {@link #LANG}, {@link #STYLE} and {@link #TITLE}.
051 * </p>
052 *
053 * @author ltheussl
054 * @since 1.1
055 */
056@SuppressWarnings("checkstyle:interfaceistype")
057public interface SinkEventAttributes extends MutableAttributeSet {
058    // base
059
060    /**
061     * The class of the event element.
062     */
063    String CLASS = "class";
064
065    /**
066     * A unique id for the event element.
067     */
068    String ID = "id";
069
070    /**
071     * The language code for the event element.
072     */
073    String LANG = "lang";
074
075    /**
076     * An inline style definition.
077     *
078     * <p>
079     *   Generally supported values are "italic", "bold", "monospaced" and AttributeSets.
080     * </p>
081     * <p>
082     *   If the value of this Attribute is itself an AttributeSet, it is interpreted as a
083     *   sequence of CSS properties. For instance, the HTML paragraph opening
084     * </p>
085     * <pre>
086     *   &lt;p style="color: red; margin-left: 20px"&gt;
087     * </pre>
088     * <p>
089     *   can be produced by an HTML Sink via the event
090     *   <code>{@link Sink#paragraph(SinkEventAttributes)}</code>, where the value of the
091     *   SinkEventAttribute is an AttributeSet with two Attributes ("<code>color</code>" and
092     *   "<code>margin-left</code>" with values "<code>red</code>" and "<code>20px</code>",
093     *   respectively).
094     * </p>
095     */
096    String STYLE = "style";
097
098    /**
099     * A text to display in a tool tip.
100     */
101    String TITLE = "title";
102
103    // head
104
105    /**
106     * A space separated list of URL's that contains meta data information about the document.
107     */
108    String PROFILE = "profile";
109
110    /**
111     * An electronic mail address.
112     */
113    String EMAIL = "email";
114
115    /**
116     * The value of a meta element, used together with {@link #NAME}.
117     *
118     * @since 2.2.0
119     */
120    String CONTENT = "content";
121
122    // img
123
124    /**
125     * Specifies the alignment of the event element within its parent element.
126     *
127     * <p>
128     *   Generally supported values are "left", "right", "center", "justify".
129     * </p>
130     */
131    String ALIGN = "align";
132
133    /**
134     * Defines a short description of the event element.
135     */
136    String ALT = "alt";
137
138    /**
139     * Defines a border around an event element.
140     */
141    String BORDER = "border";
142
143    /**
144     * Defines the height of an event element.
145     */
146    String HEIGHT = "height";
147
148    /**
149     * Defines white space on the left and right side of an event element.
150     */
151    String HSPACE = "hspace";
152
153    /**
154     * Defines an image as a server-side image map. Only used by the figureGraphics Sink event.
155     */
156    String ISMAP = "ismap";
157
158    /**
159     * The URL of an external resource, eg an image.
160     */
161    String SRC = "src";
162
163    /**
164     * Defines an image as a client-side image map.
165     */
166    String USEMAP = "usemap";
167
168    /**
169     * Defines white space on the top and bottom of the event element.
170     */
171    String VSPACE = "vspace";
172
173    /**
174     * Sets the width of  an event element.
175     */
176    String WIDTH = "width";
177
178    // hr
179
180    /**
181     * Used to indicate that an element comes with a shadow.
182     */
183    String NOSHADE = "noshade";
184
185    /**
186     * Specifies the size, or thickness, or height of an event element.
187     */
188    String SIZE = "size";
189
190    // anchor
191
192    /**
193     * Specifies the name of an anchor.
194     */
195    String NAME = "name";
196
197    // link
198
199    /**
200     * Specifies the character encoding of text associated with an event element.
201     */
202    String CHARSET = "charset";
203
204    /**
205     * May be used in conjunction with {@link #SHAPE}.
206     *
207     * <p>
208     *   Valid values are the same as for the corresponding HTML attributes.
209     * </p>
210     */
211    String COORDS = "coords";
212
213    /**
214     * The target URL of an event element, eg a link.
215     */
216    String HREF = "href";
217
218    /**
219     * Specifies the base language of the target URL.
220     *
221     * <p>
222     *   Used in conjunction with {@link #HREF}.
223     * </p>
224     */
225    String HREFLANG = "hreflang";
226
227    /**
228     * For references to external resourcs, specifies the relationship between
229     * the current document and the target URL.
230     *
231     * <p>
232     *   Valid values are the same as for the corresponding HTML attribute.
233     * </p>
234     */
235    String REL = "rel";
236
237    /**
238     * For references to external resourcs, specifies the relationship between
239     * the target URL and the current document.
240     *
241     * <p>
242     *   Valid values are the same as for the corresponding HTML attribute.
243     * </p>
244     */
245    String REV = "rev";
246
247    /**
248     * Defines the type of region to be defined for a mapping.
249     *
250     * <p>
251     *   Used with the {@link #COORDS} attribute.
252     * </p>
253     */
254    String SHAPE = "shape";
255
256    /**
257     * Where to open the target URL.
258     *
259     * <p>
260     *   Valid values are the same as for the corresponding HTML attribute.
261     * </p>
262     */
263    String TARGET = "target";
264
265    /**
266     * Specifies the MIME (Multipurpose Internet Mail Extensions) type of an
267     * external resource URL, eg a link.
268     */
269    String TYPE = "type";
270
271    // table
272
273    /**
274     * Specifies the background color of an event element.
275     */
276    String BGCOLOR = "bgcolor";
277
278    /**
279     * Specifies the space between cell walls and contents.
280     */
281    String CELLPADDING = "cellpadding";
282
283    /**
284     * Specifies the space between cells.
285     */
286    String CELLSPACING = "cellspacing";
287
288    /**
289     * Specifies which sides of a border surrounding an element should be visible.
290     *
291     * <p>
292     *   Valid values are the same as for the corresponding HTML attribute.
293     * </p>
294     */
295    String FRAME = "frame";
296
297    /**
298     * Specifies horizontal/vertical divider lines between certain elements, eg table cells.
299     */
300    String RULES = "rules";
301
302    /**
303     * Specifies a summary of an event attribute for speech-synthesizing/non-visual target output.
304     */
305    String SUMMARY = "summary";
306
307    // table cell
308
309    /**
310     * Specifies an abbreviated version of the content in an element.
311     */
312    String ABBRV = "abbrv";
313
314    /**
315     * Defines a name for a cell.
316     */
317    String AXIS = "axis";
318
319    /**
320     * Indicates the number of columns a cell should span. Used in tables.
321     */
322    String COLSPAN = "colspan";
323
324    /**
325     * A space-separated list of cell IDs that supply header information for the cell.
326     */
327    String HEADERS = "headers";
328
329    /**
330     * Whether to disable or enable automatic text wrapping for an element.
331     */
332    String NOWRAP = "nowrap";
333
334    /**
335     * Indicates the number of rows a cell should span. Used in tables.
336     */
337    String ROWSPAN = "rowspan";
338
339    /**
340     * A general scope parameter. In Particular, for table cells this
341     * specifies if the cell provides header information for the rest of the
342     * row that contains it ("row"), or for the rest of the column ("col"),
343     * or for the rest of the row group that contains it ("rowgroup"),
344     * or for the rest of the column group that contains it ("colgroup").
345     */
346    String SCOPE = "scope";
347
348    /**
349     * Specifies the vertical alignment of an element.
350     *
351     * <p>
352     *   Generally accepted values are "top", "baseline", "middle", "bottom", "sup", "sub".
353     * </p>
354     */
355    String VALIGN = "valign";
356
357    // text
358
359    /**
360     * Specifies a decoration for an element.
361     *
362     * <p>
363     *   Generally accepted values are "underline", "overline", "line-through", "source".
364     * </p>
365     */
366    String DECORATION = "decoration";
367
368    /**
369     * Specifies the semantics of an element.
370     *
371     * <p>
372     *   Generally accepted values are "emphasis", "strong",
373     *   "small", "line-through", "citation", "quote", "definition", "abbreviation",
374     *   "italic", "bold", "monospaced", "code, "variable", "sample", "keyboard",
375     *   "superscript", "subscript", "annotation", "highlight", "ruby", "rubyBase",
376     *   "rubyText", "rubyTextContainer", "rubyParentheses", "bidirectionalIsolation",
377     *   "bidirectionalOverride", "phrase", "insert", "delete".
378     * </p>
379     */
380    String SEMANTICS = "semantics";
381
382    /**
383     * Specifies the semantics of an element.
384     *
385     * <p>
386     *   Generally accepted values are "article", "section",
387     *   "navigation", "sidebar".
388     * </p>
389     */
390    String SECTIONS = "sections";
391
392    /**
393     * Specifies a value for the data element.
394     */
395    String VALUE = "value";
396
397    /**
398     * Specifies a machine readable date/time for the time element.
399     */
400    String DATETIME = "datetime";
401
402    /**
403     * Returns a {@link Set} view of the attributes in form  of {@link Map.Entry} items.
404     * The set is backed by the underlying map, so changes to the map are
405     * reflected in the set, and vice-versa.  If the map is modified
406     * while an iteration over the set is in progress (except through
407     * the iterator's own {@code remove} operation, or through the
408     * {@code setValue} operation on a map entry returned by the
409     * iterator) the results of the iteration are undefined.  The set
410     * supports element removal, which removes the corresponding
411     * mapping from the map, via the {@code Iterator.remove},
412     * {@code Set.remove}, {@code removeAll}, {@code retainAll} and
413     * {@code clear} operations.  It does not support the
414     * {@code add} or {@code addAll} operations.
415     *
416     * @return a set view of the attributes
417     * @since 2.1.0
418     */
419    Set<Map.Entry<String, Object>> entrySet();
420}