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 package org.apache.maven.doxia.sink;
20
21 import javax.swing.text.MutableAttributeSet;
22
23 /**
24 * A set of attributes for a sink event.
25 * <p>
26 * All sink methods that produce some presentation-level output should have at least
27 * one form that allows to pass in a Set of SinkEventAttributes. For instance in
28 * </p>
29 * <pre>void text(String text, SinkEventAttributes attributes);</pre>
30 * <p>
31 * the <code>attributes</code> parameter can be used to specify some text styling
32 * options, or other optional parameters.
33 * </p>
34 * <p>
35 * What kind of attributes are supported depends on the event and the sink
36 * implementation. The sink API just specifies a list of suggested attribute
37 * names, that sinks are expected to recognize, and parsers are expected to use
38 * preferably when emitting events.
39 * </p>
40 * <p>
41 * It is recommended that for simple attributes, both keys and values should be
42 * lower-case Strings, but this is not mandatory. One example of an exception is
43 * the {@link #STYLE} attribute, whose value may itself be an AttributeSet again.
44 * </p>
45 * <p>
46 * The <b>base attributes</b> that are supported by almost all events are
47 * {@link #CLASS}, {@link #ID}, {@link #LANG}, {@link #STYLE} and {@link #TITLE}.
48 * </p>
49 *
50 * @author ltheussl
51 * @since 1.1
52 */
53 @SuppressWarnings("checkstyle:interfaceistype")
54 public interface SinkEventAttributes extends MutableAttributeSet {
55 // base
56
57 /**
58 * The class of the event element.
59 */
60 String CLASS = "class";
61
62 /**
63 * A unique id for the event element.
64 */
65 String ID = "id";
66
67 /**
68 * The language code for the event element.
69 */
70 String LANG = "lang";
71
72 /**
73 * An inline style definition.
74 *
75 * <p>
76 * Generally supported values are "italic", "bold", "monospaced" and AttributeSets.
77 * </p>
78 * <p>
79 * If the value of this Attribute is itself an AttributeSet, it is interpreted as a
80 * sequence of CSS properties. For instance, the HTML paragraph opening
81 * </p>
82 * <pre>
83 * <p style="color: red; margin-left: 20px">
84 * </pre>
85 * <p>
86 * can be produced by an HTML Sink via the event
87 * <code>{@link Sink#paragraph(SinkEventAttributes)}</code>, where the value of the
88 * SinkEventAttribute is an AttributeSet with two Attributes ("<code>color</code>" and
89 * "<code>margin-left</code>" with values "<code>red</code>" and "<code>20px</code>",
90 * respectively).
91 * </p>
92 */
93 String STYLE = "style";
94
95 /**
96 * A text to display in a tool tip.
97 */
98 String TITLE = "title";
99
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 }