| com.nwalsh.saxon.CopyEmitter com.nwalsh.saxon.CalloutEmitter
CalloutEmitter | public class CalloutEmitter extends CopyEmitter (Code) | | Saxon extension to decorate a result tree fragment with callouts.
$Id: CalloutEmitter.java,v 1.4 2005-08-30 08:14:58 draganr Exp $
Copyright (C) 2000 Norman Walsh.
This class provides the guts of a
Saxon 6.*
implementation of callouts for verbatim environments. (It is used
by the Verbatim class.)
The general design is this: the stylesheets construct a result tree
fragment for some verbatim environment. The Verbatim class initializes
a CalloutEmitter with information about the callouts that should be applied
to the verbatim environment in question. Then the result tree fragment
is "replayed" through the CalloutEmitter; the CalloutEmitter builds a
new result tree fragment from this event stream, decorated with callouts,
and that is returned.
Change Log:
- 1.0
Initial release.
See Also: Verbatim author: Norman Walsh author: ndw@nwalsh.com version: $Id: CalloutEmitter.java,v 1.4 2005-08-30 08:14:58 draganr Exp $ |
Constructor Summary | |
public | CalloutEmitter(Controller controller, NamePool namePool, int defaultColumn, boolean foStylesheet, FormatCallout fCallout) |
Method Summary | |
protected void | addCallout(int coNum, Node node, int defaultColumn) Add a callout to the global callout array
This method examines a callout area and adds it to
the global callout array if it can be interpreted.
Only the linecolumn and linerange units are
supported. | public void | characters(char[] chars, int start, int len) Process characters. | public void | endElement(int nameCode) Process end element events. | protected void | formatPad(int numBlanks) Add blanks to the result tree fragment.
This method adds numBlanks to the result tree fragment. | public void | setupCallouts(NodeList areaspecNodeList) | protected boolean | skipThisElement(int nameCode) Protect the outer-most block wrapper.
Open elements in the result tree fragment are closed and reopened
around callouts (so that callouts don't appear inside links or other
environments). | public void | startElement(int nameCode, org.xml.sax.Attributes attributes, int[] namespaces, int nscount) Process start element events. |
defaultColumn | protected int defaultColumn(Code) | | The default column for callouts that specify only a line.
|
elementStack | protected Stack elementStack(Code) | | A stack for the preserving information about open elements.
|
firstElement | protected boolean firstElement(Code) | | Is the next element absolutely the first element in the fragment?
|
foStylesheet | protected boolean foStylesheet(Code) | | Is the stylesheet currently running an FO stylesheet?
|
foURI | protected static String foURI(Code) | | The FO namespace name.
|
tempStack | protected Stack tempStack(Code) | | A stack for holding information about temporarily closed elements.
|
xhURI | protected static String xhURI(Code) | | The XHTML namespace name.
|
CalloutEmitter | public CalloutEmitter(Controller controller, NamePool namePool, int defaultColumn, boolean foStylesheet, FormatCallout fCallout)(Code) | | Constructor for the CalloutEmitter.
Parameters: namePool - The name pool to use for constructing elements and attributes. Parameters: graphicsPath - The path to callout number graphics. Parameters: graphicsExt - The extension for callout number graphics. Parameters: graphicsMax - The largest callout number that can be represented as a graphic. Parameters: defaultColumn - The default column for callouts. Parameters: foStylesheet - Is this an FO stylesheet? |
addCallout | protected void addCallout(int coNum, Node node, int defaultColumn)(Code) | | Add a callout to the global callout array
This method examines a callout area and adds it to
the global callout array if it can be interpreted.
Only the linecolumn and linerange units are
supported. If no unit is specifed, linecolumn is assumed.
If only a line is specified, the callout decoration appears in
the defaultColumn.
Parameters: coNum - The callout number. Parameters: node - The area. Parameters: defaultColumn - The default column for callouts. |
formatPad | protected void formatPad(int numBlanks)(Code) | | Add blanks to the result tree fragment.
This method adds numBlanks to the result tree fragment.
It's used to pad lines when callouts occur after the last existing
characater in a line.
Parameters: numBlanks - The number of blanks to add. |
setupCallouts | public void setupCallouts(NodeList areaspecNodeList)(Code) | | Examine the areaspec and determine the number and position of
callouts.
The areaspecNodeSet
is examined and a sorted list of the callouts is constructed.
This data structure is used to augment the result tree fragment
with callout bullets.
Parameters: areaspecNodeSet - The source document <areaspec> element. |
skipThisElement | protected boolean skipThisElement(int nameCode)(Code) | | Protect the outer-most block wrapper.
Open elements in the result tree fragment are closed and reopened
around callouts (so that callouts don't appear inside links or other
environments). But if the result tree fragment is a single block
(a div or pre in HTML, an fo:block in FO), that outer-most block is
treated specially.
This method returns true if the element in question is that
outermost block.
Parameters: nameCode - The name code for the element True if the element is the outer-most block, false otherwise. |
|
|