public class VisualGraph extends NullGraphListener implements Serializable
Graph,
Serialized Form| Constructor and Description |
|---|
VisualGraph()
Creates a new, empty VisualGraph object.
|
VisualGraph(Graph g) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Vertex vertex)
Adds a Vertex object to the Graph object encapsulated by the VisualGraph object.
|
void |
add(Vertex vertex,
Font f)
Adds a Vertex object to the Graph object encapsulated by the VisualGraph object
then set the Font used by corresponding VisualVertex object.
|
void |
addContainer(Container c)
Registers a Container for drawing the VisualGraph.
|
void |
addEdge(VisualVertex from,
VisualVertex to)
Adds an edge to the Graph object encapsulated by the VisualGraph object.
|
void |
afterEdgeAdded(GraphAddEdgeEvent e)
This method is automatically called whenever an Edge is added to the
Graph object encapsulated by the VisualGraph object.
|
void |
afterEdgeRemoved(GraphRemoveEdgeEvent e)
This method is automatically called whenever an Edge is
removed from the Graph object encapsulated by the VisualGraph object.
|
void |
afterVertexAdded(GraphAddVertexEvent e)
This method is automatically called whenever a Vertex is added to the
Graph object encapsulated by the VisualGraph object.
|
void |
afterVertexRemoved(GraphRemoveVertexEvent e)
This method is automatically called whenever a Vertex is about to be
removed from the Graph object encapsulated by the VisualGraph object.
|
void |
emphasizeSubGraph(Graph subGraph,
VisualVertexPainter vPainter,
VisualEdgePainter ePainter)
Emphasizes a subgraph by changing the painters for the VisualGraphComponents of
the subgraph.
|
void |
emphasizeSubGraph(Graph subGraph,
VisualVertexPainter mainGraphVPainter,
VisualEdgePainter mainGraphEPainter,
VisualVertexPainter subGraphVPainter,
VisualEdgePainter subGraphEPainter)
Emphasizes a subgraph by changing the both the painters for the VisualGraphComponents of
the subgraph and the painters for the main graph.
|
List |
getContainers()
Returns the Containers that are registered with the VisualGraph object
where VisualGraph will be drawn.
|
Graph |
getGraph()
Returns the Graph object that the VisualGraph object encapsulates.
|
GraphLayoutManager |
getGraphLayoutManager()
Returns the layout manager used to layout the vertices of the graph.
|
Dimension |
getMaxSize()
Determines the dimension that contains all the VisualGraph's VisualVertex.
|
VisualVertex |
getNode(int x,
int y)
Returns the VisualVertex object that has the given x and y coordinate
inside its shape.
|
Point |
getStartDrawPoint()
Determines the starting point where a VisualVertex is drawn.
|
VisualEdge |
getVisualEdge(Edge edge) |
VisualEdge |
getVisualEdge(int x,
int y)
Returns a VisualEdge whose line is nearest the specified point.
|
VisualEdgePainterFactory |
getVisualEdgePainterFactory()
Returns an instance of the factory used to create painters for VisualEdges.
|
List |
getVisualEdges()
Returns the List of VisualEdges contained within this VisualGraph
|
VisualGraphComponentEditorFactory |
getVisualGraphComponentEditorFactory()
Returns an instance of the factory used to create custom editors
for VisualVertex and VisualEdge.
|
VisualVertex |
getVisualVertex(Vertex vertex)
Returns the VisualVertex object for the corresponding Vertex object in the
Graph object encapsulated by VisualGraph.
|
VisualVertexPainterFactory |
getVisualVertexPainterFactory()
Returns an instance of the factory used to create painters for VisualVertices.
|
List |
getVisualVertices()
Returns the List of VisualVertices contained within this VisualGraph
|
void |
layout()
Ask the layout manager to layout the vertices of the graph according
to the rules of the layout manager.
|
void |
paint(Graphics2D g2d)
Draws the elements of VisualGraph (all of its VisualVertex and VisualEdges) using
the given Graphics2D graphics context object.
|
void |
paint(Graphics2D g2d,
Line2D probableedgeline)
Draws the elements of VisualGraph (all of its VisualVertex and VisualEdges) using
the given Graphics2D graphics context object.
|
void |
paint(Graphics2D g2d,
VisualVertex onfront)
Draws the elements of VisualGraph (all of its VisualVertex and VisualEdges) using
the given Graphics2D graphics context object.
|
void |
remove(Vertex vertex)
Removes a Vertex object from the Graph object encapsulated by the VisualGraph object.
|
void |
remove(VisualVertex vvertex)
Removes a Vertex object from the Graph object encapsulated by the VisualGraph object.
|
void |
removeContainer(Container c)
Removes a Container from drawing of the VisualGraph object.
|
void |
removeEdge(Edge edge)
Removes an Edge object from the Graph object encapsulated by the VisualGraph object.
|
void |
removeEdge(VisualEdge vedge)
Removes an Edge object from the Graph object encapsulated by the VisualGraph object.
|
void |
repaint()
Repaints the VisualGraph in all the registered Containers.
|
void |
setGraph(Graph graph)
Sets the Graph object that the VisualGraph object encapsulates.
|
void |
setGraphLayoutManager(GraphLayoutManager layoutmanager)
Sets the layout manager to use to layout the vertices of the graph.
|
void |
setOrthogonalLine() |
void |
setStraightLine() |
void |
setVisualEdge(Edge edge,
VisualEdge newVisualEdge) |
void |
setVisualEdgePainterFactory(VisualEdgePainterFactory newFactory)
Sets the factory for creating painters for VisualEdges.
|
void |
setVisualGraphComponentEditorFactory(VisualGraphComponentEditorFactory editorFactory)
Sets the factory for creating custom editors for VisualVertex and VisualEdges.
|
void |
setVisualVertex(Vertex vertex,
VisualVertex newVisualVertex) |
void |
setVisualVertexPainterFactory(VisualVertexPainterFactory newFactory)
Sets the factory for creating painters for VisualVertices
|
List |
translateToVertices(Collection visualvertices)
Translates each Visual Vertex object in the specified collection to their Vertex
counterpart.
|
List |
translateToVisualEdges(List edges)
Translates each of the Edge object in the specified collection to their Edge
counterpart.
|
List |
translateToVisualVertices(Collection vertices)
Translates the vertices in the specified collection to their VisualVertex
counterpart.
|
beforeEdgeAdded, beforeEdgeRemoved, beforeVertexAdded, beforeVertexRemovedpublic VisualGraph()
public VisualGraph(Graph g)
public List getContainers()
addContainer( Container ),
removeContainer( Container )public void addContainer(Container c)
c - Additional Container where VisualGraph will be drawnremoveContainer( Container )public void removeContainer(Container c)
c - Container where VisualGraph will no longer be drawnaddContainer( Container )public Dimension getMaxSize()
public Point getStartDrawPoint()
public void repaint()
public Graph getGraph()
public void setGraph(Graph graph)
graph - The new Graph object that will be encapsulated by the VisualGraph objectpublic GraphLayoutManager getGraphLayoutManager()
public void setGraphLayoutManager(GraphLayoutManager layoutmanager)
layoutmanager - An object implementing the GraphLayoutManager interface.public VisualVertexPainterFactory getVisualVertexPainterFactory()
public void setVisualVertexPainterFactory(VisualVertexPainterFactory newFactory)
public VisualEdgePainterFactory getVisualEdgePainterFactory()
public void setVisualEdgePainterFactory(VisualEdgePainterFactory newFactory)
public VisualGraphComponentEditorFactory getVisualGraphComponentEditorFactory()
public void setVisualGraphComponentEditorFactory(VisualGraphComponentEditorFactory editorFactory)
public List getVisualVertices()
public List getVisualEdges()
public void setOrthogonalLine()
public void setStraightLine()
public void layout()
public VisualEdge getVisualEdge(Edge edge)
public void setVisualEdge(Edge edge, VisualEdge newVisualEdge)
public VisualVertex getVisualVertex(Vertex vertex)
vertex - The Vertex object whose corresponding VisualVertex object we wantpublic void setVisualVertex(Vertex vertex, VisualVertex newVisualVertex)
public VisualEdge getVisualEdge(int x, int y)
x - x-coordinatey - y-coordinatepublic void add(Vertex vertex) throws Exception
vertex - The Vertex object to be added to the graphExceptionadd( Vertex, Font )public void add(Vertex vertex, Font f) throws Exception
vertex - The Vertex object to be added to the graphf - Font object to be used for drawing the String inside the shape of VisualVertex.Exceptionpublic void addEdge(VisualVertex from, VisualVertex to) throws Exception
from - The source Vertex object of the edgeto - The destination Vertex object of the edgeExceptionpublic void remove(Vertex vertex) throws Exception
vertex - The Vertex object to be removedExceptionremove( VisualVertex )public void remove(VisualVertex vvertex) throws Exception
vertex - The VisualVertex object to be removedExceptionremove( Vertex )public void removeEdge(Edge edge) throws Exception
edge - The Edge object to be removedExceptionremoveEdge( VisualEdge )public void removeEdge(VisualEdge vedge) throws Exception
vedge - The VisualEdge object to be removedExceptionremoveEdge( Edge )public VisualVertex getNode(int x, int y)
x - x-coordinatey - y-coordinatepublic List translateToVisualVertices(Collection vertices)
vertices - Collection of vertices to be translated to their
corresponding Visual Vertex. If the vertex does not have
a corresponding Visual Vertex or the vertex is not in the
graph, then null will be the translation.public List translateToVertices(Collection visualvertices)
vertices - Collection of visual vertices to be translated to their
corresponding Vertex. If the vertex does not have
a corresponding Vertex or the visual vertex is not in the
graph, then null will be the translation.public List translateToVisualEdges(List edges)
vertices - Collection of edges to be translated to their
corresponding Visual Edge. If the edge does not have
a corresponding Visual Edge or the edge is not in the
graph, then null will be the translation.public void paint(Graphics2D g2d, VisualVertex onfront)
g2d - Graphics2D graphics context object to be used for painting
the elements of VisualGraph.onfront - If not null, the given VisualVertex will be redrawn at the last
stage so that it will always be on front of all other vertices and edges.public void paint(Graphics2D g2d)
g2d - Graphics2D graphics context object to be used for painting
the elements of VisualGraph.public void paint(Graphics2D g2d, Line2D probableedgeline)
g2d - Graphics2D graphics context object to be used for painting
the elements of VisualGraph.probableedgeline - If not null, a dashed line is drawn.public void afterVertexAdded(GraphAddVertexEvent e)
afterVertexAdded in interface GraphListenerafterVertexAdded in class NullGraphListenere - GraphAddVertexEvent object that also specifies the Vertex that was added
to the graphpublic void afterEdgeAdded(GraphAddEdgeEvent e)
afterEdgeAdded in interface GraphListenerafterEdgeAdded in class NullGraphListenere - GraphAddEdgeEvent object that also specifies the Edge that was added
to the graphpublic void afterVertexRemoved(GraphRemoveVertexEvent e)
afterVertexRemoved in interface GraphListenerafterVertexRemoved in class NullGraphListenere - GraphRemoveVertexEvent object that also specifies the Vertex
that is about to be removed from the graphpublic void afterEdgeRemoved(GraphRemoveEdgeEvent e)
afterEdgeRemoved in interface GraphListenerafterEdgeRemoved in class NullGraphListenere - GraphRemoveEdgeEvent object that also specifies the Edge
that is about to be removed from the graphpublic void emphasizeSubGraph(Graph subGraph, VisualVertexPainter vPainter, VisualEdgePainter ePainter)
public void emphasizeSubGraph(Graph subGraph, VisualVertexPainter mainGraphVPainter, VisualEdgePainter mainGraphEPainter, VisualVertexPainter subGraphVPainter, VisualEdgePainter subGraphEPainter)
Copyright © 2019 JULIE Lab, Germany. All rights reserved.