diva.compat.trace
Class BasicTraceRenderer

java.lang.Object
  extended by diva.compat.trace.BasicTraceRenderer
All Implemented Interfaces:
TraceRenderer

public class BasicTraceRenderer
extends Object
implements TraceRenderer

A basic implementation of trace rendering.

Version:
$Revision: 1.9 $
Author:
John Reekie (johnr@eecs.berkeley.edu)

Constructor Summary
BasicTraceRenderer()
           
 
Method Summary
 void clear()
          Clear all data from the renderer.
 void forgetTrace(TraceModel.Trace trace)
          Remove the mapping of a Trace to its rendering.
 void forgetTraceElement(TraceModel.Element element)
          Remove the mapping of a Trace element to its rendering.
 Figure getTraceElementRendering(TraceModel.Element element)
          Get the renderering of a Trace element.
 CompositeFigure getTraceRendering(TraceModel.Trace trace)
          Get the renderering of a Trace.
 CompositeFigure renderTrace(TraceModel.Trace trace, Rectangle2D bounds)
          Create a new Figure for a Trace.
 Figure renderTraceElement(TraceModel.Element element, Rectangle2D bounds)
          Create a new Figure for an element of a trace.
 void updateTrace(TraceModel.Trace trace)
          Update the rendering of a trace.
 void updateTraceElement(TraceModel.Element element)
          Update the rendering of a trace element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTraceRenderer

public BasicTraceRenderer()
Method Detail

clear

public void clear()
Clear all data from the renderer.


forgetTrace

public void forgetTrace(TraceModel.Trace trace)
Remove the mapping of a Trace to its rendering. This enables dead traces to be garbage-collected.

Specified by:
forgetTrace in interface TraceRenderer

forgetTraceElement

public void forgetTraceElement(TraceModel.Element element)
Remove the mapping of a Trace element to its rendering. This is used by moving traces, to enable dead objects to be garbage-collected.

Specified by:
forgetTraceElement in interface TraceRenderer

getTraceElementRendering

public Figure getTraceElementRendering(TraceModel.Element element)
Get the renderering of a Trace element. If this renderer has previously rendered the given element, then it returns that renderering, otherwise it returns null. The element must already be contained within a trace.

Specified by:
getTraceElementRendering in interface TraceRenderer

getTraceRendering

public CompositeFigure getTraceRendering(TraceModel.Trace trace)
Get the renderering of a Trace. If this renderer has previously rendered the given trace, then it returns that renderering, otherwise it returns null.

Specified by:
getTraceRendering in interface TraceRenderer

renderTrace

public CompositeFigure renderTrace(TraceModel.Trace trace,
                                   Rectangle2D bounds)
Create a new Figure for a Trace. The Figure must be a CompositeFigure, and must be able to treat its bounds as the region in which the trace is to be displayed. The figure is not expected to display the elements of the trace, just the marker line or boundary. If the renderering requires a label, then the renderer is expected to provide that label. The renderer should not check if the trace has already been rendered (this is for performance reasons).

Specified by:
renderTrace in interface TraceRenderer

renderTraceElement

public Figure renderTraceElement(TraceModel.Element element,
                                 Rectangle2D bounds)
Create a new Figure for an element of a trace. Any figure can be used, but to be useful it must display itself so that it marks the region given by its bounding box. In this default implementation, a rectangle is produced, with the color produced by taking the integer value of the element's value.

Specified by:
renderTraceElement in interface TraceRenderer

updateTrace

public void updateTrace(TraceModel.Trace trace)
Update the rendering of a trace. Typically this is used to update elements such as labels that may have been created by the renderer but which the client doesn't know how to change.

Specified by:
updateTrace in interface TraceRenderer

updateTraceElement

public void updateTraceElement(TraceModel.Element element)
Update the rendering of a trace element. Typically this is used to update elements such as labels that may have been created by the renderer but which the client doesn't know how to change.

Specified by:
updateTraceElement in interface TraceRenderer


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.