|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.base.Graph
y.layout.LayoutGraph
y.view.Graph2D
public class Graph2D
This class represents a graph with additional 2D support.
It can be displayed within a Graph2DView.
The visual representation of nodes and edges are encapsulated in
so called realizer objects. A node in this graph has a
NodeRealizer object associated with it
and an edge in this graph has a EdgeRealizer object associated
with it.
setDefaultEdgeRealizer(EdgeRealizer) and
setDefaultNodeRealizer(NodeRealizer).
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Nested Class Summary | |
|---|---|
static interface |
Graph2D.BackupRealizersHandler
Implementations of this interface are responsible for backing up the node and edge realizer of a Graph2D. |
| Field Summary |
|---|
| Fields inherited from class y.base.Graph |
|---|
AFTER, BEFORE |
| Constructor Summary | |
|---|---|
Graph2D()
Constructs an empty Graph2D. |
|
Graph2D(Graph2D graph)
Copy constructor of Graph2D. |
|
Graph2D(Graph2D graph,
YCursor nodeSubset)
Creates a copy of the given subgraph. |
|
| Method Summary | |
|---|---|
void |
addDrawable(Drawable d)
Adds a drawable to this graph. |
void |
addGraph2DListener(Graph2DListener listener)
Adds the given Graph2DListener to this graph. |
void |
addGraph2DSelectionListener(Graph2DSelectionListener listener)
Adds the given Graph2DSelectionListener to this graph. |
void |
backupRealizers()
A method that supports undoability of the changes performed on node and edge realizers. |
void |
backupRealizers(EdgeCursor ec)
A method that supports undoability of the changes performed on the edge realizers associated with the given edges. |
void |
backupRealizers(NodeCursor nc)
A method that supports undoability of the changes performed on the node realizers associated with the given nodes. |
BendCursor |
bends()
Returns a bend cursor over all bends in this graph. |
void |
changeEdge(Edge e,
Node newSource,
Edge sourceReference,
int sourceD,
Node newTarget,
Edge targetReference,
int targetD)
Redefines an edge's end points and fires corresponding notification events to inform registered listeners. |
void |
changeEdge(Edge e,
Node newSource,
Node newTarget)
Redefines an edge's end points and fires corresponding notification events to inform registered listeners. |
Graph |
createCopy()
Creates a copy of this graph. |
Edge |
createEdge(Node v,
Edge e1,
Node w,
Edge e2,
int d1,
int d2)
Creates a new edge in this graph. |
Edge |
createEdge(Node v,
Edge e1,
Node w,
Edge e2,
int d1,
int d2,
EdgeRealizer r)
Creates a new edge with given realizer in this graph. |
Edge |
createEdge(Node v,
Node w)
Creates a new edge from node v to node w. |
Edge |
createEdge(Node v,
Node w,
EdgeRealizer r)
Creates a new edge in this graph. |
Graph |
createGraph()
Creates an empty view of the same type as this graph. |
protected GraphCopier.CopyFactory |
createGraphCopyFactory()
Creates and returns a new instance of Graph2DCopyFactory.HierarchicGraph2DCopyFactory |
Node |
createNode()
Creates a new node. |
Node |
createNode(double x,
double y)
Creates a new node with center location (x,y). |
Node |
createNode(double x,
double y,
double w,
double h,
String label)
Creates a new node with center location (x,y), dimension
(w,h) and given label text. |
Node |
createNode(double x,
double y,
String label)
Creates a new node with center location (x,y) and
given label text. |
Node |
createNode(NodeRealizer r)
Creates a new node in this graph. |
YCursor |
drawables()
Returns a cursor iterating over all Drawables known to this graph. |
void |
fireGraph2DEvent(Object subject,
String name,
Object oldValue,
Object newValue)
Fires a Graph2DEvent |
void |
fireGraph2DSelectionEvent(Object subject)
Fires a GraphSelectionEvent for the given subject |
void |
fitGraph2DView()
Invokes fitContent() on the current view,
if the current view is of type Graph2DView. |
Graph2D.BackupRealizersHandler |
getBackupRealizersHandler()
Returns the handler for backupRealizer method calls. |
Rectangle |
getBoundingBox()
Returns the bounding box of this graph. |
Rectangle |
getBoundingBox(byte layer)
Returns the bounding box of all graph objects residing in the specified layer. |
double |
getCenterX(Node v)
Returns the center x-coord of the given node. |
double |
getCenterY(Node v)
Returns the center y-coord of the given node. |
View |
getCurrentView()
Returns the current view. |
EdgeRealizer |
getDefaultEdgeRealizer()
Returns the default edge realizer that will be bound to newly created edges. |
NodeRealizer |
getDefaultNodeRealizer()
Returns the default node realizer that will be bound to newly created nodes. |
Edge |
getFeature(EdgeLabelLayout labelLayout)
Returns the node which is described by a given label layout. |
Node |
getFeature(NodeLabelLayout labelLayout)
Returns the node which is described by a given label layout. |
Iterator |
getGraph2DListeners()
Returns an iterator that grants access to all registered Graph2DListeners |
Iterator |
getGraph2DSelectionListeners()
Returns an iterator that grants access to all registered Graph2DSelectionListeners |
double |
getHeight(Node v)
Returns the height of the given node. |
HierarchyManager |
getHierarchyManager()
Returns the HierarchyManager instance that manages this graph, or null if the graph is not part of any graph hierarchy. |
HitInfo |
getHitInfo(double x,
double y)
Returns hit info containing only the first hit object that was found. |
HitInfo |
getHitInfo(double x,
double y,
boolean firstHitOnly)
Returns objects that are hit on position (x,y). |
EdgeLabelLayout[] |
getLabelLayout(Edge edge)
Returns EdgeLabelLayout objects
which describe the layouts
of the labels that belong to the given edge. |
NodeLabelLayout[] |
getLabelLayout(Node node)
Returns NodeLabelLayout objects
which describe the layouts
of the labels that belong to the given node. |
String |
getLabelText(Edge e)
Returns the label text for the given edge. |
String |
getLabelText(Node v)
Returns the label text for the given node. |
EdgeLayout |
getLayout(Edge edge)
Returns the layout information for an edge in the drawing. |
NodeLayout |
getLayout(Node node)
Returns the layout information for a node in the drawing. |
EdgeRealizer |
getRealizer(Edge e)
Returns the EdgeRealizer bound to the given edge. |
NodeRealizer |
getRealizer(Node v)
Returns the NodeRealizer bound to the given node. |
URL |
getURL()
Returns the URL associatioed with this graph. |
YCursor |
getViews()
Returns a cursor iterating through all registered views. |
double |
getWidth(Node v)
Returns the width of the given node. |
double |
getX(Node v)
Returns the upper left x-coord of the given node. |
double |
getY(Node v)
Returns the upper left y-coord of the given node. |
boolean |
isSelected(Edge e)
Returns the selection state of the given edge. |
boolean |
isSelected(Node v)
Returns the selection state of the given node. |
boolean |
isSelectionEmpty()
Returns true iff neither edge nor node nor bend in this
graph is selected. |
boolean |
isSelectionSingleton()
Returns true if and only if exactly one object is selected. |
void |
moveBends(BendCursor bc,
double dx,
double dy)
Moves the given bends by (dx,dy). |
void |
moveNodes(NodeCursor nc,
double dx,
double dy)
Moves the given nodes by (dx,dy). |
void |
registerView(View v)
Adds this view to the set of views that display this graph. |
void |
removeDrawable(Drawable d)
Removes the given drawable from this graph. |
void |
removeGraph2DListener(Graph2DListener listener)
Removes the given Graph2DListener from this graph. |
void |
removeGraph2DSelectionListener(Graph2DSelectionListener listener)
Removes the given Graph2DSelectionListener from this graph. |
void |
removeSelection()
Removes all selected objects from this graph. |
void |
removeView(View v)
Removes this view from the set of views that display this graph. |
void |
selectAllNodesAndBends(boolean s)
Sets the selection state for all nodes and bends. |
void |
selectBoxContent(double x,
double y,
double width,
double height)
Selects the graph objects in a rectangle defined by the given arguments. |
void |
selectBoxContent(Rectangle r)
Selects the graph objects in given rectangle. |
BendCursor |
selectedBends()
Returns a bend cursor for all momentarily selected bends in this graph. |
EdgeCursor |
selectedEdges()
Returns an edge cursor for all momentarily selected edges in this graph. |
NodeCursor |
selectedNodes()
Returns a node cursor for all momentarily selected nodes in this graph. |
void |
setBackupRealizersHandler(Graph2D.BackupRealizersHandler brh)
Sets the delegate class that is responsible for acting upon calls to the methods backupRealizers(EdgeCursor) and
backupRealizers(NodeCursor). |