Package org.apache.maven.doxia.sink.impl
Class SinkUtils
- java.lang.Object
-
- org.apache.maven.doxia.sink.impl.SinkUtils
-
public class SinkUtils extends java.lang.ObjectCollection of common utility methods for sinks.- Since:
- 1.1
- Author:
- ltheussl
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]SINK_BASE_ATTRIBUTESThe set of base attributes.static java.lang.String[]SINK_BR_ATTRIBUTESThe attributes that are supported for the br tag.static java.lang.String[]SINK_HR_ATTRIBUTESThe attributes that are supported for the <hr> tag.static java.lang.String[]SINK_IMG_ATTRIBUTESThe attributes that are supported for the <img> tag.static java.lang.String[]SINK_LINK_ATTRIBUTESThe attributes that are supported for the <a> tag.static java.lang.String[]SINK_SECTION_ATTRIBUTESThe attributes that are supported for the section tags, like <p>, <h2>, <div>.static java.lang.String[]SINK_TABLE_ATTRIBUTESThe attributes that are supported for the <table> tag.static java.lang.String[]SINK_TD_ATTRIBUTESThe attributes that are supported for the <td> and <th> tags.static java.lang.String[]SINK_TR_ATTRIBUTESThe attributes that are supported for the <tr> tag.static java.lang.String[]SINK_VERBATIM_ATTRIBUTESThe attributes that are supported for the <div> and <pre> tags.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringasCssDeclaration(java.lang.String property, java.lang.String value)static java.lang.StringasCssString(javax.swing.text.AttributeSet att)static org.apache.maven.doxia.sink.SinkEventAttributesfilterAttributes(javax.swing.text.AttributeSet attributes, java.lang.String[] valids)Filters the given AttributeSet.static java.lang.StringgetAttributeString(javax.swing.text.AttributeSet att)Utility method to get an AttributeSet as a String.
-
-
-
Field Detail
-
SINK_BASE_ATTRIBUTES
public static final java.lang.String[] SINK_BASE_ATTRIBUTES
The set of base attributes.
-
SINK_BR_ATTRIBUTES
public static final java.lang.String[] SINK_BR_ATTRIBUTES
The attributes that are supported for the br tag.
-
SINK_IMG_ATTRIBUTES
public static final java.lang.String[] SINK_IMG_ATTRIBUTES
The attributes that are supported for the <img> tag.
-
SINK_SECTION_ATTRIBUTES
public static final java.lang.String[] SINK_SECTION_ATTRIBUTES
The attributes that are supported for the section tags, like <p>, <h2>, <div>.
-
SINK_VERBATIM_ATTRIBUTES
public static final java.lang.String[] SINK_VERBATIM_ATTRIBUTES
The attributes that are supported for the <div> and <pre> tags.
-
SINK_HR_ATTRIBUTES
public static final java.lang.String[] SINK_HR_ATTRIBUTES
The attributes that are supported for the <hr> tag.
-
SINK_LINK_ATTRIBUTES
public static final java.lang.String[] SINK_LINK_ATTRIBUTES
The attributes that are supported for the <a> tag.
-
SINK_TABLE_ATTRIBUTES
public static final java.lang.String[] SINK_TABLE_ATTRIBUTES
The attributes that are supported for the <table> tag.
-
SINK_TD_ATTRIBUTES
public static final java.lang.String[] SINK_TD_ATTRIBUTES
The attributes that are supported for the <td> and <th> tags.
-
SINK_TR_ATTRIBUTES
public static final java.lang.String[] SINK_TR_ATTRIBUTES
The attributes that are supported for the <tr> tag.
-
-
Method Detail
-
getAttributeString
public static java.lang.String getAttributeString(javax.swing.text.AttributeSet att)
Utility method to get an AttributeSet as a String. The resulting String is in the form ' name1="value1" name2="value2" ...', ie it can be appended directly to an xml start tag. Attribute values that are itself AttributeSets are ignored unless the Attribute name is SinkEventAttributeSet.STYLE, in which case they are written as outlined atSinkEventAttributes.STYLE. All other keys and values are written as Strings.- Parameters:
att- The AttributeSet. May be null, in which case an empty String is returned.- Returns:
- the AttributeSet as a String in a form that can be appended to an xml start tag.
-
asCssString
public static java.lang.String asCssString(javax.swing.text.AttributeSet att)
-
asCssDeclaration
public static java.lang.String asCssDeclaration(java.lang.String property, java.lang.String value)
-
filterAttributes
public static org.apache.maven.doxia.sink.SinkEventAttributes filterAttributes(javax.swing.text.AttributeSet attributes, java.lang.String[] valids)Filters the given AttributeSet. Removes all attributes whose name (key) is not contained in the sorted array valids.- Parameters:
attributes- The AttributeSet to filter. The String values of Attribute names are compared to the elements of the valids array.valids- a sorted array of attribute names that are to be kept in the resulting AttributeSet. Note: a binary search is employed, so the array has to be sorted for correct results.- Returns:
- A filtered
SinkEventAttributesobject. Returns null if the input AttributeSet is null. If the array of valids is either null or empty, an empty AttributeSet is returned.
-
-