public class SwingBasicGraphRenderer extends GraphRendererBase
This is a minimal implementation of a renderer that only supports a subset of the CSS :
Constructor and Description |
---|
SwingBasicGraphRenderer() |
Modifier and Type | Method and Description |
---|---|
Collection<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 x,
int y,
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.
|
beginSelectionAt, endSelectionAt, getRenderingSurface, selectionGrowsAt
public void open(GraphicGraph graph, Container renderingSurface)
open
in interface GraphRenderer
open
in class GraphRendererBase
public void close()
close
in interface GraphRenderer
close
in class GraphRendererBase
public Camera getCamera()
GraphRenderer
public Collection<GraphicElement> allNodesOrSpritesIn(double x1, double y1, double x2, double y2)
GraphRenderer
x1
- The rectangle lowest point abscissa.y1
- The rectangle lowest point ordinate.x2
- The rectangle highest point abscissa.y2
- The rectangle highest point ordinate.public GraphicElement findNodeOrSpriteAt(double x, double y)
GraphRenderer
x
- The point abscissa.y
- The point ordinate.public void render(Graphics2D g, int x, int y, int width, int height)
GraphRenderer
public void moveElementAtPx(GraphicElement element, double x, double y)
GraphRenderer
element
- The element.x
- The requested position abscissa in pixels.y
- The requested position ordinate in pixels.public void screenshot(String filename, int width, int height)
public void setBackLayerRenderer(LayerRenderer renderer)
GraphRenderer
renderer
- The renderer (or null to remove it).public void setForeLayoutRenderer(LayerRenderer renderer)
GraphRenderer
renderer
- The renderer (or null to remove it).public void elementStyleChanged(Element element, StyleGroup oldStyle, StyleGroup style)
StyleGroupListener
element
- The element.oldStyle
- The old style.style
- The changed style or the new style of the element.Copyright © 2015. All rights reserved.