jimm.datavision.layout
Class LaTeXLE

java.lang.Object
  extended by jimm.datavision.layout.LayoutEngine
      extended by jimm.datavision.layout.LaTeXLE
All Implemented Interfaces:
LineDrawer

public class LaTeXLE
extends LayoutEngine
implements LineDrawer

A LaTeX2e layout engine.

Author:
Jim Menard, jimm@io.com

Field Summary
protected  double linethickness
           
 
Fields inherited from class jimm.datavision.layout.LayoutEngine
currentSection, newPage, out, pageHeight, pageHeightUsed, pageNumber, pageWidth, POINTS_PER_INCH, previousSectionArea, report, SECT_DETAIL, SECT_GROUP_FOOTER, SECT_GROUP_HEADER, SECT_PAGE_FOOTER, SECT_PAGE_HEADER, SECT_REPORT_FOOTER, SECT_REPORT_HEADER, wantsMoreData
 
Constructor Summary
LaTeXLE(java.io.PrintWriter out)
           
 
Method Summary
protected  void doEnd()
          Outputs the end of the document.
protected  void doEndPage()
          End a page.
protected  void doOutputField(Field field)
          Outputs a field.
protected  void doOutputImage(ImageField field)
          Ignores image output
protected  void doOutputLine(Line line)
          Outputs a line.
protected  void doStart()
          Outputs the beginning of the document.
protected  void doStartPage()
          Start a new page.
 void drawLine(Line line, java.lang.Object arg)
          Draw a single line.
protected  void makeBorders(Field field)
          Outputs borders.
protected  java.lang.String makeSafe(java.lang.String str)
          Returns a new string with all LaTeX2e special characters replaced by their printable equivalents.
protected  double[] pickNearestSlope(double slope)
          Returns an array containing two doubleing-point values representing the x and y values needed for a LaTeX2e line.
protected  void putField(Field field)
          Outputs the LaTeX2e code that places the field on the page.
protected  void putLine(Line line, double xslope, double yslope)
          Outputs the LaTeX2e code that places the line on the page.
protected  java.lang.String[] selectFontSize(Format format)
          Returns array of two strings that set/reset font size.
protected  void setLineThickness(double t)
          Sets the line thickness for drawing.
 
Methods inherited from class jimm.datavision.layout.LayoutEngine
calcDetailHeight, calcPageFooterHeight, calcReportFooterHeight, calcSectionHeights, cancel, checkRemainingPageLength, closeOutput, currentSectionTypeAsString, detail, doOutputSection, end, endPage, groupFooters, groupHeaders, outputField, outputImage, outputLine, outputSection, pageHeight, pageNumber, pageWidth, setReport, start, startPage, wantsMoreData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

linethickness

protected double linethickness
Constructor Detail

LaTeXLE

public LaTeXLE(java.io.PrintWriter out)
Method Detail

doStart

protected void doStart()
Outputs the beginning of the document.

Overrides:
doStart in class LayoutEngine

doEnd

protected void doEnd()
Outputs the end of the document.

Overrides:
doEnd in class LayoutEngine

doStartPage

protected void doStartPage()
Start a new page.

Overrides:
doStartPage in class LayoutEngine

doEndPage

protected void doEndPage()
End a page.

Overrides:
doEndPage in class LayoutEngine

doOutputField

protected void doOutputField(Field field)
Outputs a field.

Specified by:
doOutputField in class LayoutEngine
Parameters:
field - the field to output

doOutputImage

protected void doOutputImage(ImageField field)
Ignores image output

Specified by:
doOutputImage in class LayoutEngine
Parameters:
field - an image field

doOutputLine

protected void doOutputLine(Line line)
Outputs a line. Calls drawLine(jimm.datavision.Line, java.lang.Object).

Specified by:
doOutputLine in class LayoutEngine
Parameters:
line - a line

selectFontSize

protected java.lang.String[] selectFontSize(Format format)
Returns array of two strings that set/reset font size. If format is null or has no size, return null.

Returns:
an array of two strings

makeBorders

protected void makeBorders(Field field)
Outputs borders.


drawLine

public void drawLine(Line line,
                     java.lang.Object arg)
Draw a single line.

Specified by:
drawLine in interface LineDrawer
Parameters:
line - a line
arg - whatever you want it to be

pickNearestSlope

protected double[] pickNearestSlope(double slope)
Returns an array containing two doubleing-point values representing the x and y values needed for a LaTeX2e line. LaTeX2e insists that these two values be integers, but we use doubles for accuracy and let putLine truncate them.

Parameters:
slope - a double
Returns:
an array containing x and y values

setLineThickness

protected void setLineThickness(double t)
Sets the line thickness for drawing.

Parameters:
t - thickness

putField

protected void putField(Field field)
Outputs the LaTeX2e code that places the field on the page.


putLine

protected void putLine(Line line,
                       double xslope,
                       double yslope)
Outputs the LaTeX2e code that places the line on the page. Both xslope and yslope are cast to ints because that's what LaTeX2e requires.

Parameters:
line - the line to draw
xslope - the X slope of the line; must be from -6 through 6
yslope - the Y slope of the line; must be from -6 through 6

makeSafe

protected java.lang.String makeSafe(java.lang.String str)
Returns a new string with all LaTeX2e special characters replaced by their printable equivalents.

Parameters:
str -
Returns:
a string safe for LaTeX2e output