org.graphstream.ui.swingViewer.basicRenderer
Class SwingBasicGraphRenderer

java.lang.Object
  extended by org.graphstream.ui.swingViewer.GraphRendererBase
      extended by org.graphstream.ui.swingViewer.basicRenderer.SwingBasicGraphRenderer
All Implemented Interfaces:
StyleGroupListener, GraphRenderer

public class SwingBasicGraphRenderer
extends GraphRendererBase

A very simple view of the graph that respect only a subset of CSS.

This is a minimal implementation of a renderer that only supports a subset of the CSS :

TODO - Les sprites. - Les bordures.


Constructor Summary
SwingBasicGraphRenderer()
           
 
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 close()
           
 void elementStyleChanged(Element element, StyleGroup oldStyle, StyleGroup style)
          The style of the element changed.
 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 renderingSurface)
           
 void render(Graphics2D g, int width, int height)
          Redisplay or update the graph.
 void screenshot(String filename, int width, int height)
           
 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.
 
Methods inherited from class org.graphstream.ui.swingViewer.GraphRendererBase
beginSelectionAt, endSelectionAt, getRenderingSurface, selectionGrowsAt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingBasicGraphRenderer

public SwingBasicGraphRenderer()
Method Detail

open

public void open(GraphicGraph graph,
                 Container renderingSurface)
Specified by:
open in interface GraphRenderer
Overrides:
open in class GraphRendererBase

close

public void close()
Specified by:
close in interface GraphRenderer
Overrides:
close in class GraphRendererBase

getCamera

public Camera getCamera()
Description copied from interface: GraphRenderer
Get a camera object to provide control commands on the view.

Returns:
a Camera instance

allNodesOrSpritesIn

public ArrayList<GraphicElement> allNodesOrSpritesIn(double x1,
                                                     double y1,
                                                     double x2,
                                                     double y2)
Description copied from interface: GraphRenderer
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.

findNodeOrSpriteAt

public GraphicElement findNodeOrSpriteAt(double x,
                                         double y)
Description copied from interface: GraphRenderer
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.

render

public void render(Graphics2D g,
                   int width,
                   int height)
Description copied from interface: GraphRenderer
Redisplay or update the graph.


moveElementAtPx

public void moveElementAtPx(GraphicElement element,
                            double x,
                            double y)
Description copied from interface: GraphRenderer
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

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

setBackLayerRenderer

public void setBackLayerRenderer(LayerRenderer renderer)
Description copied from interface: GraphRenderer
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

public void setForeLayoutRenderer(LayerRenderer renderer)
Description copied from interface: GraphRenderer
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).

elementStyleChanged

public void elementStyleChanged(Element element,
                                StyleGroup oldStyle,
                                StyleGroup style)
Description copied from interface: StyleGroupListener
The style of the element changed.

Parameters:
element - The element.
oldStyle - The old style.
style - The changed style or the new style of the element.


Copyright © 2011. All Rights Reserved.