org.grinvin.graphs.render

Class DefaultRenderer

Implemented Interfaces:
Renderer
Known Direct Subclasses:
AnnotatedRenderer

public class DefaultRenderer
extends java.lang.Object
implements Renderer

Default implementation of a renderer. Renders vertices as small circles and edges as solid lines. Is a singleton class whose sole instance should be retrieved by means of the method getInstance().

Constructor Summary

DefaultRenderer()

Method Summary

static Renderer
getInstance()
Get the singleton instance of this renderer.
void
paint(Edge edge, double[] coordinates_first, double[] coordinates_second, boolean rollover, boolean selected, Object annotation, Graphics2D g2)
Render an Edge
void
paint(Vertex vertex, double[] coordinates, boolean rollover, boolean selected, Object annotation, Graphics2D g2)
Render a Vertex

Constructor Details

DefaultRenderer

protected DefaultRenderer()

Method Details

getInstance

public static Renderer getInstance()
Get the singleton instance of this renderer.

paint

public void paint(Edge edge,
                  double[] coordinates_first,
                  double[] coordinates_second,
                  boolean rollover,
                  boolean selected,
                  Object annotation,
                  Graphics2D g2)
Render an Edge
Specified by:
paint in interface Renderer
Parameters:
edge - Edge to render
coordinates_first - Coordinates of the first Vertex
coordinates_second - Coordinates of the second Vertex
rollover - Is this the current rollover?
selected - Is this Edge selected?
g2 - Panel to paint on

paint

public void paint(Vertex vertex,
                  double[] coordinates,
                  boolean rollover,
                  boolean selected,
                  Object annotation,
                  Graphics2D g2)
Render a Vertex
Specified by:
paint in interface Renderer
Parameters:
vertex - Vertex to render
coordinates - Coordinates of the Vertex
rollover - Is this the current rollover?
selected - Is this Vertex selected?
g2 - Panel to paint on