de.jaret.util.ui.timebars.swt.renderer
Class RendererBase

java.lang.Object
  extended by de.jaret.util.ui.timebars.swt.renderer.RendererBase
Direct Known Subclasses:
AbstractGridRenderer, AbstractTimeBarRenderer, BoxTimeScaleRenderer, DateStripRenderer, DefaultGapRenderer, DefaultHeaderRenderer, DefaultHierarchyRenderer, DefaultMiscRenderer, DefaultTimeBarMarkerRenderer, DefaultTimeScaleRenderer, DefaultTitleRenderer, OldDefaultTimeScaleRenderer, RelationRenderer

public class RendererBase
extends java.lang.Object

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

Version:
$Id: RendererBase.java 781 2008-09-20 20:10:18Z kliem $
Author:
Peter Kliem

Field Summary
protected  org.eclipse.swt.printing.Printer _printer
          printer device if constructed for a printer.
protected  double _scaleX
          scale factor for valus on the x axis.
protected  double _scaleY
          scale factor for values on the y axis.
 
Constructor Summary
RendererBase(org.eclipse.swt.printing.Printer printer)
          May be constructed without printer (supplying null).
 
Method Summary
 void drawFocus(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle drawingArea, TimeBarViewerDelegate delegate, de.jaret.util.date.Interval interval, boolean selected, boolean printing, boolean overlap)
          Draw focus marking when not printing and focussed.
 int getDefaultLineWidth()
          Retrieve a correctd linewidth taking printer resolution in account when printing.
 org.eclipse.swt.printing.Printer getPrinter()
          Retrieve the printer device if set.
 double getScaleX()
          Retrieve the x scale factor.
 double getScaleY()
          Retruve the y scale value.
 int scaleX(int in)
          Scale an x value.
 int scaleY(int in)
          Scale an y value.
 
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 device if constructed for a printer.


_scaleX

protected double _scaleX
scale factor for valus on the x axis.


_scaleY

protected double _scaleY
scale factor for values on the y axis.

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 value.

Parameters:
in - x val to scale
Returns:
scaled value

getScaleX

public double getScaleX()
Retrieve the x scale factor.

Returns:
scale factor x

scaleY

public int scaleY(int in)
Scale an y value.

Parameters:
in - y val to scale
Returns:
scaled value

getScaleY

public double getScaleY()
Retruve the y scale value.

Returns:
y scale factor

getPrinter

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

Returns:
printer device or null

drawFocus

public void drawFocus(org.eclipse.swt.graphics.GC gc,
                      org.eclipse.swt.graphics.Rectangle drawingArea,
                      TimeBarViewerDelegate delegate,
                      de.jaret.util.date.Interval interval,
                      boolean selected,
                      boolean printing,
                      boolean overlap)
Draw focus marking when not printing and focussed.

Parameters:
gc - GC
drawingArea - rectangular drawing area
delegate - tbv delegate
interval - interval that maybe in focus
selected - true if the interval is selecetd
printing - true if operating for a printer gc
overlap - true if interval overlaps with otzher intervals

getDefaultLineWidth

public int getDefaultLineWidth()
Retrieve a correctd linewidth taking printer resolution in account when printing.

Returns:
correctd linewidth


Copyright © 2012. All Rights Reserved.