public abstract class GraphController extends Object
Each instance of GraphController contains one or more instances of NodeController, and one or more instances of EdgeController. Simple graph editors only need one of each; more complex graph editors will need more than one of each. For example, a graph editor for hierarchical graphs might have two node controllers: one for top-level nodes, and one for child nodes.
Concrete subclasses must implement the following methods (which are abstract in this class):
In addition, subclasses will use the constructor to set up interaction on the canvas that the graph is being drawn on. The recommended structure of a subclass constructor is like this:
public MyGraphController (GraphicsPane pane, GraphModel model) { setGraphicsPane(pane); setGraphModel(model); ... initialize all interaction ... }
GraphController is intended to be the primary access point for programmatic control of a graph editor. Many of its methods simply delegate to a NodeController or EdgeController. In these cases the documentation in this class is minimal and there is a reference to the fully documented method in the relevant class.
Constructor and Description |
---|
GraphController() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(Object edge,
Object parent)
Add an edge to the model and render it on the canvas.
|
void |
addEdge(Object edge,
Object parent,
Object tail,
Object head)
Add an edge to the model and render it on the canvas.
|
void |
addGraphViewListener(GraphViewListener l) |
void |
addNode(Object node,
double x,
double y)
Add the node to this graph editor and render it
at the given location.
|
void |
addNode(Object node,
Object parent,
double x,
double y)
Add the node to this graph editor, inside the given parent node
and render it at the given location relative to its parent.
|
void |
dispatch(GraphViewEvent e)
Dispatch the given graph view event to all registered grpah view
listeners.
|
abstract EdgeController |
getEdgeController(Object edge)
Given an edge, return the controller associated with that
edge.
|
GraphicsPane |
getGraphicsPane()
Return the graphics pane of this controller
|
GraphModel |
getGraphModel()
Return the graph being viewed.
|
abstract NodeController |
getNodeController(Object node)
Given an node, return the controller associated with that
node.
|
SelectionModel |
getSelectionModel()
Get the default selection model
|
protected abstract void |
initializeInteraction()
Initialize all interaction on the graph pane.
|
void |
removeEdge(Object edge)
Register a graph controller with its canvas pane.
|
void |
removeGraphViewListener(GraphViewListener l)
Remove the given view listener.
|
void |
removeNode(Object node)
Remove the given node.
|
void |
render()
Render the complete graph.
|
void |
rerender()
Re-render the complete graph.
|
void |
rerenderSubGraph(Iterator elements)
Rerender a subgraph.
|
protected void |
setGraphicsPane(GraphicsPane pane)
Set the graphics pane that the controller operates on.
|
protected void |
setGraphModel(GraphModel model)
Set the graph model being viewed.
|
void |
setHead(Object edge,
Object head)
Set the head of the edge to the given node.
|
void |
setSelectionModel(SelectionModel m)
Set the default selection model.
|
void |
setTail(Object edge,
Object tail)
Set the tail of the edge to the given node.
|
public void addEdge(Object edge, Object parent)
EdgeController.addEdge(Object, Object)
public void addEdge(Object edge, Object parent, Object tail, Object head)
public void addGraphViewListener(GraphViewListener l)
public void addNode(Object node, double x, double y)
public void addNode(Object node, Object parent, double x, double y)
public abstract EdgeController getEdgeController(Object edge)
public abstract NodeController getNodeController(Object node)
public GraphModel getGraphModel()
public GraphicsPane getGraphicsPane()
public SelectionModel getSelectionModel()
public void removeEdge(Object edge)
public void removeGraphViewListener(GraphViewListener l)
public void removeNode(Object node)
NodeController.removeNode(Object)
public void render()
public void rerender()
public void rerenderSubGraph(Iterator elements)
protected final void setGraphModel(GraphModel model)
protected final void setGraphicsPane(GraphicsPane pane)
public void setHead(Object edge, Object head)
EdgeController.setHead(Object, Object)
public void setSelectionModel(SelectionModel m)
public void setTail(Object edge, Object tail)
EdgeController.setTail(Object, Object)
public void dispatch(GraphViewEvent e)
protected abstract void initializeInteraction()
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.