public class EdgeView extends AbstractCellView
Modifier and Type | Class and Description |
---|---|
static class |
EdgeView.EdgeHandle |
Modifier and Type | Field and Description |
---|---|
java.awt.Shape |
beginShape
Drawing attributes that are created on the fly
|
protected java.awt.geom.Rectangle2D |
cachedBounds |
java.awt.Shape |
endShape
Drawing attributes that are created on the fly
|
protected java.awt.geom.Point2D[] |
extraLabelPositions |
protected java.awt.geom.Point2D |
labelPosition
Cached label position of the edge.
|
protected java.awt.geom.Point2D |
labelVector |
static boolean |
LEGACY_DISCONNECTABLE
Whether or not pre 5.12.3.3 disconnectable behaviour is to be used.
|
java.awt.Shape |
lineShape
Drawing attributes that are created on the fly
|
protected java.util.List |
points
List of points of the edge.
|
static EdgeRenderer |
renderer
Renderer for the class.
|
java.awt.geom.GeneralPath |
sharedPath
Shared-path tune-up.
|
protected CellView |
source
Cached source and target portview of the edge.
|
protected CellView |
sourceParentView |
protected CellView |
target
Cached source and target portview of the edge.
|
protected CellView |
targetParentView |
allAttributes, attributes, cell, cellEditor, childViews, groupBounds, parent
Constructor and Description |
---|
EdgeView()
Constructs an empty edge view.
|
EdgeView(java.lang.Object cell)
Constructs an edge view for the specified model object.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtraLabel(java.awt.geom.Point2D location,
java.lang.Object label)
Adds an extra label.
|
void |
addPoint(int index,
java.awt.geom.Point2D p)
Adds
p at position index . |
protected void |
checkDefaultLabelPosition()
Hook for subclassers to avoid default label positions.
|
protected java.awt.geom.Point2D |
convertRelativeLabelPositionToAbsolute(java.awt.geom.Point2D geometry)
Converts an relative label position (x is distance along edge and y is
distance above/below edge vector) into an absolute co-ordination point
|
protected java.awt.geom.Point2D |
getAbsoluteExtraLabelPosition(int index)
Returns the absolute position of the specified extra label
|
protected java.awt.geom.Point2D |
getAbsoluteLabelPosition()
Returns the absolute position of the main label
|
protected java.awt.geom.Point2D |
getAbsoluteLabelPositionFromRelative(java.awt.geom.Point2D geometry)
Converts relative label position to absolute and allows for
any label offset.
|
java.awt.geom.Rectangle2D |
getBounds()
Returns the location for this edgeview.
|
java.awt.geom.Point2D |
getExtraLabelPosition(int index)
Returns a point that describes the position of the label.
|
int |
getFirstPointOfSegment()
Utility method that returns the first point of the pair that forms the
segment that is relativeX along the edge as a proportion
|
CellHandle |
getHandle(GraphContext context)
Returns a cell handle for the view.
|
java.awt.geom.Point2D |
getLabelPosition()
Returns a point that describes the position of the label.
|
java.awt.geom.Point2D |
getLabelVector()
Hook to return the vector that is taken as the base vector to compute
relative label positions.
|
static double |
getLength(CellView view) |
protected java.awt.geom.Point2D |
getNearestPoint(boolean source)
Returns the nearest point wrt to the source or target.
|
java.awt.geom.Point2D |
getPerimeterPoint(EdgeView edge,
java.awt.geom.Point2D source,
java.awt.geom.Point2D p)
Returns the intersection of the bounding rectangle and the straight line
between the source and the specified point p.
|
java.awt.geom.Point2D |
getPoint(int index)
Returns the cached points for this edge.
|
int |
getPointCount()
Returns the number of point for this edge.
|
protected java.awt.geom.Point2D |
getPointLocation(int index)
Returns the point of
edge at index . |
java.util.List |
getPoints()
Returns the points.
|
CellViewRenderer |
getRenderer()
Returns a renderer for the class.
|
java.awt.Shape |
getShape()
Returns the shape of the view according to the last rendering state
|
CellView |
getSource()
Returns the CellView that represents the source of the edge.
|
CellView |
getSourceParentView() |
CellView |
getTarget()
Returns the CellView that represents the target of the edge.
|
CellView |
getTargetParentView() |
protected CellView |
getVisibleParent(GraphModel model,
CellMapper mapper,
java.lang.Object port) |
boolean |
intersects(JGraph graph,
java.awt.geom.Rectangle2D rect)
Returns true if this view intersects the given rectangle.
|
protected void |
invalidate()
Resets the cached values of the edge view
|
boolean |
isLoop()
Returns true if the edge is a loop.
|
void |
refresh(GraphLayoutCache cache,
CellMapper mapper,
boolean createDependentViews)
Overrides the parent method to udpate the cached points, source and
target port.
|
void |
removeExtraLabel(int index)
Removes the point at position
index . |
void |
removePoint(int index)
Removes the point at position
index . |
void |
setExtraLabelPosition(int index,
java.awt.geom.Point2D pos)
Sets the description of the label position.
|
void |
setLabelPosition(java.awt.geom.Point2D pos)
Sets the description of the label position.
|
void |
setPoint(int index,
java.awt.geom.Point2D p)
Sets the point at
index to p . |
void |
setSource(CellView sourceView)
Sets the
sourceView of the edge. |
void |
setTarget(CellView targetView)
Sets the
targetView of the edge. |
void |
update(GraphLayoutCache cache)
Update attributes and recurse children.
|
changeAttributes, childUpdated, createAttributeMap, getAllAttributes, getAttributes, getBounds, getCell, getCellAttributes, getCenterPoint, getChildViews, getDescendantViews, getEditor, getParentView, getRendererComponent, includeInGroupBounds, isLeaf, mergeAttributes, removeFromParent, scale, setAttributes, setBounds, setCell, translate, updateGroupBounds
public static transient EdgeRenderer renderer
protected java.util.List points
protected CellView source
protected CellView target
protected CellView sourceParentView
protected CellView targetParentView
protected java.awt.geom.Point2D labelPosition
protected java.awt.geom.Point2D[] extraLabelPositions
protected transient java.awt.geom.Point2D labelVector
public transient java.awt.Shape beginShape
public transient java.awt.Shape endShape
public transient java.awt.Shape lineShape
public transient java.awt.geom.GeneralPath sharedPath
protected transient java.awt.geom.Rectangle2D cachedBounds
public static boolean LEGACY_DISCONNECTABLE
public EdgeView()
public EdgeView(java.lang.Object cell)
cell
- reference to the model objectpublic void refresh(GraphLayoutCache cache, CellMapper mapper, boolean createDependentViews)
refresh
in interface CellView
refresh
in class AbstractCellView
cache
- the graph model to be usedmapper
- the cell mapper to be usedcreateDependentViews
- whether or not to create a view if one does not already existprotected CellView getVisibleParent(GraphModel model, CellMapper mapper, java.lang.Object port)
public void update(GraphLayoutCache cache)
update
in interface CellView
update
in class AbstractCellView
cache
- TODOprotected void checkDefaultLabelPosition()
protected void invalidate()
public java.awt.Shape getShape()
public boolean intersects(JGraph graph, java.awt.geom.Rectangle2D rect)
intersects
in interface CellView
intersects
in class AbstractCellView
graph
- the JGraph
instance of the viewrect
- the rectangle within which intersection is being checked forpublic java.awt.geom.Rectangle2D getBounds()
getBounds
in interface CellView
getBounds
in class AbstractCellView
public CellViewRenderer getRenderer()
getRenderer
in class AbstractCellView
public CellHandle getHandle(GraphContext context)
getHandle
in interface CellView
getHandle
in class AbstractCellView
context
- the context of this cell view (cells indirectly affected by
it)public CellView getSource()
public CellView getSourceParentView()
public void setSource(CellView sourceView)
sourceView
of the edge.public CellView getTarget()
public CellView getTargetParentView()
public void setTarget(CellView targetView)
targetView
of the edge.public java.awt.geom.Point2D getExtraLabelPosition(int index)
public java.awt.geom.Point2D getLabelPosition()
public void setLabelPosition(java.awt.geom.Point2D pos)
public void setExtraLabelPosition(int index, java.awt.geom.Point2D pos)
public boolean isLoop()
public java.util.List getPoints()
public int getPointCount()
public java.awt.geom.Point2D getPoint(int index)
protected java.awt.geom.Point2D getNearestPoint(boolean source)
protected java.awt.geom.Point2D getPointLocation(int index)
edge
at index
. Avoids
calling getLocation
on any ports of edge
.
public void setPoint(int index, java.awt.geom.Point2D p)
index
to p
.public void addPoint(int index, java.awt.geom.Point2D p)
p
at position index
.public void removePoint(int index)
index
.public void addExtraLabel(java.awt.geom.Point2D location, java.lang.Object label)
public void removeExtraLabel(int index)
index
.public int getFirstPointOfSegment()
public java.awt.geom.Point2D getLabelVector()
protected java.awt.geom.Point2D getAbsoluteLabelPosition()
protected java.awt.geom.Point2D getAbsoluteExtraLabelPosition(int index)
index
- the index of the extra labelprotected java.awt.geom.Point2D getAbsoluteLabelPositionFromRelative(java.awt.geom.Point2D geometry)
geometry
- the relative label positionprotected java.awt.geom.Point2D convertRelativeLabelPositionToAbsolute(java.awt.geom.Point2D geometry)
geometry
- the relative label positionpublic static double getLength(CellView view)
public java.awt.geom.Point2D getPerimeterPoint(EdgeView edge, java.awt.geom.Point2D source, java.awt.geom.Point2D p)
AbstractCellView
getPerimeterPoint
in interface CellView
getPerimeterPoint
in class AbstractCellView
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.