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: SinkEventAttributes.java 733395 2009-01-10 23:09:40Z ltheussl $
51   * @since 1.1
52   */
53  public interface SinkEventAttributes
54      extends MutableAttributeSet
55  {
56      // base
57  
58      /**
59       * The class of the event element.
60       */
61      String CLASS = "class";
62  
63      /**
64       * A unique id for the event element.
65       */
66      String ID = "id";
67  
68      /**
69       * The language code for the event element.
70       */
71      String LANG = "lang";
72  
73      /**
74       * An inline style definition.
75       *
76       * <p>
77       *   Generally supported values are "italic", "bold", "monospaced" and AttributeSets.
78       * </p>
79       * <p>
80       *   If the value of this Attribute is itself an AttributeSet, it is interpreted as a
81       *   sequence of CSS properties. For instance, the HTML paragraph opening
82       * </p>
83       * <pre>
84       *   &lt;p style="color: red; margin-left: 20px"&gt;
85       * </pre>
86       * <p>
87       *   can be produced by an HTML Sink via the event
88       *   <code>{@link Sink#paragraph(SinkEventAttributes)}</code>, where the value of the
89       *   SinkEventAttribute is an AttributeSet with two Attributes ("<code>color</code>" and
90       *   "<code>margin-left</code>" with values "<code>red</code>" and "<code>20px</code>",
91       *   respectively).
92       * </p>
93       */
94      String STYLE = "style";
95  
96      /**
97       * A text to display in a tool tip.
98       */
99      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 }