motris.gui
Class GuiPrinter

java.lang.Object
  extended bymotris.gui.GuiPrinter
All Implemented Interfaces:
java.awt.print.Printable

public class GuiPrinter
extends java.lang.Object
implements java.awt.print.Printable

Exports a Swing Container (ie the main window) to lots of bitmap and vector formats

Author:
dahlkamp

Field Summary
private  java.awt.Container display
           
private  java.lang.String fileName
           
private static java.lang.String[] filterString
           
private  java.lang.Process ghostscript
           
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
GuiPrinter(java.awt.Container _display)
          Export to file specified by Export Dialog
GuiPrinter(java.awt.Container _display, java.lang.String _fileName, double scaleFactor)
          Export paintable Container to MotrisImage File
 
Method Summary
private  boolean execute(java.lang.String[] command)
          Execute a process specified by command.
private  void export(java.awt.Container _display, double scaleFactor)
           
private  void exportImage(java.lang.String fileName, double scaleFactor)
           
private  void exportPostScript(int fileSuffix)
           
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
          Method provided to implement Printable which is required for Poscript Printing
 boolean printPS(java.lang.String fileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterString

private static final java.lang.String[] filterString

display

private java.awt.Container display

ghostscript

private java.lang.Process ghostscript

fileName

private java.lang.String fileName
Constructor Detail

GuiPrinter

public GuiPrinter(java.awt.Container _display)
Export to file specified by Export Dialog

Parameters:
_display - Paintable Component to export

GuiPrinter

public GuiPrinter(java.awt.Container _display,
                  java.lang.String _fileName,
                  double scaleFactor)
Export paintable Container to MotrisImage File

Parameters:
_display - While Container to export
_fileName - where to save the image
scaleFactor - zoom factor
Method Detail

export

private void export(java.awt.Container _display,
                    double scaleFactor)

exportImage

private void exportImage(java.lang.String fileName,
                         double scaleFactor)

exportPostScript

private void exportPostScript(int fileSuffix)

printPS

public boolean printPS(java.lang.String fileName)

print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Method provided to implement Printable which is required for Poscript Printing

Specified by:
print in interface java.awt.print.Printable
Throws:
java.awt.print.PrinterException

execute

private boolean execute(java.lang.String[] command)
Execute a process specified by command. Needed for image conversion

Parameters:
command - 1st String = command, subsequend strings = arguments
Returns:
Return true if exitcode==0 and no error occurred