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

java.lang.Object
  extended by de.jaret.util.ui.timebars.swt.renderer.RendererBase
      extended by de.jaret.util.ui.timebars.swt.renderer.DefaultTitleRenderer
All Implemented Interfaces:
TitleRenderer

public class DefaultTitleRenderer
extends RendererBase
implements TitleRenderer

A default title renderer. Prints the text centered in the area using a bigger font. Can additionally render an image as background.

Version:
$Id: DefaultTitleRenderer.java 396 2007-05-01 12:03:44Z olk $
Author:
Peter Kliem

Field Summary
protected  java.lang.String _backgroundRscName
          path of the background image ressource.
protected  org.eclipse.swt.graphics.Font _titleFont
          font to use.
protected static java.lang.String BACKGROUND
          key for image registry.
 
Fields inherited from class de.jaret.util.ui.timebars.swt.renderer.RendererBase
_printer, _scaleX, _scaleY
 
Constructor Summary
DefaultTitleRenderer()
          Constructor for display rendering.
DefaultTitleRenderer(org.eclipse.swt.printing.Printer printer)
          Constructor for printing renderer.
 
Method Summary
 TitleRenderer createPrintRenderer(org.eclipse.swt.printing.Printer printer)
          Create a similar renderer for printing.
 void dispose()
          Dispose whatever there is.
 void draw(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle drawingArea, TimeBarViewerDelegate delegate, java.lang.String title, boolean printing)
          Daw the title.
 java.lang.String getBackgroundRscName()
          Retrieve name of ressource for the background image.
 void setBackgroundImageDescriptor(org.eclipse.jface.resource.ImageDescriptor descriptor)
          Set the bakground imgae by setting an imgae descriptor.
 void setBackgroundRscName(java.lang.String backgroundRscName)
          Set background ressource path.
 
Methods inherited from class de.jaret.util.ui.timebars.swt.renderer.RendererBase
drawFocus, getDefaultLineWidth, getPrinter, getScaleX, getScaleY, scaleX, scaleY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BACKGROUND

protected static final java.lang.String BACKGROUND
key for image registry.

See Also:
Constant Field Values

_backgroundRscName

protected java.lang.String _backgroundRscName
path of the background image ressource.


_titleFont

protected org.eclipse.swt.graphics.Font _titleFont
font to use.

Constructor Detail

DefaultTitleRenderer

public DefaultTitleRenderer(org.eclipse.swt.printing.Printer printer)
Constructor for printing renderer.

Parameters:
printer - printer device

DefaultTitleRenderer

public DefaultTitleRenderer()
Constructor for display rendering.

Method Detail

draw

public void draw(org.eclipse.swt.graphics.GC gc,
                 org.eclipse.swt.graphics.Rectangle drawingArea,
                 TimeBarViewerDelegate delegate,
                 java.lang.String title,
                 boolean printing)
Daw the title.

Specified by:
draw in interface TitleRenderer
Parameters:
gc - GC
drawingArea - area to draw in
delegate - asking delegate
title - title to draw
printing - true if this is a printing operation

createPrintRenderer

public TitleRenderer createPrintRenderer(org.eclipse.swt.printing.Printer printer)
Create a similar renderer for printing. The creatin should copy settings made to the producing renderer.

Specified by:
createPrintRenderer in interface TitleRenderer
Parameters:
printer - Printer device
Returns:
a configured renderer for printing.

dispose

public void dispose()
Dispose whatever there is.

Specified by:
dispose in interface TitleRenderer

getBackgroundRscName

public java.lang.String getBackgroundRscName()
Retrieve name of ressource for the background image.

Returns:
ressource path

setBackgroundRscName

public void setBackgroundRscName(java.lang.String backgroundRscName)
Set background ressource path. Can be problematic in an eclipse RCP.Use the setBackgroundImageDescriptor instead.

Parameters:
backgroundRscName - rsc path

setBackgroundImageDescriptor

public void setBackgroundImageDescriptor(org.eclipse.jface.resource.ImageDescriptor descriptor)
Set the bakground imgae by setting an imgae descriptor.

Parameters:
descriptor - imgae descriptor


Copyright © 2012. All Rights Reserved.