de.jaret.util.ui.table.renderer
Class RendererBase

java.lang.Object
  extended by de.jaret.util.ui.table.renderer.RendererBase
Direct Known Subclasses:
CellRendererBase, DefaultTableHeaderRenderer

public abstract class RendererBase
extends java.lang.Object

Base implementation for renderers that support both screen and printer rendering. It's main purpose is scaling beetween screen and printer coordinates (based on 96dpi for the screen).

Version:
$Id: RendererBase.java 179 2007-01-07 17:37:50Z olk $
Author:
Peter Kliem

Field Summary
protected  org.eclipse.swt.printing.Printer _printer
          printer if used.
protected  double _scaleX
          x scaling for transformation beetwenn screen and printer.
protected  double _scaleY
          y scaling for transformation beetwenn screen and printer.
protected static double SCREEN_DPI_X
          constant for scaling: screen resolution x.
protected static double SCREEN_DPI_Y
          constant for scaling: screen resolution y.
 
Constructor Summary
RendererBase(org.eclipse.swt.printing.Printer printer)
          May be constructed without printer (supplying null).
 
Method Summary
 org.eclipse.swt.printing.Printer getPrinter()
          Retrieve the printer device.
 double getScaleX()
          Retrieve the x scale factor.
 double getScaleY()
          Retrieve the y scale factor.
protected  void restoreGCAttributes(org.eclipse.swt.graphics.GC gc)
          Helper method to restore attribute values saved with saveGCAttributes.
protected  void saveGCAttributes(org.eclipse.swt.graphics.GC gc)
          Helper method saving several GC attributes to loal variables.
 int scaleX(int in)
          Scale an x coordinate/size from screen to printer.
 int scaleY(int in)
          Scale an y coordinate/size from screen to printer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_printer

protected org.eclipse.swt.printing.Printer _printer
printer if used.


SCREEN_DPI_X

protected static final double SCREEN_DPI_X
constant for scaling: screen resolution x.

See Also:
Constant Field Values

SCREEN_DPI_Y

protected static final double SCREEN_DPI_Y
constant for scaling: screen resolution y.

See Also:
Constant Field Values

_scaleX

protected double _scaleX
x scaling for transformation beetwenn screen and printer.


_scaleY

protected double _scaleY
y scaling for transformation beetwenn screen and printer.

Constructor Detail

RendererBase

public RendererBase(org.eclipse.swt.printing.Printer printer)
May be constructed without printer (supplying null).

Parameters:
printer - or null
Method Detail

scaleX

public int scaleX(int in)
Scale an x coordinate/size from screen to printer.

Parameters:
in - corodinate/size to scale
Returns:
scaled value

getScaleX

public double getScaleX()
Retrieve the x scale factor.

Returns:
x scale factor

scaleY

public int scaleY(int in)
Scale an y coordinate/size from screen to printer.

Parameters:
in - corodinate/size to scale
Returns:
scaled value

getScaleY

public double getScaleY()
Retrieve the y scale factor.

Returns:
y scale factor

getPrinter

public org.eclipse.swt.printing.Printer getPrinter()
Retrieve the printer device.

Returns:
printer device if set null otherwise

saveGCAttributes

protected void saveGCAttributes(org.eclipse.swt.graphics.GC gc)
Helper method saving several GC attributes to loal variables. The values can be restored with restoreGCAttributes.

Parameters:
gc - GC to save attributes for

restoreGCAttributes

protected void restoreGCAttributes(org.eclipse.swt.graphics.GC gc)
Helper method to restore attribute values saved with saveGCAttributes.

Parameters:
gc - GC to restore attributes for


Copyright © 2012. All Rights Reserved.