public interface GraphRenderer<S,G>
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.
Modifier and Type | Method and Description |
---|---|
java.util.Collection<GraphicElement> |
allGraphicElementsIn(java.util.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).
|
void |
beginSelectionAt(double x1,
double y1)
Called by the mouse manager to specify where a node and sprite selection
started.
|
void |
close() |
View |
createDefaultView(Viewer viewer,
java.lang.String id) |
void |
endSelectionAt(double x2,
double y2)
Called by the mouse manager to specify where a node and spite selection
stopped.
|
GraphicElement |
findGraphicElementAt(java.util.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).
|
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,
S drawingSurface) |
void |
render(G g,
int x,
int y,
int width,
int height)
Redisplay or update the graph.
|
void |
screenshot(java.lang.String filename,
int width,
int height) |
void |
selectionGrowsAt(double x,
double y)
The selection already started grows toward position (x, y).
|
void |
setBackLayerRenderer(LayerRenderer<G> 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<G> renderer)
Set a layer renderer that will be called each time the graph needs to be
redrawn after the graph is rendered.
|
void open(GraphicGraph graph, S drawingSurface)
void close()
Camera getCamera()
GraphicElement findGraphicElementAt(java.util.EnumSet<InteractiveElement> types, double x, double y)
types
- The types to checkx
- The point abscissa.y
- The point ordinate.java.util.Collection<GraphicElement> allGraphicElementsIn(java.util.EnumSet<InteractiveElement> types, double x1, double y1, double x2, double y2)
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.void render(G g, int x, int y, int width, int height)
void beginSelectionAt(double x1, double y1)
x1
- The selection start abscissa.y1
- The selection start ordinate.void selectionGrowsAt(double x, double y)
x
- The new end selection abscissa.y
- The new end selection ordinate.void endSelectionAt(double x2, double y2)
x2
- The selection stop abscissa.y2
- The selection stop ordinate.void moveElementAtPx(GraphicElement element, double x, double y)
element
- The element.x
- The requested position abscissa in pixels.y
- The requested position ordinate in pixels.void screenshot(java.lang.String filename, int width, int height)
void setBackLayerRenderer(LayerRenderer<G> renderer)
renderer
- The renderer (or null to remove it).void setForeLayoutRenderer(LayerRenderer<G> renderer)
renderer
- The renderer (or null to remove it).