Package jmri.util.davidflanagan
Class CompatibleHardcopyWriter
java.lang.Object
java.io.Writer
jmri.util.davidflanagan.HardcopyWriter
jmri.util.davidflanagan.CompatibleHardcopyWriter
- All Implemented Interfaces:
Printable,Closeable,Flushable,Appendable,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.util.davidflanagan.HardcopyWriter
HardcopyWriter.Align, HardcopyWriter.Column, HardcopyWriter.ColumnException, HardcopyWriter.DrawImage, HardcopyWriter.DrawImageIconFile, HardcopyWriter.DrawLine, HardcopyWriter.DrawString, HardcopyWriter.ImageIconWrapper, HardcopyWriter.PrintCanceledException, HardcopyWriter.PrintCommand, HardcopyWriter.PrintWindow, HardcopyWriter.SetColor, HardcopyWriter.SetFont -
Field Summary
Fields inherited from class jmri.util.davidflanagan.HardcopyWriter
attributes, charwidth, closeButton, color, columnIndex, columns, currentPageCommands, font, frame, headerfont, headermetrics, headery, height, isMonospacedFont, isPreview, jobname, leftMargin, line, lineascent, lineheight, max_v_pos, metrics, nextButton, page, pageCommands, pageCount, pageFormat, pageImages, pagenum, pagesizePixels, pagesizePoints, pixelScale, previewFrame, previewIcon, previewImage, previewLabel, previewPanel, previewToolBar, previousButton, printerJob, printHeader, printJobGraphics, screenResolution, showPreview, time, titleTop, useFontName, useFontSize, useFontStyle, v_pos, width, width_including_right_margin, x0, y0Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS -
Constructor Summary
ConstructorsConstructorDescriptionCompatibleHardcopyWriter(Frame frame, String jobname, int fontsize, double leftmargin, double rightmargin, double topmargin, double bottommargin, boolean isPreview) CompatibleHardcopyWriter(Frame frame, String jobname, int fontsize, double leftmargin, double rightmargin, double topmargin, double bottommargin, boolean isPreview, String printerName, boolean isLandscape, boolean isPrintHeader, Sides sides, Dimension pagesize) -
Method Summary
Modifier and TypeMethodDescriptionintGet the current line number -- this is nasty since it makes the implicit assumption that the line height is constant over the whole page.intGet the number of lines per page.voidsetFontName(String name) Set the font namevoidsetFontStyle(int style) Set the font stylevoidwrite(int startLine, int startColumn, int endLine, int endColumn) This draws a line from the start position to the end position (in characters/lines).Methods inherited from class jmri.util.davidflanagan.HardcopyWriter
close, displayPage, dispose, ensureOnPage, ensureVerticalSpace, flush, getCharactersPerLine, getCharWidth, getCurrentVPos, getFontSize, getLineAscent, getLineHeight, getPageCommands, getPageImages, getPageNum, getPrintablePagesizePoints, increaseLineSpacing, isMonospaced, leaveVerticalSpace, measure, measure, newline, pageBreak, print, setColumns, setColumns, setFont, setTextColor, toolBarInit, write, write, write, write, writeBorders, writeDecoderProIcon, writeDecoderProIcon, writeExactLine, writeLine, writeSpecificSize, writeSpecificSize
-
Constructor Details
-
CompatibleHardcopyWriter
public CompatibleHardcopyWriter(Frame frame, String jobname, int fontsize, double leftmargin, double rightmargin, double topmargin, double bottommargin, boolean isPreview) throws HardcopyWriter.PrintCanceledException -
CompatibleHardcopyWriter
public CompatibleHardcopyWriter(Frame frame, String jobname, int fontsize, double leftmargin, double rightmargin, double topmargin, double bottommargin, boolean isPreview, String printerName, boolean isLandscape, boolean isPrintHeader, Sides sides, Dimension pagesize) throws HardcopyWriter.PrintCanceledException
-
-
Method Details
-
getCurrentLineNumber
Get the current line number -- this is nasty since it makes the implicit assumption that the line height is constant over the whole page. Further, things like images can throw this off.We may want to adjust the current v_pos to align it with an integer line number (when this is called).
- Returns:
- the current line number
-
getLinesPerPage
Get the number of lines per page. Again, this assumes that the line height is constant over the whole page.- Returns:
- the number of lines per page
-
write
This draws a line from the start position to the end position (in characters/lines). This has the same sort of issues as getCurrentLineNumber(). We may want to tweak this to behave differently.- Parameters:
startLine- The starting line numberstartColumn- The starting column numberendLine- The ending line numberendColumn- The ending column number
-
setFontStyle
Set the font style- Parameters:
style- The font style
-
setFontName
Set the font name- Parameters:
name- The font name
-