|
Search this API | ||||||||
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 | |
---|---|
static int |
REVERSE_ALL
Feature flag for adjusting all visual features when reversing an edge. |
static int |
REVERSE_ARROWS
Feature flag for reversing arrows after reversing an edge. |
static int |
REVERSE_EDGE_LABELS
Feature flag for adjusting edge label model parameters after reversing an edge. |
static int |
REVERSE_NODE_PORTS
Feature flag for reversing node port bindings after reversing an edge. |
static int |
REVERSE_NONE
Feature flag for adjusting no visual features when reversing an edge. |
static int |
REVERSE_PATH
Feature flag for reversing the geometry of an edge path after reversing an edge. |
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 to be ordered before or after a given edge. |
Edge |
createEdge(Node v,
Edge e1,
Node w,
Edge e2,
int d1,
int d2,
EdgeRealizer r)
Creates a new edge in this graph that is bound to the given edge realizer and ordered before or after a given edge. |
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 from node v to node w . |
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 |
protected LabelLayoutFactory |
createLabelFactory()
Creates a new label layout factory for this graph. |
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,
java.lang.String label)
Creates a new node with center location (x,y) ,
dimension (w,h) and the given label text. |
Node |
createNode(double x,
double y,
java.lang.String label)
Creates a new node with center location (x,y) and
the 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(java.lang.Object subject,
java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a Graph2DEvent |
void |
fireGraph2DSelectionEvent(java.lang.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. |
java.awt.Rectangle |
getBoundingBox()
Returns the bounding box of this graph. |
java.awt.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-coordinate of the given node. |
double |
getCenterY(Node v)
Returns the center y-coordinate of the given node. |
View |
getCurrentView()
Returns the current view. |
EdgeRealizer |
getDefaultEdgeRealizer()
Returns the default edge realizer. |
NodeRealizer |
getDefaultNodeRealizer()
Returns the default node realizer. |
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. |
java.util.Iterator |
getGraph2DListeners()
Returns an iterator that grants access to all registered Graph2DListeners |
java.util.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)
Deprecated. Use HitInfo 's various constructors directly
for control over the hit test order. |
HitInfo |
getHitInfo(double x,
double y,
boolean firstHitOnly)
Deprecated. Use HitInfo 's various constructors directly
for control over the hit test order. |
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. |
java.lang.String |
getLabelText(Edge e)
Returns the label text for the given edge. |
java.lang.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 edge realizer that is bound to the given edge. |
NodeRealizer |
getRealizer(Node v)
Returns the node realizer that is bound to the given node. |
java.net.URL |
getURL()
Returns the URL associated 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-coordinate of the given node. |
double |
getY(Node v)
Returns the upper left y-coordinate of the given node. |
boolean |
isSelected(Bend bend)
Returns the selection state of the given bend. |
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 |
isSelected(NodePort port)
Returns the selection state of the given node port. |
boolean |
isSelected(YLabel label)
Returns the selection state of the given label. |
boolean |
isSelectionEmpty()
Returns true iff neither edges nor nodes nor bends nor labels
nor node ports in this graph are selected. |
boolean |
isSelectionSingleton()
Returns true if and only if exactly one node or one bend is
selected and false otherwise. |
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 |
reverseEdge(Edge edge,
int featureMask)
Reverses the given edge and adjusts its geometry and visual features accordingly. |
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(java.awt.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. |
YCursor |
selectedLabels()
Returns a YCursor for all momentarily selected labels 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) . |
void |
setBendsSelected(BendCursor bc,
boolean s)
Sets the selection state for the given bends. |
void |
setBendsSelected(Edge e,
boolean s)
Sets the selection state for the bends given by the edge. |
void |
setBendsSelected(EdgeCursor ec,
boolean s)
Sets the selection state for the bends given by the edges. |
void |
setCenter(Node v,
double x,
double y)
Sets the center coordinates of the given node. |
void |
setCurrentView(View view)
Sets the current view. |
void |
setDefaultEdgeRealizer(EdgeRealizer r)
Sets the default edge realizer. |
void |
setDefaultNodeRealizer(NodeRealizer r)
Sets the default node realizer. |
void |
setHierarchyManager(HierarchyManager hierarchyManager)
Sets the HierarchyManager instance that manages this graph. |
void |
setLabelText(Edge e,
java.lang.String text)
Sets the given label text for the given edge. |
void |
setLabelText(Node v,
java.lang.String text)
Sets the given label text for the given node. |
void |
setLayerAll(byte layer)
Sets the layer for all bound node and edge realizers of this graph. |
java.awt.Rectangle |
setLocation(double x,
double y)
Moves the entire graph to some location. |
void |
setLocation(Node v,
double x,
double y)
Sets the upper left coordinates of the given node. |
void |
setRealizer(Edge e,
EdgeRealizer r)
Sets the edge realizer for the given edge. |
void |
setRealizer(Node v,
NodeRealizer r)
Sets the node realizer for the given node. |
void |
setSelected(Bend bend,
boolean s)
Sets the selected state for the given bend. |
void |
setSelected(Edge e,
boolean s)
Sets the selected state for the given edge. |
void |
setSelected(EdgeCursor edges,
boolean s)
Sets the selection state for the given edges. |
void |
setSelected(Node v,
boolean s)
Sets the selection state for the given node. |
void |
setSelected(NodeCursor nodes,
boolean s)
Sets the selection state for the given nodes. |
void |
setSelected(NodePort port,
boolean s)
Sets the selected state for the given node port. |
void |
setSelected(YLabel label,
boolean s)
Sets the selected state for the given label. |
void |
setSize(Node v,
double w,
double h)
Sets the size of the given node. |
void |
setURL(java.net.URL url)
Sets the URL of this Graph2D. |
void |
unselectAll()
Deselects all nodes, edges, bends, labels, and node ports in this graph. |
void |
unselectBends()
Deselects all bends in this graph. |
void |
unselectEdges()
Deselects all edges in this graph. |
void |
unselectLabels()
Deselects all labels in this graph. |
void |
unselectNodePorts()
Deselects all node ports in this graph. |
void |
unselectNodes()
Deselects all nodes in this graph. |
void |
updateViews()
Calls updateView on all registered views. |
void |
updateViews(double x,
double y,
double w,
double h)
Calls View.updateView(double, double, double, double) on all registered views. |
Methods inherited from class y.layout.LayoutGraph |
---|
getCenter, getEdgeLabelLayout, getEdgeLayout, getEdgeList, getLocation, getNodeLabelLayout, getNodeLayout, getPath, getPathList, getPointList, getPoints, getRectangle, getSize, getSourcePointAbs, getSourcePointRel, getTargetPointAbs, getTargetPointRel, moveBy, setCenter, setEndPointsAbs, setLocation, setPath, setPath, setPoints, setPoints, setSize, setSourcePointAbs, setSourcePointRel, setTargetPointAbs, setTargetPointRel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int REVERSE_NONE
reverseEdge(y.base.Edge, int)
,
Constant Field Valuespublic static final int REVERSE_PATH
reverseEdge(y.base.Edge, int)
,
Constant Field Valuespublic static final int REVERSE_EDGE_LABELS
reverseEdge(y.base.Edge, int)
,
Constant Field Valuespublic static final int REVERSE_NODE_PORTS
reverseEdge(y.base.Edge, int)
,
Constant Field Valuespublic static final int REVERSE_ARROWS
reverseEdge(y.base.Edge, int)
,
Constant Field Valuespublic static final int REVERSE_ALL
reverseEdge(y.base.Edge, int)
,
Constant Field ValuesConstructor Detail |
---|
public Graph2D()
public Graph2D(Graph2D graph)
public Graph2D(Graph2D graph, YCursor nodeSubset)
Method Detail |
---|
protected GraphCopier.CopyFactory createGraphCopyFactory()
Graph2DCopyFactory.HierarchicGraph2DCopyFactory
createGraphCopyFactory
in class LayoutGraph
public Graph createCopy()
Graph2D
.
createCopy
in class Graph
public Graph createGraph()
Graph2D
.
createGraph
in class Graph
Graph2D
.public void changeEdge(Edge e, Node newSource, Edge sourceReference, int sourceD, Node newTarget, Edge targetReference, int targetD)
Graph
e
has
source node v := sourceReference.source()
or v := newSource
,
if sourceReference == null
and
target node w := targetReference.target()
or w := newTarget
,
if targetReference == null
.
e
is inserted in such a way that an iteration over the edges
at v
returns e
sourceReference
, if sourceD == AFTER
sourceReference
, if sourceD == BEFORE
,
w
returns e
targetReference
, if targetD == AFTER
targetReference
, if targetD == BEFORE
.
changeEdge
in class Graph
e
- The edge to be changed.newSource
- The new source node.sourceReference
- Reference edge for insertion at the new source node.sourceD
- One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.newTarget
- The new target node.targetReference
- Reference edge for insertion at the new target node.targetD
- One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.public void changeEdge(Edge e, Node newSource, Node newTarget)
Graph
changeEdge
in class Graph
e
- The edge to be changed.newSource
- The new source node of the given edge.newTarget
- The new target node of the given edge.public void reverseEdge(Edge edge, int featureMask)
Note, if REVERSE_NODE_PORTS
is not set, this method
explicitly removes current node port bindings .
Note, this method constitutes both a structural and a visual change.
This means client code needs to explicitly call
Graph.firePreEvent()
and backupRealizers(y.base.EdgeCursor)
before and Graph.firePostEvent()
after reversing edges to properly
support undo/redo.
Calls Graph.reverseEdge(y.base.Edge)
for the required structural
reversal of the given edge. This means that the former method's
GraphEvent.POST_EDGE_CHANGE
event is fired before any visual
adjustments are applied by this method.
edge
- the edge to reverse.featureMask
- a bit wise combination of the feature flags
that specifies the visual features to adjust.Graph.reverseEdge(y.base.Edge)
,
REVERSE_NONE
,
REVERSE_PATH
,
REVERSE_EDGE_LABELS
,
REVERSE_NODE_PORTS
,
REVERSE_ARROWS
,
REVERSE_ALL
public void setHierarchyManager(HierarchyManager hierarchyManager)
public HierarchyManager getHierarchyManager()
null
if the graph is not part of any graph hierarchy.
public Edge createEdge(Node v, Node w)
v
to node w
.
A copy of the default edge realizer will be bound to the newly created edge.
createEdge
in class Graph
v
- The source node of the edge.w
- The target node of the edge.
createEdge(y.base.Node, y.base.Node, EdgeRealizer)
,
getDefaultEdgeRealizer()
public Edge createEdge(Node v, Node w, EdgeRealizer r)
v
to node w
.
The given edge realizer will be bound to the new edge.
v
- the source node of the edgew
- the target node of the edger
- the edge realizer that will be bound to the new edge.
public Edge createEdge(Node v, Edge e1, Node w, Edge e2, int d1, int d2)
e
has source node v
and target node
w
, i.e., e = (v, w)
.
The new edge e
is inserted in such a way that an iteration
over the edges at node v
returns e
e1
, if d1 == AFTER
e1
, if d1 == BEFORE
,
w
returns e
e2
, if d2 == AFTER
e2
, if d2 == BEFORE
.
A copy of the default edge realizer will be bound to the newly created edge.
createEdge
in class Graph
e1
must have source node v
and
edge e2
must have target node w
.v
- The source node of the edge.e1
- An edge with source node v
.w
- The target node of the edge.e2
- An edge with target node w
.d1
- One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.d2
- One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.
createEdge(y.base.Node, y.base.Edge, y.base.Node, y.base.Edge, int, int, EdgeRealizer)
,
getDefaultEdgeRealizer()
public Edge createEdge(Node v, Edge e1, Node w, Edge e2, int d1, int d2, EdgeRealizer r)
e
has source node v
and target node
w
, i.e., e = (v, w)
.
The new edge e
is inserted in such a way that an iteration
over the edges at node v
returns e
e1
, if d1 == AFTER
e1
, if d1 == BEFORE
,
w
returns e
e2
, if d2 == AFTER
e2
, if d2 == BEFORE
.
All other edge creation methods of this graph will eventually call this method.
e1
must have source node v
and
edge e2
must have target node w
.v
- The source node of the edge.e1
- An edge with source node v
.w
- The target node of the edge.e2
- An edge with target node w
.d1
- One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.d2
- One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.r
- The edge realizer that will be bound to the new edge.
public Node createNode()
A copy of the default node realizer will be bound to the new node.
createNode
in class Graph
createNode(NodeRealizer)
,
getDefaultNodeRealizer()
public Node createNode(double x, double y)
(x,y)
.
The default node realizer defines all other properties of this
node.
x
- the X-coordinate of the node's center.y
- the Y-coordinate of the node's center.
createNode(NodeRealizer)
,
getDefaultNodeRealizer()
public Node createNode(double x, double y, java.lang.String label)
(x,y)
and
the given label text.
The default node realizer defines all other properties of this
node.
x
- the X-coordinate of the node's center.y
- the Y-coordinate of the node's center.label
- the node's initial label text.
createNode(NodeRealizer)
,
getDefaultNodeRealizer()
public Node createNode(double x, double y, double w, double h, java.lang.String label)
(x,y)
,
dimension (w,h)
and the given label text.
The default node realizer defines all other properties of this
node.
x
- the X-coordinate of the node's center.y
- the Y-coordinate of the node's center.w
- the width of the node.h
- the height of the node.label
- the node's initial label text.
createNode(NodeRealizer)
,
getDefaultNodeRealizer()
public Node createNode(NodeRealizer r)
r
- the node realizer that will be bound to the new node.
public java.awt.Rectangle getBoundingBox()
getBoundingBox
in interface GraphLayout
getBoundingBox
in class LayoutGraph
public java.awt.Rectangle getBoundingBox(byte layer)
public void setLayerAll(byte layer)
public java.awt.Rectangle setLocation(double x, double y)
public BendCursor bends()
public void setDefaultNodeRealizer(NodeRealizer r)
getDefaultNodeRealizer()
public void setDefaultEdgeRealizer(EdgeRealizer r)
getDefaultEdgeRealizer()
public NodeRealizer getDefaultNodeRealizer()
setDefaultNodeRealizer(NodeRealizer)
public EdgeRealizer getDefaultEdgeRealizer()
setDefaultEdgeRealizer(EdgeRealizer)
public NodeRealizer getRealizer(Node v)
setRealizer(y.base.Node, NodeRealizer)
public EdgeRealizer getRealizer(Edge e)
setRealizer(y.base.Edge, EdgeRealizer)
public void setRealizer(Node v, NodeRealizer r)
getRealizer(y.base.Node)
public void setRealizer(Edge e, EdgeRealizer r)
getRealizer(y.base.Edge)
public NodeLayout getLayout(Node node)
getLayout
in class LayoutGraph
node
- a node in the drawing.
node
.public EdgeLayout getLayout(Edge edge)
getLayout
in class LayoutGraph
edge
- a edge in the drawing.
edge
.public NodeLabelLayout[] getLabelLayout(Node node)
NodeLabelLayout
objects
which describe the layouts
of the labels that belong to the given node.
getLabelLayout
in class LayoutGraph
node
- a node in the drawing.
node
.public EdgeLabelLayout[] getLabelLayout(Edge edge)
EdgeLabelLayout
objects
which describe the layouts
of the labels that belong to the given edge.
getLabelLayout
in class LayoutGraph
edge
- an edge in the drawing.
edge
.public Node getFeature(NodeLabelLayout labelLayout)
getFeature
in class LayoutGraph
labelLayout
- the label's layout information
public Edge getFeature(EdgeLabelLayout labelLayout)
getFeature
in class LayoutGraph
labelLayout
- the label's layout information
public boolean isSelectionEmpty()
true
iff neither edges nor nodes nor bends nor labels
nor node ports in this graph are selected.
Calls isSelected(y.base.Edge)
, isSelected(y.base.Node)
,
isSelected(YLabel)
, or isSelected(Bend)
to determine
the selection state of an element.
public boolean isSelectionSingleton()
true
if and only if exactly one node or one bend is
selected and false
otherwise.
true
if and only if exactly one node or one bend is
selected and false
otherwise.public NodeCursor selectedNodes()
Calls isSelected(y.base.Node)
to determine the selection state
of a node.
public EdgeCursor selectedEdges()
Calls isSelected(y.base.Edge)
to determine the selection state
of an edge.
public YCursor selectedLabels()
YLabel
s.
Calls isSelected(YLabel)
to determine the selection state of
a label.
public BendCursor selectedBends()
Calls isSelected(Bend)
to determine the selection state of a bend.
public void unselectAll()
Calls setSelected(y.base.Node, boolean)
,
setSelected(y.base.Edge, boolean)
,
setSelected(YLabel, boolean)
, or
setSelected(Bend, boolean)
to change the selection state of
an element.
public void unselectNodes()
Calls setSelected(y.base.Node, boolean)
to change the selection
state of a node.
public void unselectEdges()
Calls setSelected(y.base.Edge, boolean)
to change the selection
state of a node.
public void unselectBends()
Calls setSelected(Bend, boolean)
to change the selection state
of a bend.
public void unselectLabels()
Calls setSelected(YLabel, boolean)
to change the selection state
of a label.
public void unselectNodePorts()
public void moveNodes(NodeCursor nc, double dx, double dy)
(dx,dy)
.
public void moveBends(BendCursor bc, double dx, double dy)
(dx,dy)
.
public void removeSelection()
Calls isSelected(y.base.Edge)
, isSelected(y.base.Node)
,
isSelected(YLabel)
, or isSelected(Bend)
to determine
the selection state of an element.
public void selectBoxContent(java.awt.Rectangle r)
public void selectBoxContent(double x, double y, double width, double height)
public HitInfo getHitInfo(double x, double y, boolean firstHitOnly)
HitInfo
's various constructors directly
for control over the hit test order.
firstHitOnly
- determines if search should be abandoned after
the first hit object was found.public HitInfo getHitInfo(double x, double y)
HitInfo
's various constructors directly
for control over the hit test order.
public void setLabelText(Node v, java.lang.String text)
public java.lang.String getLabelText(Node v)
public void setLabelText(Edge e, java.lang.String text)
public java.lang.String getLabelText(Edge e)
public void setSelected(Edge e, boolean s)
public void setSelected(YLabel label, boolean s)
public void setSelected(Bend bend, boolean s)
public void setSelected(NodePort port, boolean s)
public void setSelected(EdgeCursor edges, boolean s)
Calls setSelected(y.base.Edge, boolean)
to change the selection
state of an edge.
public void setSelected(Node v, boolean s)
public void setSelected(NodeCursor nodes, boolean s)
Calls setSelected(y.base.Node, boolean)
to change the selection
state of a node.
public void setBendsSelected(BendCursor bc, boolean s)
Calls setSelected(Bend, boolean)
to change the selection state
of a bend.
public void setBendsSelected(Edge e, boolean s)
public void setBendsSelected(EdgeCursor ec, boolean s)
public void selectAllNodesAndBends(boolean s)
public boolean isSelected(Edge e)
public boolean isSelected(YLabel label)
public boolean isSelected(Bend bend)
public boolean isSelected(NodePort port)
public boolean isSelected(Node v)
public double getCenterX(Node v)
getCenterX
in class LayoutGraph
v
- the node
getX(y.base.Node)
public double getCenterY(Node v)
getCenterY
in class LayoutGraph
v
- the node
getY(y.base.Node)
public double getX(Node v)
getX
in class LayoutGraph
v
- the node
getCenterX(y.base.Node)
public double getY(Node v)
getY
in class LayoutGraph
v
- the node
getCenterY(y.base.Node)
public double getWidth(Node v)
getWidth
in class LayoutGraph
v
- the node
NodeLayout.getWidth()
public double getHeight(Node v)
getHeight
in class LayoutGraph
v
- the node
NodeLayout.getHeight()
public void setCenter(Node v, double x, double y)
setCenter
in class LayoutGraph
v
- the nodex
- the new x-coordinate of the node's centery
- the new y-coordinate of the node's centersetLocation(y.base.Node, double, double)
public void setSize(Node v, double w, double h)
setSize
in class LayoutGraph
v
- the nodew
- the new width of the nodeh
- the new height of the nodeNodeLayout.setSize(double, double)
public void setLocation(Node v, double x, double y)
setLocation
in class LayoutGraph
v
- the nodex
- the new x-coordinate of the upper-left cornery
- the new y-coordinate of the upper-left cornersetCenter(y.base.Node, double, double)
public void setURL(java.net.URL url)
public java.net.URL getURL()
setURL(URL url)
public void addDrawable(Drawable d)
public YCursor drawables()
public void removeDrawable(Drawable d)
public YCursor getViews()
public View getCurrentView()
public void setCurrentView(View view)
public void registerView(View v)
public void removeView(View v)
public void updateViews()
updateView
on all registered views.
public void updateViews(double x, double y, double w, double h)
View.updateView(double, double, double, double)
on all registered views.
x
- the upper left corner of the rectangular area to be updated in world coordinatesy
- the upper left corner of the rectangular area to be updated in world coordinatesw
- the width of the rectangular area to be updated in world coordinatesh
- the height of the rectangular area to be updated in world coordinatesView.updateView(double, double, double, double)
public void fitGraph2DView()
fitContent()
on the current view,
if the current view is of type Graph2DView
.
Otherwise no action is performed.
public void setBackupRealizersHandler(Graph2D.BackupRealizersHandler brh)
backupRealizers(EdgeCursor)
and
backupRealizers(NodeCursor)
.
By default no such handler is set.
public Graph2D.BackupRealizersHandler getBackupRealizersHandler()
null
will be returned.
public void backupRealizers()
public void backupRealizers(EdgeCursor ec)
Graph2D.BackupRealizersHandler
that has been registered
to this graph.
setBackupRealizersHandler(y.view.Graph2D.BackupRealizersHandler)
public void backupRealizers(NodeCursor nc)
Graph2D.BackupRealizersHandler
that has been registered
to this graph.
setBackupRealizersHandler(y.view.Graph2D.BackupRealizersHandler)
public void addGraph2DSelectionListener(Graph2DSelectionListener listener)
public void removeGraph2DSelectionListener(Graph2DSelectionListener listener)
public java.util.Iterator getGraph2DSelectionListeners()
public void fireGraph2DSelectionEvent(java.lang.Object subject)
public void addGraph2DListener(Graph2DListener listener)
Subject type | Property name |
---|---|
NodeLabel | text |
EdgeLabel | text |
Node | realizer |
Edge | realizer |
public void removeGraph2DListener(Graph2DListener listener)
public java.util.Iterator getGraph2DListeners()
public void fireGraph2DEvent(java.lang.Object subject, java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
protected LabelLayoutFactory createLabelFactory()
Note that this method is for internal use only.
If you want to create, remove or add labels to your Graph2D
instance, please use the corresponding
methods of classes NodeRealizer
and EdgeRealizer
.
createLabelFactory
in class LayoutGraph
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |