|
JGraph |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgraph.graph.AbstractCellView
org.jgraph.graph.EdgeView
The default implementation of an edge view. The getEdgeRenderer method assumes a renderer of type EdgeRenderer. If you provide a custom renderer to a subclass, you must also override the methods that call this method, namely: getShape, getLabelBounds, getExtraLabelBounds, intersects and getBounds.
Nested Class Summary | |
static class |
EdgeView.EdgeHandle
|
Field Summary | |
Shape |
beginShape
Drawing attributes that are created on the fly |
protected Rectangle2D |
cachedBounds
|
Shape |
endShape
Drawing attributes that are created on the fly |
protected Point2D[] |
extraLabelPositions
|
protected Point2D |
labelPosition
Cached label position of the edge. |
protected Point2D |
labelVector
|
static boolean |
LEGACY_DISCONNECTABLE
Whether or not pre 5.12.3.3 disconnectable behaviour is to be used. |
Shape |
lineShape
Drawing attributes that are created on the fly |
protected List |
points
List of points of the edge. |
static EdgeRenderer |
renderer
Renderer for the class. |
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
|
Fields inherited from class org.jgraph.graph.AbstractCellView |
allAttributes, attributes, cell, cellEditor, childViews, groupBounds, parent |
Constructor Summary | |
EdgeView()
Constructs an empty edge view. |
|
EdgeView(Object cell)
Constructs an edge view for the specified model object. |
Method Summary | |
void |
addExtraLabel(Point2D location,
Object label)
Adds an extra label. |
void |
addPoint(int index,
Point2D p)
Adds p at position index . |
protected void |
checkDefaultLabelPosition()
Hook for subclassers to avoid default label positions. |
protected Point2D |
convertRelativeLabelPositionToAbsolute(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 Point2D |
getAbsoluteExtraLabelPosition(int index)
Returns the absolute position of the specified extra label |
protected Point2D |
getAbsoluteLabelPosition()
Returns the absolute position of the main label |
protected Point2D |
getAbsoluteLabelPositionFromRelative(Point2D geometry)
Converts relative label position to absolute and allows for any label offset. |
Rectangle2D |
getBounds()
Returns the location for this edgeview. |
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. |
Point2D |
getLabelPosition()
Returns a point that describes the position of the label. |
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 Point2D |
getNearestPoint(boolean source)
Returns the nearest point wrt to the source or target. |
Point2D |
getPerimeterPoint(EdgeView edge,
Point2D source,
Point2D p)
Returns the intersection of the bounding rectangle and the straight line between the source and the specified point p. |
Point2D |
getPoint(int index)
Returns the cached points for this edge. |
int |
getPointCount()
Returns the number of point for this edge. |
protected Point2D |
getPointLocation(int index)
Returns the point of edge at index . |
List |
getPoints()
Returns the points. |
CellViewRenderer |
getRenderer()
Returns a renderer for the class. |
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,
Object port)
|
boolean |
intersects(JGraph graph,
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,
Point2D pos)
Sets the description of the label position. |
void |
setLabelPosition(Point2D pos)
Sets the description of the label position. |
void |
setPoint(int index,
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. |
Methods inherited from class org.jgraph.graph.AbstractCellView |
changeAttributes, childUpdated, createAttributeMap, getAllAttributes, getAttributes, getBounds, getCell, getCellAttributes, getCenterPoint, getChildViews, getDescendantViews, getEditor, getParentView, getRendererComponent, includeInGroupBounds, isLeaf, mergeAttributes, removeFromParent, scale, setAttributes, setBounds, setCell, translate, updateGroupBounds |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static transient EdgeRenderer renderer
protected List points
protected CellView source
protected CellView target
protected CellView sourceParentView
protected CellView targetParentView
protected Point2D labelPosition
protected Point2D[] extraLabelPositions
protected transient Point2D labelVector
public transient Shape beginShape
public transient Shape endShape
public transient Shape lineShape
public transient GeneralPath sharedPath
protected transient Rectangle2D cachedBounds
public static boolean LEGACY_DISCONNECTABLE
Constructor Detail |
public EdgeView()
public EdgeView(Object cell)
cell
- reference to the model objectMethod Detail |
public 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, Object port)
public void update(GraphLayoutCache cache)
update
in interface CellView
update
in class AbstractCellView
protected void checkDefaultLabelPosition()
protected void invalidate()
public Shape getShape()
public boolean intersects(JGraph graph, 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 for
public 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 Point2D getExtraLabelPosition(int index)
public Point2D getLabelPosition()
public void setLabelPosition(Point2D pos)
public void setExtraLabelPosition(int index, Point2D pos)
public boolean isLoop()
public List getPoints()
public int getPointCount()
public Point2D getPoint(int index)
protected Point2D getNearestPoint(boolean source)
protected Point2D getPointLocation(int index)
edge
at index
. Avoids
calling getLocation
on any ports of edge
.
public void setPoint(int index, Point2D p)
index
to p
.
public void addPoint(int index, Point2D p)
p
at position index
.
public void removePoint(int index)
index
.
public void addExtraLabel(Point2D location, Object label)
public void removeExtraLabel(int index)
index
.
public int getFirstPointOfSegment()
public Point2D getLabelVector()
protected Point2D getAbsoluteLabelPosition()
protected Point2D getAbsoluteExtraLabelPosition(int index)
index
- the index of the extra label
protected Point2D getAbsoluteLabelPositionFromRelative(Point2D geometry)
geometry
- the relative label position
protected Point2D convertRelativeLabelPositionToAbsolute(Point2D geometry)
geometry
- the relative label position
public static double getLength(CellView view)
public Point2D getPerimeterPoint(EdgeView edge, Point2D source, Point2D p)
AbstractCellView
getPerimeterPoint
in interface CellView
getPerimeterPoint
in class AbstractCellView
|
JGraph |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |