|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.view.EdgeRealizer
Abstract graphical representation of an edge. This class provides
methods to draw an edge. For this to happen an edge must be bound
to the realizer. This can be done by calling
Graph2D.setRealizer(Edge,EdgeRealizer)
An edge realizer allows the use of control points, so called bends. These bends influence the graphical path of the edge.
Field Summary | |
protected BendList |
bends
The list where bends are stored. |
protected GeneralPath |
path
The graphical path of this realizer that will be drawn. |
Constructor Summary | |
EdgeRealizer()
Instantiates a new EdgeRealizer with default values. |
|
EdgeRealizer(EdgeRealizer argEdgeRealizer)
Instantiates a new EdgeRealizer as a copy of the given edge realizer. |
Method Summary | |
void |
addLabel(EdgeLabel label)
Adds the given edge label to this realizer. |
void |
addPoint(double x,
double y)
EdgeLayout interface implementation. |
Bend |
appendBend(double x,
double y)
Appends a newly created bend with location (x,y) to the list of bends. |
void |
bendChanged(Bend b,
double oldX,
double oldY)
Informs the edge, that a bend has changed position By default this method does nothing. |
int |
bendCount()
Returns the number of bends of this realizer. |
int |
bendPos(Bend b)
Returns the index of the bend in the bend sequence. |
BendCursor |
bends()
Returns a cursor over all bends of this realizer. |
protected void |
bindEdge(Edge e)
Binds an actual edge to this realizer. without a bound edge this realizer is NOT fully functional. |
protected abstract void |
calculatePath()
Calculates the visible path of this realizer. |
void |
calcUnionRect(Rectangle2D r)
Calculates the union of rectangle enclosed by this realizer and r. |
void |
clearBends()
Removes all bends from this realizer. |
void |
clearPoints()
EdgeLayout interface implementation. |
boolean |
contains(double x,
double y)
Query if the visible path of this realizer contains the point (x,y). |
int |
containsSeg(double dx,
double dy)
like contains(), but returns number of the hit segment, 0 otherwise. |
abstract Bend |
createBend(double x,
double y,
Bend refBend,
int dir)
Adds a new bend to the edge. |
EdgeRealizer |
createCopy()
Returns a copy of this realizer. |
abstract EdgeRealizer |
createCopy(EdgeRealizer er)
Get a copy of this realizer, with basic (EdgeRealizer) features adopted from er. |
EdgeLabel |
createEdgeLabel()
Creates a new edge label that can be added to this realizer. |
Bend |
firstBend()
Returns the first bend of the edge, null if the edge has none. |
Arrow |
getArrow()
Returns the arrow type at the target location of the edge path. |
Bend |
getBend(int index)
Returns the bend at the given positional index. |
Edge |
getEdge()
Returns the edge bound to this realizer. |
static Color |
getHighlightedBendColor()
Returns the color of all highlighed bends By default the color Color.green is returned. |
EdgeLabel |
getLabel()
Returns the first label associated with this realizer. |
EdgeLabel |
getLabel(int i)
Returns the i-th label of this realizer. |
String |
getLabelText()
Returns the text of the assiciated label of this realizer. |
byte |
getLayer()
Returns the logical graphical layer for this realizer. |
Color |
getLineColor()
Returns the line color of the edge path. |
LineType |
getLineType()
Returns the line type of the edge path. |
int |
getMinBendCount()
Returns the minimal number of bends the edge must have. |
GeneralPath |
getPath()
Returns the visible path of the edge as it will be drawn on a graphics context. |
YPoint |
getPoint(int index)
EdgeLayout interface implementation. |
static Color |
getSelectionColor()
Returns the color of all selected edges. |
static Stroke |
getSelectionStroke()
Returns the stroke of the selected edge. |
Arrow |
getSourceArrow()
Returns the arrow at the source location of the edge path. |
Point2D |
getSourceIntersection()
Returns the intersection point between this realizer and the source node realizer. |
YPoint |
getSourcePoint()
EdgeLayout interface implementation. |
Port |
getSourcePort()
Returns the source port of this edge realizer. |
NodeRealizer |
getSourceRealizer()
Returns the node realizer that is bound to the source node of the underlying edge. |
Arrow |
getTargetArrow()
Same as EdgeRealizer.getArrow() . |
Point2D |
getTargetIntersection()
Returns the intersection point between this realizer and the target node realizer. |
YPoint |
getTargetPoint()
EdgeLayout interface implementation. |
Port |
getTargetPort()
Returns the target port of this edge realizer. |
NodeRealizer |
getTargetRealizer()
Returns the node realizer that is bound to the target node of the underlying edge. |
abstract Bend |
insertBend(double x,
double y)
Adds a new bend to this realizer and returns it. |
boolean |
intersects(Rectangle2D box)
|
protected boolean |
isDirty()
Whether or not this realizer requires an update of it's graphical representation. |
boolean |
isSelected()
Returns the selected state of this realizer. |
boolean |
isVisible()
Returns the visibility state of this realizer. |
int |
labelCount()
Returns the number of labels associated with this realizer. |
Bend |
lastBend()
Returns the last bend of the edge, null if the edge has none. |
void |
paint(Graphics2D g)
Paints this realizer on the given graphics context. |
protected void |
paintArrows(Graphics2D g)
Paints the arrows of this realizer. |
protected void |
paintHighlightedBends(Graphics2D gfx)
Paints the bends if this realizer is in a selected state |
protected void |
paintLabels(Graphics2D gfx)
Paints the labels belonging to this realizer. |
protected void |
paintPorts(Graphics2D gfx)
Paints the ports of this realizer. |
void |
paintSloppy(Graphics2D g)
Paints this realizer in a quick and rather sloppy way. |
boolean |
pathIntersects(Rectangle2D box,
boolean considerLabels)
This method complements the EdgeRealizer.contains(double,double) method.
|
int |
pointCount()
EdgeLayout interface implementation. |
void |
read(ObjectInputStream in)
Reads in the serialized form of this realizer. |
protected void |
recalculateFeatures()
Recalculates all features. |
abstract void |
reInsertBend(Bend bend,
Bend refBend,
int dir)
Reinserts a bend to the edge which had been removed before. |
abstract Bend |
removeBend(Bend b)
Removes a Bend of this realizer. |
void |
removeLabel(EdgeLabel label)
Removes the given edge label from this realizer. |
void |
setArrow(Arrow arrow)
Sets the arrow type at the target location of the edge path. |
void |
setDirty()
Marks this realizer as dirty. |
static void |
setHighlightedBendColor(Color color)
Sets the color of all highlighed bends By default the color Color.green is set. |
void |
setLabelText(String label)
Sets the text of the associated label for this realizer. |
void |
setLayer(byte l)
Sets the logical graphical layer for this realizer. |
void |
setLineColor(Color c)
Sets the line color of the edge path. |
void |
setLineType(LineType t)
Sets the line type for the edge path. |
void |
setPoint(int index,
double x,
double y)
EdgeLayout interface implementation. |
void |
setPorts(Port sourceP,
Port targetP)
Sets the specified source- and target-port for this edge realizer. |
void |
setSelected(boolean s)
Sets the selected state of this realizer. |
static void |
setSelectionColor(Color color)
Sets the color of all selected edges. |
static void |
setSelectionStroke(LineType t)
Sets the stroke of a selected edges. |
void |
setSourceArrow(Arrow arrow)
Sets the arrow at the source location of the edge path. |
void |
setSourcePoint(YPoint point)
EdgeLayout interface implementation. |
void |
setSourcePort(Port p)
Sets the specified source port to this edge realizer. |
void |
setTargetArrow(Arrow arrow)
Same as EdgeRealizer.setArrow(Arrow) . |
void |
setTargetPoint(YPoint point)
EdgeLayout interface implementation. |
void |
setTargetPort(Port p)
Sets the specified target port to this edge realizer. |
void |
setVisible(boolean visible)
Sets the visiblility state of this realizer. |
void |
write(ObjectOutputStream out)
Writes out this realizer in a serialized form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected BendList bends
protected GeneralPath path
Constructor Detail |
public EdgeRealizer()
public EdgeRealizer(EdgeRealizer argEdgeRealizer)
Method Detail |
public EdgeRealizer createCopy()
public abstract EdgeRealizer createCopy(EdgeRealizer er)
protected void bindEdge(Edge e)
public NodeRealizer getTargetRealizer()
public NodeRealizer getSourceRealizer()
public Edge getEdge()
public void setPorts(Port sourceP, Port targetP)
public void setSourcePort(Port p)
public void setTargetPort(Port p)
public Port getSourcePort()
public Port getTargetPort()
public abstract Bend createBend(double x, double y, Bend refBend, int dir)
x
- X-coordinate of the Bendy
- Y-coordinate of the BendrefBend
- Bend which should be neighbourdir
- indicates if the new Bend should be added before
(Graph.BEFORE) or after (Graph.AFTER) the refBend in
the bend sequence of the edgepublic abstract void reInsertBend(Bend bend, Bend refBend, int dir)
bend
- the bend to be reinsertedrefBend
- reference bend already contained in this realizerdir
- indicates whether the bend should be inserted before or after the
reference bend.Allowed values are Graph.AFTER
and Graph.BEFORE
.public abstract Bend insertBend(double x, double y)
x
- X-coordinates of the bendy
- Y-coordinates of the bendpublic abstract Bend removeBend(Bend b)
b
- Bend to be removedpublic void bendChanged(Bend b, double oldX, double oldY)
b
- Bend which has changed positionoldX
- previous x-coordinateoldY
- previous y-coordinatepublic Bend appendBend(double x, double y)
x
- X-coordinates of bendy
- Y-coordinates of bendpublic int bendPos(Bend b)
b
- the bend in questionpublic int bendCount()
public Bend getBend(int index)
index
- position of the Bend in the bend sequencepublic BendCursor bends()
public Bend firstBend()
public Bend lastBend()
public int getMinBendCount()
public void clearBends()
public YPoint getPoint(int index)
getPoint
in interface EdgeLayout
index
- position of the control point in the control point sequence.
EdgeLayout.getPoint(int)
public int pointCount()
pointCount
in interface EdgeLayout
EdgeLayout.pointCount()
public YPoint getSourcePoint()
getSourcePoint
in interface EdgeLayout
EdgeLayout.getSourcePoint()
public YPoint getTargetPoint()
getTargetPoint
in interface EdgeLayout
EdgeLayout.getTargetPoint()
public void setSourcePoint(YPoint point)
setSourcePoint
in interface EdgeLayout
point
- the relative coordinates of the source point.EdgeLayout.setSourcePoint(YPoint)
public void setTargetPoint(YPoint point)
setTargetPoint
in interface EdgeLayout
point
- the relative coordinates of the source point.EdgeLayout.setTargetPoint(YPoint)
public void setPoint(int index, double x, double y)
setPoint
in interface EdgeLayout
index
- position of the control point in the control point sequence.x
- absolute x-coordinate of the control point at the given index.y
- absolute y-coordinate of the control point at the given index.EdgeLayout.setPoint(int,double,double)
public void addPoint(double x, double y)
addPoint
in interface EdgeLayout
x
- the absolute x-coordinate of the control point.y
- the absolute y-coordinate of the control point.EdgeLayout.addPoint(double,double)
public void clearPoints()
clearPoints
in interface EdgeLayout
EdgeLayout.clearPoints()
public void paintSloppy(Graphics2D g)
public void paint(Graphics2D g)
protected void paintHighlightedBends(Graphics2D gfx)
protected void paintPorts(Graphics2D gfx)
protected void paintArrows(Graphics2D g)
protected void paintLabels(Graphics2D gfx)
protected abstract void calculatePath()
EdgeRealizer.path
protected final void recalculateFeatures()
public Point2D getSourceIntersection()
public Point2D getTargetIntersection()
public Color getLineColor()
public void setLineColor(Color c)
public static void setSelectionColor(Color color)
public static void setHighlightedBendColor(Color color)
public static Color getHighlightedBendColor()
public static Color getSelectionColor()
public LineType getLineType()
public void setLineType(LineType t)
LineType.LINE_1
.
public static void setSelectionStroke(LineType t)
public static Stroke getSelectionStroke()
public Arrow getArrow()
public void setArrow(Arrow arrow)
Arrow.NONE
.
public Arrow getTargetArrow()
EdgeRealizer.getArrow()
.
public void setTargetArrow(Arrow arrow)
EdgeRealizer.setArrow(Arrow)
.
public Arrow getSourceArrow()
public void setSourceArrow(Arrow arrow)
Arrow.NONE
.
public void setLayer(byte l)
Graph2DView.FG_LAYER
,
Graph2DView.BG_LAYER
public byte getLayer()
Graph2DView.FG_LAYER
,
Graph2DView.BG_LAYER
public void setVisible(boolean visible)
public boolean isVisible()
public void setSelected(boolean s)
public boolean isSelected()
public void setDirty()
protected boolean isDirty()
public GeneralPath getPath()
public void addLabel(EdgeLabel label)
public void removeLabel(EdgeLabel label)
public EdgeLabel getLabel()
public int labelCount()
public EdgeLabel getLabel(int i)
public void setLabelText(String label)
public String getLabelText()
public EdgeLabel createEdgeLabel()
public boolean contains(double x, double y)
public int containsSeg(double dx, double dy)
public void calcUnionRect(Rectangle2D r)
public boolean pathIntersects(Rectangle2D box, boolean considerLabels)
EdgeRealizer.contains(double,double)
method.
Its primary use is for checking whether or not an edge lies within
the bounds of a selection box.
box
- the box that will be used for the intersectiontestconsiderLabels
- if true
, labels will be considered
public boolean intersects(Rectangle2D box)
public void write(ObjectOutputStream out) throws IOException
IOException
public void read(ObjectInputStream in) throws IOException, ClassNotFoundException
EdgeRealizer.write(ObjectOutputStream)
method.
IOException
ClassNotFoundException
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |