org.graphstream.ui.swingViewer
Interface GraphRenderer

All Known Implementing Classes:
GraphRendererBase, SwingBasicGraphRenderer

public interface GraphRenderer

Interface for classes that draw a GraphicGraph in a swing component.

There are two rendering mechanisms in the Swing ui package : the viewer and the renderers. The viewer is a complete architecture to render a graph in a panel or frame, handling all the details. The renderer architecture is a way to only render the graph in any surface, handled directly by the developer. When using the render you are must handle the graphic graph by yourself, but you have a lot more flexibility.

The viewer mechanisms uses graph renderers.


Method Summary
 ArrayList<GraphicElement> allNodesOrSpritesIn(double x1, double y1, double x2, double y2)
          Search for all the nodes and sprites contained inside the rectangle (x1,y1)-(x2,y2).
 void beginSelectionAt(double x1, double y1)
          Called by the mouse manager to specify where a node and sprite selection started.
 void close()
           
 void endSelectionAt(double x2, double y2)
          Called by the mouse manager to specify where a node and spite selection stopped.
 GraphicElement findNodeOrSpriteAt(double x, double y)
          Search for the first node or sprite (in that order) that contains the point at coordinates (x, y).
 Camera getCamera()
          Get a camera object to provide control commands on the view.
 void moveElementAtPx(GraphicElement element, double x, double y)
          Force an element to move at the given location in pixels.
 void open(GraphicGraph graph, Container drawingSurface)
           
 void render(Graphics2D g, int x, int y, int width, int height)
          Redisplay or update the graph.
 void screenshot(String filename, int width, int height)
           
 void selectionGrowsAt(double x, double y)
          The selection already started grows toward position (x, y).
 void setBackLayerRenderer(LayerRenderer renderer)
          Set a layer renderer that will be called each time the graph needs to be redrawn before the graph is rendered.
 void setForeLayoutRenderer(LayerRenderer renderer)
          Set a layer renderer that will be called each time the graph needs to be redrawn after the graph is rendered.
 

Method Detail

open

void open(GraphicGraph graph,
          Container drawingSurface)

close

void close()

getCamera

Camera getCamera()
Get a camera object to provide control commands on the view.

Returns:
a Camera instance

findNodeOrSpriteAt

GraphicElement findNodeOrSpriteAt(double x,
                                  double y)
Search for the first node or sprite (in that order) that contains the point at coordinates (x, y).

Parameters:
x - The point abscissa.
y - The point ordinate.
Returns:
The first node or sprite at the given coordinates or null if nothing found.

allNodesOrSpritesIn

ArrayList<GraphicElement> allNodesOrSpritesIn(double x1,
                                              double y1,
                                              double x2,
                                              double y2)
Search for all the nodes and sprites contained inside the rectangle (x1,y1)-(x2,y2).

Parameters:
x1 - The rectangle lowest point abscissa.
y1 - The rectangle lowest point ordinate.
x2 - The rectangle highest point abscissa.
y2 - The rectangle highest point ordinate.
Returns:
The set of sprites and nodes in the given rectangle.

render

void render(Graphics2D g,
            int x,
            int y,
            int width,
            int height)
Redisplay or update the graph.


beginSelectionAt

void beginSelectionAt(double x1,
                      double y1)
Called by the mouse manager to specify where a node and sprite selection started.

Parameters:
x1 - The selection start abscissa.
y1 - The selection start ordinate.

selectionGrowsAt

void selectionGrowsAt(double x,
                      double y)
The selection already started grows toward position (x, y).

Parameters:
x - The new end selection abscissa.
y - The new end selection ordinate.

endSelectionAt

void endSelectionAt(double x2,
                    double y2)
Called by the mouse manager to specify where a node and spite selection stopped.

Parameters:
x2 - The selection stop abscissa.
y2 - The selection stop ordinate.

moveElementAtPx

void moveElementAtPx(GraphicElement element,
                     double x,
                     double y)
Force an element to move at the given location in pixels.

Parameters:
element - The element.
x - The requested position abscissa in pixels.
y - The requested position ordinate in pixels.

screenshot

void screenshot(String filename,
                int width,
                int height)

setBackLayerRenderer

void setBackLayerRenderer(LayerRenderer renderer)
Set a layer renderer that will be called each time the graph needs to be redrawn before the graph is rendered. Pass "null" to remove the layer renderer.

Parameters:
renderer - The renderer (or null to remove it).

setForeLayoutRenderer

void setForeLayoutRenderer(LayerRenderer renderer)
Set a layer renderer that will be called each time the graph needs to be redrawn after the graph is rendered. Pass "null" to remove the layer renderer.

Parameters:
renderer - The renderer (or null to remove it).


Copyright © 2012. All Rights Reserved.