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

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

public class RelationRenderer
extends RendererBase
implements IRelationRenderer

Renderer rendering relations between intervals that implement the IRelationalInterval interface. Does not support vertical orientation.

Version:
$Id: RelationRenderer.java 1073 2010-11-22 21:25:33Z kliem $
Author:
kliem

Nested Class Summary
 class RelationRenderer.Line
          Internal line represenation for caching.
 
Field Summary
protected  int _arrowSize
          arrow size.
protected  org.eclipse.swt.graphics.Color _lineColor
          color used for the lines.
protected  int _lineWidth
          linewidth to use.
protected  org.eclipse.swt.graphics.Color _selectedColor
          color used for the lines when selected.
 
Fields inherited from class de.jaret.util.ui.timebars.swt.renderer.RendererBase
_printer, _scaleX, _scaleY
 
Constructor Summary
RelationRenderer()
          Create the renderer for use on displays.
RelationRenderer(org.eclipse.swt.printing.Printer printer)
          Create the renderer for a printer.
 
Method Summary
 IRelationRenderer createPrintRenderer(org.eclipse.swt.printing.Printer printer)
          Create a renderer suitable for printing.
 void dispose()
          Dispose resources the renderer might have aquired.
 int getArrowSize()
          Retrieve the current size set for the arrows.
 int getLineWidth()
          Retrieve the current line width.
 java.util.List<IIntervalRelation> getRelationsForCoord(int x, int y)
          Retrieve the list of relations that are hit a the given coordinate.
 java.lang.String getTooltip(int x, int y)
          Supply a tooltip for a position in the diagram area.
 void renderRelations(TimeBarViewerDelegate delegate, org.eclipse.swt.graphics.GC gc, boolean printing)
          Do the complete relation rendering.
 void setArrowSize(int arrowSize)
          Set the arrow size.
 void setLineWidth(int lineWidth)
          Set the line width for the connection lines.
 
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

_lineColor

protected org.eclipse.swt.graphics.Color _lineColor
color used for the lines.


_selectedColor

protected org.eclipse.swt.graphics.Color _selectedColor
color used for the lines when selected.


_lineWidth

protected int _lineWidth
linewidth to use.


_arrowSize

protected int _arrowSize
arrow size.

Constructor Detail

RelationRenderer

public RelationRenderer(org.eclipse.swt.printing.Printer printer)
Create the renderer for a printer.

Parameters:
printer - printer device

RelationRenderer

public RelationRenderer()
Create the renderer for use on displays.

Method Detail

renderRelations

public void renderRelations(TimeBarViewerDelegate delegate,
                            org.eclipse.swt.graphics.GC gc,
                            boolean printing)
Do the complete relation rendering. Processes all rows that are displayed.

Specified by:
renderRelations in interface IRelationRenderer
Parameters:
delegate - the delegate
gc - GC to paint on
printing - true when used throughout printing

getRelationsForCoord

public java.util.List<IIntervalRelation> getRelationsForCoord(int x,
                                                              int y)
Retrieve the list of relations that are hit a the given coordinate.

Specified by:
getRelationsForCoord in interface IRelationRenderer
Parameters:
x - x coordinate
y - y coordinate
Returns:
List of realations that may be empty but must not be null

getTooltip

public java.lang.String getTooltip(int x,
                                   int y)
Supply a tooltip for a position in the diagram area.

Specified by:
getTooltip in interface IRelationRenderer
Parameters:
x - x coordinate
y - y coordinate
Returns:
null for no tooltip contribution or tooltip to be displayed

dispose

public void dispose()
Dispose resources the renderer might have aquired.

Specified by:
dispose in interface IRelationRenderer

createPrintRenderer

public IRelationRenderer createPrintRenderer(org.eclipse.swt.printing.Printer printer)
Create a renderer suitable for printing.

Specified by:
createPrintRenderer in interface IRelationRenderer
Parameters:
printer - printer device
Returns:
renderer configured and ready for printing

getLineWidth

public int getLineWidth()
Retrieve the current line width.

Returns:
the current line width

setLineWidth

public void setLineWidth(int lineWidth)
Set the line width for the connection lines.

Parameters:
lineWidth - line width to set

getArrowSize

public int getArrowSize()
Retrieve the current size set for the arrows.

Returns:
the arrow size

setArrowSize

public void setArrowSize(int arrowSize)
Set the arrow size.

Parameters:
arrowSize - arrow size


Copyright © 2012. All Rights Reserved.