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