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