y.view
Class EdgeRealizer

java.lang.Object
  extended by y.view.EdgeRealizer
All Implemented Interfaces:
EdgeLayout
Direct Known Subclasses:
ArcEdgeRealizer, BezierEdgeRealizer, GenericEdgeRealizer, PolyLineEdgeRealizer, QuadCurveEdgeRealizer, SplineEdgeRealizer

public abstract class EdgeRealizer
extends Object
implements EdgeLayout

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.
static byte PATH_CLIPPED_AT_SOURCE
          Possible return value of calculatePath(java.awt.geom.Point2D,java.awt.geom.Point2D).
static byte PATH_CLIPPED_AT_SOURCE_AND_TARGET
          Possible return value of calculatePath(java.awt.geom.Point2D,java.awt.geom.Point2D).
static byte PATH_CLIPPED_AT_TARGET
          Possible return value of calculatePath(java.awt.geom.Point2D,java.awt.geom.Point2D).
static byte PATH_INVISBLE
          Possible return value of calculatePath(java.awt.geom.Point2D,java.awt.geom.Point2D).
static byte PATH_UNCLIPPED
          Possible return value of calculatePath(java.awt.geom.Point2D,java.awt.geom.Point2D).
 
Constructor Summary
protected EdgeRealizer()
          Instantiates a new EdgeRealizer with default values.
protected 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.
static byte calculateClippingAndIntersection(EdgeRealizer er, GeneralPath path, GeneralPath result, Point2D sourceIntersectionOut, Point2D targetIntersectionOut)
          Static helper method that can be used as a convenience to calculate a clipped version of a GeneralPath for an EdgeRealizer.
protected abstract  byte calculatePath(Point2D sourceIntersectionOut, Point2D targetIntersectionOut)
          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.
 double getArrowScaleFactor()
          Calculates and returns the scaling factor of the arrows using the currently set LineType.
 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 associated 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 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)
          Checks whether the given rectangle overlaps the edge.
protected  boolean isDirty()
          Whether or not this realizer requires an update of it's graphical representation.
 boolean isPathClippedAtSource()
          Returns whether the calculatePath(java.awt.geom.Point2D,java.awt.geom.Point2D) method indicated that the calculated path had been clipped at the source side of the path in order to account for the length of the source arrow.
 boolean isPathClippedAtTarget()
          Returns whether the calculatePath(java.awt.geom.Point2D,java.awt.geom.Point2D) method indicated that the calculated path had been clipped at the source side of the path in order to account for the length of the source arrow.
 boolean isReversedPathRenderingEnabled()
          Returns whether or not to render the path in reversed direction.
 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 gfx)
          Paints this realizer on the given graphics context.
protected  void paintArrows(Graphics2D g)
          Paints the arrows of this realizer.
protected  void paintBends(Graphics2D gfx)
          Paints the bends if they are in selected state.
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 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.
 void registerObstacles(BridgeCalculator calculator)
          This callback method is e.g. by DefaultGraph2DRenderer if a BridgeCalculator is used for the rendering whose crossing mode is set to values other than BridgeCalculator.CROSSING_MODE_ORDER_INDUCED.
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 repaint()
          Repaints 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 setReversedPathRenderingEnabled(boolean b)
          If enabled the visual path will be rendered from target to source end.
 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)
 &nb