Methods Summary |
---|
public java.lang.String | anchor(java.lang.String anchor, java.lang.String displayText)Start anchor
String anchorDeclaration = style ("Anchor");
Properties macros = new Properties ();
macros.put ("name", normalizeAnchor (anchor));
macros.put ("text", displayText);
anchorDeclaration = Formatter.substituteMacros (anchorDeclaration, macros);
return anchorDeclaration;
|
public java.lang.String | body()Body start
return style ("Body");
|
public java.lang.String | bodyEnd()Body end
return styleEnd ("Body");
|
public java.lang.String | bold()Start bold
return style ("Bold");
|
public java.lang.String | boldEnd()End bold
return styleEnd ("Bold");
|
public java.lang.String | br()Line separator
return style ("new_line");
|
public java.lang.String | definitionList()Start definition list
myDeflistIndent++;
return style ("DefinitionList");
|
public java.lang.String | definitionListDefinition()Start Definition list Definition
String indent = resource ("DefinitionListDefinition.indent");
int numIndent;
if (indent != null)
numIndent = Integer.parseInt (indent, 10);
else
numIndent = 1;
String text = style ("DefinitionListDefinition");
Properties macros = new Properties ();
macros.put ("indent", Integer.toString (numIndent * myDeflistIndent));
text = Formatter.substituteMacros (text, macros);
return text;
|
public java.lang.String | definitionListDefinitionEnd()End Definition list Definition
return styleEnd ("DefinitionListDefinition");
|
public java.lang.String | definitionListEnd()End definition list
myDeflistIndent--;
return styleEnd ("DefinitionList");
|
public java.lang.String | definitionListTerm(java.lang.String text)Definition list term
String listItemDeclaration;
String rightResource = resource ("DefinitionListTerm"+"."+ Integer.toString (myDeflistIndent));
if (rightResource != null)
listItemDeclaration = rightResource;
else
listItemDeclaration = style ("DefinitionListTerm");
listItemDeclaration = Formatter.replaceTags (listItemDeclaration, "text", text);
return listItemDeclaration;
|
public java.lang.String | document()Returns string, which should starts a new document (, for instance, for HTML document)
String documentHeader = new String (style ("Document"));
// Collect a font declarations, which should be written into header
String fontDeclarationTable = new String ();
String fontReference = resource ("Font.reference");
if (fontReference != null) {
int i = 1;
String fontName;
do {
String resourceName = new String ("Font."+Integer.toString (i));
fontName = resource (resourceName);
if (fontName != null) {
String fontDeclaration = resource (resourceName + ".declaration");
if (fontDeclaration != null) {
Properties props = new Properties ();
props.put ("number", Integer.toString (i));
props.put ("name", fontName);
fontDeclaration = Formatter.substituteMacros (fontDeclaration, props);
fontDeclarationTable += fontDeclaration;
// Put the font with reference into internal vector
String theFontReference = new String (fontReference);
theFontReference = Formatter.substituteMacros (theFontReference, props);
myFonts.put (fontName, theFontReference);
}
}
++i;
} while (fontName != null);
}
Properties fontsAndStyles = new Properties ();
fontsAndStyles.put ("fontDeclarations", fontDeclarationTable);
documentHeader = Formatter.substituteMacros (documentHeader, fontsAndStyles);
return documentHeader;
|
public java.lang.String | documentEnd()Returns string, which should finish a document
return styleEnd ("Document");
|
public java.lang.String | font(int size)Selects a font size
String fontDeclaration = style ("FontSize");
fontDeclaration = Formatter.replaceTags (fontDeclaration, "size", Integer.toString (size));
return fontDeclaration;
|
public java.lang.String | fontClass(java.lang.String name)Selects a font class
String fontReference = (String)myFonts.get (name);
if (fontReference == null) {
String fontDeclaration = style ("FontClass");
fontDeclaration = Formatter.replaceTags (fontDeclaration, "fontName", name);
return fontDeclaration;
}
return fontReference;
|
public java.lang.String | fontColor(java.lang.String color)Selects a font color
String fontDeclaration = style ("FontColor");
fontDeclaration = Formatter.replaceTags (fontDeclaration, "color", color);
return fontDeclaration;
|
public java.lang.String | fontEnd()End font selection
return styleEnd ("Font");
|
public java.lang.String | fontSizeClass(int size, java.lang.String name)Selects a font class and size
String fontDeclaration = style ("FontSizeClass");
fontDeclaration = Formatter.replaceTags (fontDeclaration, "size", Integer.toString (size));
fontDeclaration = Formatter.replaceTags (fontDeclaration, "fontName", name);
return fontDeclaration;
|
public java.lang.String | hr()Returns a section separator
return style ("new_section");
|
public java.lang.String | href(java.lang.String name)Start href
String hrefDeclaration = style ("Href");
hrefDeclaration = Formatter.replaceTags (hrefDeclaration, "name", processBackSlashes (name));
return hrefDeclaration;
|
public java.lang.String | hrefEnd()End href
return styleEnd ("Href");
|
public java.lang.String | hrefWithIndex(java.lang.String name, java.lang.String index)Start href with index
String hrefDeclaration = style ("HrefIndex");
Properties macros = new Properties ();
macros.put ("name", processBackSlashes (name));
// For bookmark not all characters are acceptable, replace them by the same way as create anchor
macros.put ("index", normalizeAnchor (index));
hrefDeclaration = Formatter.substituteMacros (hrefDeclaration, macros);
return hrefDeclaration;
|
public java.lang.String | italic()Start italic
return style ("Italic");
|
public java.lang.String | italicEnd()End italic
return styleEnd ("Italic");
|
public java.lang.String | list()Start list
myListIndent++;
String listDeclaration;
String rightResource = resource ("List"+"."+ Integer.toString (myDeflistIndent));
if (rightResource != null)
listDeclaration = rightResource;
else
listDeclaration = style ("List");
return listDeclaration;
|
public java.lang.String | list(java.lang.String style)Start list with bullet type
String listDeclaration = style ("ListType");
listDeclaration = Formatter.replaceTags (listDeclaration, "style", style);
return listDeclaration;
|
public java.lang.String | listEnd()End list
myListIndent--;
return styleEnd ("List");
|
public java.lang.String | listItem(java.lang.String itemText)List item
String indent = resource ("ListItem.indent");
int numIndent;
if (indent != null)
numIndent = Integer.parseInt (indent, 10);
else
numIndent = 1;
String text = style ("ListItem");
Properties macros = new Properties ();
macros.put ("indent", Integer.toString (numIndent * myDeflistIndent));
macros.put ("text", itemText);
text = Formatter.substituteMacros (text, macros);
return text;
|
public java.lang.String | nestedDocument(java.lang.String documentFileName)Nested document
String nestedDocumentDeclaration = style ("NestedDocument");
String goodFileName = processBackSlashes (documentFileName);
nestedDocumentDeclaration = Formatter.replaceTags (nestedDocumentDeclaration, "fileName", goodFileName);
return nestedDocumentDeclaration;
|
private java.lang.String | normalizeAnchor(java.lang.String source)Create unique anchor string for the source string
If the anchor already in table, return previous index,
otherwise create new one
String anchor = (String)myAnchors.get (source);
if (anchor == null) {
myLastAnchorIndex++;
anchor = myANCHOR_PREFIX + Integer.toString (myLastAnchorIndex);
myAnchors.put (source, anchor);
}
return anchor;
|
public java.lang.String | page()Returns a page
return style ("new_page");
|
public java.lang.String | par()Returns a paragraph separator
return style ("par");
|
public java.lang.String | parEnd()Returns a paragraph separator end
return styleEnd ("par");
|
public java.lang.String | picture(java.lang.String fileName)Picture
String pictureDeclaration = style ("Picture");
String goodFileName = processBackSlashes (fileName);
pictureDeclaration = Formatter.replaceTags (pictureDeclaration, "fileName", goodFileName);
return pictureDeclaration;
|
public java.lang.String | pictureWithAlternativeText(java.lang.String fileName, java.lang.String message)Picture with alternative text
String pictureDeclaration = style ("PictureAltText");
Properties macros = new Properties ();
String goodFileName = processBackSlashes (fileName);
macros.put ("fileName", goodFileName);
macros.put ("message", message);
pictureDeclaration = Formatter.substituteMacros (pictureDeclaration, macros);
return pictureDeclaration;
|
public java.lang.String | pre()Starts of preformatted code
return style ("preformatted");
|
public java.lang.String | preEnd()Finishs of preformatted code
return styleEnd ("preformatted");
|
private java.lang.String | processBackSlashes(java.lang.String source)Reverses all backslashes to right one to make file names compatible with all documentation format
String result = new String (source);
result = Formatter.replace (result, "\\", "/");
return result;
|
private java.lang.String | propertyKey(java.lang.String text)Convert all blanks of text to underscores, because property keys do not support spaces
return Formatter.replace (text, " ", "_");
|
public java.lang.String | resource(java.lang.String resourceName)Private method to access internal properties (unavailable from the script)
Also it may be used to check resource availability
String value;
try {
value = myBundle.getString (propertyKey (resourceName));
}
catch (MissingResourceException e) {
return null;
}
return value;
|
public java.lang.String | strikeout()Start strikeout
return style ("Strikeout");
|
public java.lang.String | strikeoutEnd()End strikeout
return styleEnd ("Strikeout");
|
public java.lang.String | style(java.lang.String styleName)General method to access style beginning
String stBegin = styleName + mySTARTMARK;
String value;
try {
value = myBundle.getString (propertyKey (stBegin));
}
catch (MissingResourceException e) {
value = new String (mySTYLE_NOT_DEFINED_MSG + styleName);
}
return value;
|
public java.lang.String | styleEnd(java.lang.String styleName)General method to access style end
String stEnd = styleName + myENDMARK;
String value;
try {
value = myBundle.getString (propertyKey (stEnd));
}
catch (MissingResourceException e) {
value = new String (mySTYLE_NOT_DEFINED_MSG + stEnd);
}
return value;
|
public java.lang.String | subscript()Start subscript
return style ("Subscript");
|
public java.lang.String | subscriptEnd()End subscript
return styleEnd ("Subscript");
|
public java.lang.String | superscript()Start superscript
return style ("Superscript");
|
public java.lang.String | superscriptEnd()End superscript
return styleEnd ("Superscript");
|
public java.lang.String | title()Title start
return style ("Title");
|
public java.lang.String | titleEnd()Title end
return styleEnd ("Title");
|
public java.lang.String | underline()Start Underline
return style ("Underline");
|
public java.lang.String | underlineEnd()End Underline
return styleEnd ("Underline");
|