View Javadoc
1   package org.apache.maven.doxia.sink;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import javax.swing.text.MutableAttributeSet;
23  
24  /**
25   * A set of attributes for a sink event.
26   * <p>
27   * All sink methods that produce some presentation-level output should have at least
28   * one form that allows to pass in a Set of SinkEventAttributes. For instance in
29   * <pre>void text( String text, SinkEventAttributes attributes );</pre>
30   * the <code>attributes</code> parameter can be used to specify some text styling
31   * options, or other optional parameters.
32   * </p>
33   * <p>
34   * What kind of attributes are supported depends on the event and the sink
35   * implementation. The sink API just specifies a list of suggested attribute
36   * names, that sinks are expected to recognize, and parsers are expected to use
37   * preferably when emitting events.
38   * </p>
39   * <p>
40   * It is recommended that for simple attributes, both keys and values should be
41   * lower-case Strings, but this is not mandatory. One example of an exception is
42   * the {@link #STYLE} attribute, whose value may itself be an AttributeSet again.
43   * </p>
44   * <p>
45   * The <b>base attributes</b> that are supported by almost all events are
46   * {@link #CLASS}, {@link #ID}, {@link #LANG}, {@link #STYLE} and {@link #TITLE}.
47   * </p>
48   *
49   * @author ltheussl
50   * @version $Id$
51   * @since 1.1
52   */
53  @SuppressWarnings( "checkstyle:interfaceistype" )
54  public interface SinkEventAttributes
55      extends MutableAttributeSet
56  {
57      // base
58  
59      /**
60       * The class of the event element.
61       */
62      String CLASS = "class";
63  
64      /**
65       * A unique id for the event element.
66       */
67      String ID = "id";
68  
69      /**
70       * The language code for the event element.
71       */
72      String LANG = "lang";
73  
74      /**
75       * An inline style definition.
76       *
77       * <p>
78       *   Generally supported values are "italic", "bold", "monospaced" and AttributeSets.
79       * </p>
80       * <p>
81       *   If the value of this Attribute is itself an AttributeSet, it is interpreted as a
82       *   sequence of CSS properties. For instance, the HTML paragraph opening
83       * </p>
84       * <pre>
85       *   &lt;p style="color: red; margin-left: 20px"&gt;
86       * </pre>
87       * <p>
88       *   can be produced by an HTML Sink via the event
89       *   <code>{@link Sink#paragraph(SinkEventAttributes)}</code>, where the value of the
90       *   SinkEventAttribute is an AttributeSet with two Attributes ("<code>color</code>" and
91       *   "<code>margin-left</code>" with values "<code>red</code>" and "<code>20px</code>",
92       *   respectively).
93       * </p>
94       */
95      String STYLE = "style";
96  
97      /**
98       * A text to display in a tool tip.
99       */
100     String TITLE = "title";
101 
102     // head
103 
104     /**
105      * A space separated list of URL's that contains meta data information about the document.
106      */
107     String PROFILE = "profile";
108 
109     /**
110      * An electronic mail address.
111      */
112     String EMAIL = "email";
113 
114 
115     // img
116 
117     /**
118      * Specifies the alignment of the event element within its parent element.
119      *
120      * <p>
121      *   Generally supported values are "left", "right", "center", "justify".
122      * </p>
123      */
124     String ALIGN = "align";
125 
126     /**
127      * Defines a short description of the event element.
128      */
129     String ALT = "alt";
130 
131     /**
132      * Defines a border around an event element.
133      */
134     String BORDER = "border";
135 
136     /**
137      * Defines the height of an event element.
138      */
139     String HEIGHT = "height";
140 
141     /**
142      * Defines white space on the left and right side of an event element.
143      */
144     String HSPACE = "hspace";
145 
146     /**
147      * Defines an image as a server-side image map. Only used by the figureGraphics Sink event.
148      */
149     String ISMAP = "ismap";
150 
151     /**
152      * The URL of an external resource, eg an image.
153      */
154     String SRC = "src";
155 
156     /**
157      * Defines an image as a client-side image map.
158      */
159     String USEMAP = "usemap";
160 
161     /**
162      * Defines white space on the top and bottom of the event element.
163      */
164     String VSPACE = "vspace";
165 
166     /**
167      * Sets the width of  an event element.
168      */
169     String WIDTH = "width";
170 
171     // hr
172 
173     /**
174      * Used to indicate that an element comes with a shadow.
175      */
176     String NOSHADE = "noshade";
177 
178     /**
179      * Specifies the size, or thickness, or height of an event element.
180      */
181     String SIZE = "size";
182 
183     // anchor
184 
185     /**
186      * Specifies the name of an anchor.
187      */
188     String NAME = "name";
189 
190     // link
191 
192     /**
193      * Specifies the character encoding of text associated with an event element.
194      */
195     String CHARSET = "charset";
196 
197     /**
198      * May be used in conjunction with {@link #SHAPE}.
199      *
200      * <p>
201      *   Valid values are the same as for the corresponding HTML attributes.
202      * </p>
203      */
204     String COORDS = "coords";
205 
206     /**
207      * The target URL of an event element, eg a link.
208      */
209     String HREF = "href";
210 
211     /**
212      * Specifies the base language of the target URL.
213      *
214      * <p>
215      *   Used in conjunction with {@link #HREF}.
216      * </p>
217      */
218     String HREFLANG = "hreflang";
219 
220     /**
221      * For references to external resourcs, specifies the relationship between
222      * the current document and the target URL.
223      *
224      * <p>
225      *   Valid values are the same as for the corresponding HTML attribute.
226      * </p>
227      */
228     String REL = "rel";
229 
230     /**
231      * For references to external resourcs, specifies the relationship between
232      * the target URL and the current document.
233      *
234      * <p>
235      *   Valid values are the same as for the corresponding HTML attribute.
236      * </p>
237      */
238     String REV = "rev";
239 
240     /**
241      * Defines the type of region to be defined for a mapping.
242      *
243      * <p>
244      *   Used with the {@link #COORDS} attribute.
245      * </p>
246      */
247     String SHAPE = "shape";
248 
249     /**
250      * Where to open the target URL.
251      *
252      * <p>
253      *   Valid values are the same as for the corresponding HTML attribute.
254      * </p>
255      */
256     String TARGET = "target";
257 
258     /**
259      * Specifies the MIME (Multipurpose Internet Mail Extensions) type of an
260      * external resource URL, eg a link.
261      */
262     String TYPE = "type";
263 
264     // table
265 
266     /**
267      * Specifies the background color of an event element.
268      */
269     String BGCOLOR = "bgcolor";
270 
271     /**
272      * Specifies the space between cell walls and contents.
273      */
274     String CELLPADDING = "cellpadding";
275 
276     /**
277      * Specifies the space between cells.
278      */
279     String CELLSPACING = "cellspacing";
280 
281     /**
282      * Specifies which sides of a border surrounding an element should be visible.
283      *
284      * <p>
285      *   Valid values are the same as for the corresponding HTML attribute.
286      * </p>
287      */
288     String FRAME = "frame";
289 
290     /**
291      * Specifies horizontal/vertical divider lines between certain elements, eg table cells.
292      */
293     String RULES = "rules";
294 
295     /**
296      * Specifies a summary of an event attribute for speech-synthesizing/non-visual target output.
297      */
298     String SUMMARY = "summary";
299 
300     // table cell
301 
302     /**
303      * Specifies an abbreviated version of the content in an element.
304      */
305     String ABBRV = "abbrv";
306 
307     /**
308      * Defines a name for a cell.
309      */
310     String AXIS = "axis";
311 
312     /**
313      * Indicates the number of columns a cell should span. Used in tables.
314      */
315     String COLSPAN = "colspan";
316 
317     /**
318      * A space-separated list of cell IDs that supply header information for the cell.
319      */
320     String HEADERS = "headers";
321 
322     /**
323      * Whether to disable or enable automatic text wrapping for an element.
324      */
325     String NOWRAP = "nowrap";
326 
327     /**
328      * Indicates the number of rows a cell should span. Used in tables.
329      */
330     String ROWSPAN = "rowspan";
331 
332     /**
333      * A general scope parameter. In Particular, for table cells this
334      * specifies if the cell provides header information for the rest of the
335      * row that contains it ("row"), or for the rest of the column ("col"),
336      * or for the rest of the row group that contains it ("rowgroup"),
337      * or for the rest of the column group that contains it ("colgroup").
338      */
339     String SCOPE = "scope";
340 
341     /**
342      * Specifies the vertical alignment of an element.
343      *
344      * <p>
345      *   Generally accepted values are "top", "baseline", "middle", "bottom", "sup", "sub".
346      * </p>
347      */
348     String VALIGN = "valign";
349 
350     // text
351 
352     /**
353      * Specifies a decoration for an element.
354      *
355      * <p>
356      *   Generally accepted values are "underline", "overline", "line-through", "boxed".
357      * </p>
358      */
359     String DECORATION = "decoration";
360 }