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 023import java.util.Map; 024import java.util.Set; 025 026/** 027 * A set of attributes for a sink event. 028 * <p> 029 * All sink methods that produce some presentation-level output should have at least 030 * one form that allows to pass in a Set of SinkEventAttributes. For instance in 031 * </p> 032 * <pre>void text(String text, SinkEventAttributes attributes);</pre> 033 * <p> 034 * the <code>attributes</code> parameter can be used to specify some text styling 035 * options, or other optional parameters. 036 * </p> 037 * <p> 038 * What kind of attributes are supported depends on the event and the sink 039 * implementation. The sink API just specifies a list of suggested attribute 040 * names, that sinks are expected to recognize, and parsers are expected to use 041 * preferably when emitting events. 042 * </p> 043 * <p> 044 * It is recommended that for simple attributes, both keys and values should be 045 * lower-case Strings, but this is not mandatory. One example of an exception is 046 * the {@link #STYLE} attribute, whose value may itself be an AttributeSet again. 047 * </p> 048 * <p> 049 * The <b>base attributes</b> that are supported by almost all events are 050 * {@link #CLASS}, {@link #ID}, {@link #LANG}, {@link #STYLE} and {@link #TITLE}. 051 * </p> 052 * 053 * @author ltheussl 054 * @since 1.1 055 */ 056@SuppressWarnings("checkstyle:interfaceistype") 057public interface SinkEventAttributes extends MutableAttributeSet { 058 // base 059 060 /** 061 * The class of the event element. 062 */ 063 String CLASS = "class"; 064 065 /** 066 * A unique id for the event element. 067 */ 068 String ID = "id"; 069 070 /** 071 * The language code for the event element. 072 */ 073 String LANG = "lang"; 074 075 /** 076 * An inline style definition. 077 * 078 * <p> 079 * Generally supported values are "italic", "bold", "monospaced" and AttributeSets. 080 * </p> 081 * <p> 082 * If the value of this Attribute is itself an AttributeSet, it is interpreted as a 083 * sequence of CSS properties. For instance, the HTML paragraph opening 084 * </p> 085 * <pre> 086 * <p style="color: red; margin-left: 20px"> 087 * </pre> 088 * <p> 089 * can be produced by an HTML Sink via the event 090 * <code>{@link Sink#paragraph(SinkEventAttributes)}</code>, where the value of the 091 * SinkEventAttribute is an AttributeSet with two Attributes ("<code>color</code>" and 092 * "<code>margin-left</code>" with values "<code>red</code>" and "<code>20px</code>", 093 * respectively). 094 * </p> 095 */ 096 String STYLE = "style"; 097 098 /** 099 * A text to display in a tool tip. 100 */ 101 String TITLE = "title"; 102 103 // head 104 105 /** 106 * A space separated list of URL's that contains meta data information about the document. 107 */ 108 String PROFILE = "profile"; 109 110 /** 111 * An electronic mail address. 112 */ 113 String EMAIL = "email"; 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", "source". 357 * </p> 358 */ 359 String DECORATION = "decoration"; 360 361 /** 362 * Specifies the semantics of an element. 363 * 364 * <p> 365 * Generally accepted values are "emphasis", "strong", 366 * "small", "line-through", "citation", "quote", "definition", "abbreviation", 367 * "italic", "bold", "monospaced", "code, "variable", "sample", "keyboard", 368 * "superscript", "subscript", "annotation", "highlight", "ruby", "rubyBase", 369 * "rubyText", "rubyTextContainer", "rubyParentheses", "bidirectionalIsolation", 370 * "bidirectionalOverride", "phrase", "insert", "delete". 371 * </p> 372 */ 373 String SEMANTICS = "semantics"; 374 375 /** 376 * Specifies the semantics of an element. 377 * 378 * <p> 379 * Generally accepted values are "article", "section", 380 * "navigation", "sidebar". 381 * </p> 382 */ 383 String SECTIONS = "sections"; 384 385 /** 386 * Specifies a value for the data element. 387 */ 388 String VALUE = "value"; 389 390 /** 391 * Specifies a machine readable date/time for the time element. 392 */ 393 String DATETIME = "datetime"; 394 395 /** 396 * Returns a {@link Set} view of the attributes in form of {@link Map.Entry} items. 397 * The set is backed by the underlying map, so changes to the map are 398 * reflected in the set, and vice-versa. If the map is modified 399 * while an iteration over the set is in progress (except through 400 * the iterator's own {@code remove} operation, or through the 401 * {@code setValue} operation on a map entry returned by the 402 * iterator) the results of the iteration are undefined. The set 403 * supports element removal, which removes the corresponding 404 * mapping from the map, via the {@code Iterator.remove}, 405 * {@code Set.remove}, {@code removeAll}, {@code retainAll} and 406 * {@code clear} operations. It does not support the 407 * {@code add} or {@code addAll} operations. 408 * 409 * @return a set view of the attributes 410 * @since 2.1.0 411 */ 412 Set<Map.Entry<String, Object>> entrySet(); 413}