Package org.graphstream.ui.view
Interface GraphRenderer<S,G>
- All Known Implementing Classes:
GraphRendererBase
public interface GraphRenderer<S,G>
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
Modifier and Type Method Description Collection<GraphicElement>allGraphicElementsIn(EnumSet<InteractiveElement> types, double x1, double y1, double x2, double y2)Search for all the graphic elements of the specified types contained inside the rectangle (x1,y1)-(x2,y2).voidbeginSelectionAt(double x1, double y1)Called by the mouse manager to specify where a node and sprite selection started.voidclose()ViewcreateDefaultView(Viewer viewer, String id)voidendSelectionAt(double x2, double y2)Called by the mouse manager to specify where a node and spite selection stopped.GraphicElementfindGraphicElementAt(EnumSet<InteractiveElement> types, double x, double y)Search for the first GraphicElement among the specified types (precedence: node, edge, sprite) that contains the point at coordinates (x, y).CameragetCamera()Get a camera object to provide control commands on the view.voidmoveElementAtPx(GraphicElement element, double x, double y)Force an element to move at the given location in pixels.voidopen(GraphicGraph graph, S drawingSurface)voidrender(G g, int x, int y, int width, int height)Redisplay or update the graph.voidscreenshot(String filename, int width, int height)voidselectionGrowsAt(double x, double y)The selection already started grows toward position (x, y).voidsetBackLayerRenderer(LayerRenderer<G> renderer)Set a layer renderer that will be called each time the graph needs to be redrawn before the graph is rendered.voidsetForeLayoutRenderer(LayerRenderer<G> renderer)Set a layer renderer that will be called each time the graph needs to be redrawn after the graph is rendered.
-
Method Details
-
open
-
close
void close() -
createDefaultView
-
getCamera
Camera getCamera()Get a camera object to provide control commands on the view.- Returns:
- a Camera instance
-
findGraphicElementAt
Search for the first GraphicElement among the specified types (precedence: node, edge, sprite) that contains the point at coordinates (x, y).- Parameters:
types- The types to checkx- The point abscissa.y- The point ordinate.- Returns:
- The first GraphicElement among the specified types at the given coordinates or null if nothing found.
-
allGraphicElementsIn
Collection<GraphicElement> allGraphicElementsIn(EnumSet<InteractiveElement> types, double x1, double y1, double x2, double y2)Search for all the graphic elements of the specified types contained inside the rectangle (x1,y1)-(x2,y2).- Parameters:
types- The types to checkx1- 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 GraphicElements in the given rectangle.
-
render
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
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
-
setBackLayerRenderer
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
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).
-