|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.graph.AbstractGraphController
public abstract class AbstractGraphController
An abstract implementation of the GraphController interface. Concrete subclasses must implement the getNodeController() and getEdgeController() methods, to return the correct controller for a given node or edge.
Red |
Nested Class Summary | |
---|---|
private class |
AbstractGraphController.ChangeListener
This inner class responds to changes in the graph we are controlling. |
Field Summary | |
---|---|
private java.util.List |
_graphViewListenerList
The list of view listeners. |
private AbstractGraphController.ChangeListener |
_localListener
The listener of graph events. |
private java.util.HashMap |
_map
Map semantic objects to their figure representations |
private GraphModel |
_model
The graph that is being displayed. |
private GraphPane |
_pane
The graph pane that this is controlling. |
private SelectionModel |
_selectionModel
The default selection model |
Constructor Summary | |
---|---|
AbstractGraphController()
Construct a graph controller without a parent pane. |
Method Summary | |
---|---|
void |
addEdge(java.lang.Object edge,
java.lang.Object node,
int end,
double x,
double y)
Add an edge to this graph editor and render it from the given tail node to an autonomous site at the given location. |
void |
addEdge(java.lang.Object edge,
java.lang.Object tail,
java.lang.Object head)
Add an edge to this graph between the given tail and head nodes. |
void |
addGraphViewListener(GraphViewListener l)
|
void |
addNode(java.lang.Object node)
Add the node to this graph editor and place it wherever convenient. |
void |
addNode(java.lang.Object node,
double x,
double y)
Add the node to this graph editor and render it at the given location. |
void |
addNode(java.lang.Object node,
java.lang.Object parent)
Add the node to this graph editor, inside the given parent node at whatever position is convenient |
void |
addNode(java.lang.Object node,
java.lang.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 |
clear()
Remove all figures from the display |
void |
clearEdge(java.lang.Object edge)
Remove the figure for the given edge. |
void |
clearNode(java.lang.Object node)
Remove the figure for the given node. |
void |
dispatch(GraphViewEvent e)
Dispatch the given graph view event to all registered graph view listeners. |
Figure |
drawEdge(java.lang.Object edge)
Draw the given edge: create a figure, place it in the canvas, and associate the figure with the edge. |
Figure |
drawNode(java.lang.Object node)
Draw the given node: create a figure, place it in the canvas, and associate the figure with the node. |
Figure |
drawNode(java.lang.Object node,
java.lang.Object parent)
Draw the given node: create a figure, place it in the figure of the given parent node, and associate the figure with the node. |
abstract EdgeController |
getEdgeController(java.lang.Object edge)
Given an edge, return the controller associated with that edge. |
Figure |
getFigure(java.lang.Object semanticObj)
Return the figure associated with the given semantic object (node or edge), or null if there is no association. |
GraphModel |
getGraphModel()
Return the graph being viewed. |
GraphPane |
getGraphPane()
Return the graphics pane of this controller cast as a GraphPane. |
abstract NodeController |
getNodeController(java.lang.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(java.lang.Object edge)
Remove the given edge. |
void |
removeGraphViewListener(GraphViewListener l)
Remove the given view listener. |
void |
removeNode(java.lang.Object node)
Remove the given node. |
void |
rerender()
Render the current graph again by recreating the figures for all nodes and edges, but do not alter the connectivity in the graph. |
void |
rerenderEdge(java.lang.Object edge)
Rerender the given edge by replacing its figure with a new figure. |
void |
rerenderNode(java.lang.Object node)
Rerender the given node by replacing its figure with a new figure. |
void |
setFigure(java.lang.Object semanticObj,
Figure f)
Set the figure associated with the given semantic object (node or edge). |
void |
setGraphModel(GraphModel model)
Set the graph being viewed. |
void |
setGraphPane(GraphPane pane)
Set the graph pane. |
void |
setSelectionModel(SelectionModel m)
Set the default selection model. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.HashMap _map
private GraphPane _pane
private GraphModel _model
private SelectionModel _selectionModel
private AbstractGraphController.ChangeListener _localListener
private java.util.List _graphViewListenerList
Constructor Detail |
---|
public AbstractGraphController()
Method Detail |
---|
public void addEdge(java.lang.Object edge, java.lang.Object node, int end, double x, double y)
addEdge
in interface GraphController
GraphException
- If the connector target cannot return a
valid site on the node's figure.public void addEdge(java.lang.Object edge, java.lang.Object tail, java.lang.Object head)
addEdge
in interface GraphController
public void addGraphViewListener(GraphViewListener l)
addGraphViewListener
in interface GraphController
public void addNode(java.lang.Object node)
addNode
in interface GraphController
public void addNode(java.lang.Object node, double x, double y)
addNode
in interface GraphController
public void addNode(java.lang.Object node, java.lang.Object parent)
addNode
in interface GraphController
public void addNode(java.lang.Object node, java.lang.Object parent, double x, double y)
addNode
in interface GraphController
public void clear()
clear
in interface GraphController
public void clearEdge(java.lang.Object edge)
clearEdge
in interface GraphController
public void clearNode(java.lang.Object node)
clearNode
in interface GraphController
public Figure drawEdge(java.lang.Object edge)
drawEdge
in interface GraphController
public Figure drawNode(java.lang.Object node)
drawNode
in interface GraphController
public Figure drawNode(java.lang.Object node, java.lang.Object parent)
drawNode
in interface GraphController
public abstract EdgeController getEdgeController(java.lang.Object edge)
getEdgeController
in interface GraphController
public abstract NodeController getNodeController(java.lang.Object node)
getNodeController
in interface GraphController
public GraphModel getGraphModel()
getGraphModel
in interface GraphController
public GraphPane getGraphPane()
getGraphPane
in interface GraphController
public Figure getFigure(java.lang.Object semanticObj)
getFigure
in interface GraphController
public SelectionModel getSelectionModel()
getSelectionModel
in interface GraphController
public void removeEdge(java.lang.Object edge)
removeEdge
in interface GraphController
public void removeGraphViewListener(GraphViewListener l)
removeGraphViewListener
in interface GraphController
public void removeNode(java.lang.Object node)
removeNode
in interface GraphController
public void rerender()
rerender
in interface GraphController
public void rerenderEdge(java.lang.Object edge)
rerenderEdge
in interface GraphController
public void rerenderNode(java.lang.Object node)
rerenderNode
in interface GraphController
public void setGraphModel(GraphModel model)
setGraphModel
in interface GraphController
public void setFigure(java.lang.Object semanticObj, Figure f)
setFigure
in interface GraphController
public void setGraphPane(GraphPane pane)
setGraphPane
in interface GraphController
public void setSelectionModel(SelectionModel m)
setSelectionModel
in interface GraphController
public void dispatch(GraphViewEvent e)
dispatch
in interface GraphController
protected abstract void initializeInteraction()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |