uci.gef
Class FigEdge

java.lang.Object
  |
  +--uci.gef.Fig
        |
        +--uci.gef.FigEdge
Direct Known Subclasses:
FigEdgeLine, FigEdgePoly, FigEdgeRectiline

public abstract class FigEdge
extends Fig
implements PropertyChangeListener, Highlightable

Abastract Fig class for representing edges between ports.

See Also:
FigEdgeLine, FigEdgeRectiline, Serialized Form

Inner Class Summary
protected  class FigEdge.PathItem
           
 
Field Summary
protected  ArrowHead _arrowHeadEnd
          The ArrowHead at the end of the line
protected  ArrowHead _arrowHeadStart
          The ArrowHead at the start of the line
protected  FigNode _destFigNode
          FigNode presenting the edge's to-port's parent node.
protected  Fig _destPortFig
          Fig presenting the edge's to-port.
protected  Fig _fig
          Fig that presents the edge.
protected  boolean _highlight
          True when the FigEdgde should be drawn highlighted.
protected  Vector _pathItems
          The items that are accumulated along the path, a vector.
protected  FigNode _sourceFigNode
          FigNode presenting the edge's from-port's parent node.
protected  Fig _sourcePortFig
          Fig presenting the edge's from-port .
protected  boolean _useNearest
          True if the FigEdge should be drawn from the nearest point of each port Fig.
 
Fields inherited from class uci.gef.Fig
_dashes, _fillColor, _filled, _group, _h, _layer, _lineColor, _lineWidth, _locked, _w, _x, _y, BORDER, DASH_ARRAYS, DASHED_CHOICES, MIN_SIZE
 
Constructor Summary
FigEdge()
          Contruct a new FigEdge without any underlying edge.
FigEdge(Fig s, Fig d, FigNode sfn, FigNode dfn, Object edge)
          Contruct a new FigEdge with the given source and destination port figs and FigNodes.
 
Method Summary
 void addPathItem(Fig newFig, PathConv newPath)
          Add a new path item to this FigEdge.
 void calcBounds()
          Update my bounding box
 void cleanUp()
           
protected  void computeRoute()
          Method to compute the route a FigEdge should follow.
 boolean contains(int x, int y)
           
 void delete()
           
 boolean getBetweenNearestPoints()
          Get and set the flag about using Fig connection points rather than centers.
 Rectangle getBounds()
          Reply the bounding box for this FigEdge.
 boolean getDashed()
           
 ArrowHead getDestArrowHead()
          Get the ArrowHead at the end of this FigEdge.
 Fig getDestFigNode()
           
 Fig getDestPortFig()
           
 Fig getFig()
          Return the Fig that will be drawn.
 Point getFirstPoint()
           
 boolean getHighlight()
           
 Point getLastPoint()
           
 Color getLineColor()
           
 int getLineWidth()
           
 int getNumPoints()
           
 Fig getPathItem(PathConv pointOnPath)
          Return the path item on this FigEdge closest to the given location.
 Vector getPathItemsRaw()
          Return the vector of path items on this FigEdge.
 int getPerimeterLength()
           
 Point[] getPoints()
           
 Point getPoints(int i)
           
 ArrowHead getSourceArrowHead()
          Get the ArrowHead at the start of this FigEdge.
 Fig getSourceFigNode()
           
 Fig getSourcePortFig()
           
 int[] getXs()
           
 int[] getYs()
           
 boolean hit(Rectangle r)
           
 Fig hitFig(Rectangle r)
           
 boolean intersects(Rectangle r)
           
 boolean isReshapable()
           
 boolean isResizable()
           
 boolean isRotatable()
           
protected abstract  Fig makeEdgeFig()
          Abstract method to make the Fig that will be drawn for this FigEdge.
 void paint(Graphics g)
          Paint this FigEdge.
protected  void paintArrowHeads(Graphics g)
          Paint ArrowHeads on this FigEdge.
 void paintHighlightLine(Graphics g, int x1, int y1, int x2, int y2)
           
protected  void paintPathItems(Graphics g)
          Paint any labels that are located relative to this FigEdge.
 void postLoad()
          After the file is loaded, re-establish any connections from the model to the Figs
 void propertyChange(PropertyChangeEvent pce)
           
 void removePathItem(FigEdge.PathItem goneItem)
          Removes the given path item.
 void setBetweenNearestPoints(boolean un)
           
 void setDashed(boolean d)
           
 void setDestArrowHead(ArrowHead newArrow)
          Set the ArrowHead at the end of this FigEdge.
 void setDestFigNode(FigNode fn)
          Set the FigNode reprenting this FigEdge's to-node.
 void setDestPortFig(Fig fig)
          Get the Fig reprenting this FigEdge's to-port.
 void setFig(Fig f)
           
 void setHighlight(boolean b)
           
 void setLineColor(Color c)
           
 void setLineWidth(int w)
           
 void setNumPoints(int npoints)
           
 void setOwner(Object own)
          Set the edge (some object in an underlying model) that this FigEdge should represent.
 void setPoints(Handle h, int x, int y)
           
 void setPoints(int i, int x, int y)
           
 void setPoints(Point[] ps)
           
 void setSourceArrowHead(ArrowHead newArrow)
          Set the ArrowHead at the start of this FigEdge.
 void setSourceFigNode(FigNode fn)
          Set the FigNode reprenting this FigEdge's from-node.
 void setSourcePortFig(Fig fig)
          Get the Fig reprenting this FigEdge's from-port.
 void setXs(int[] xs)
           
 void setYs(int[] ys)
           
 void stuffPointAlongPerimeter(int dist, Point res)
           
 void translateEdge(int dx, int dy)
           
 void updatePathItemLocations()
           
 
Methods inherited from class uci.gef.Fig
addPoint, addPropertyChangeListener, align, center, classNameAndBounds, clone, connectionPoint, contains, contains, countCornersContained, createDrag, damage, dispose, drawDashedLine, drawDashedPerimeter, endTrans, firePropChange, firePropChange, firePropChange, getClosestPoint, getDashed01, getDashedString, getEnclosedFigs, getEnclosingFig, getFillColor, getFilled, getFilled01, getGravityPoints, getGroup, getHalfHeight, getHalfWidth, getHeight, getId, getLayer, getLocation, getLocked, getMinimumSize, getOwner, getPopUpActions, getPreferedSize, getSize, getTipString, getTrapRect, getUseTrapRect, getWidth, getX, getY, insertPoint, isLowerRightResizable, isMovable, makeSelection, OK, pointAlongPerimeter, postSave, preSave, print, removePoint, removePropertyChangeListener, reorder, routingRect, setBounds, setBounds, setDashedString, setEnclosingFig, setFillColor, setFilled, setGroup, setHeight, setLayer, setLocation, setLocation, setLocked, setPoints, setPoints, setSize, setSize, setWidth, setX, setY, startTrans, stuffBounds, translate, within
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sourcePortFig

protected Fig _sourcePortFig
Fig presenting the edge's from-port .

_destPortFig

protected Fig _destPortFig
Fig presenting the edge's to-port.

_sourceFigNode

protected FigNode _sourceFigNode
FigNode presenting the edge's from-port's parent node.

_destFigNode

protected FigNode _destFigNode
FigNode presenting the edge's to-port's parent node.

_fig

protected Fig _fig
Fig that presents the edge.

_useNearest

protected boolean _useNearest
True if the FigEdge should be drawn from the nearest point of each port Fig.

_highlight

protected boolean _highlight
True when the FigEdgde should be drawn highlighted.

_arrowHeadStart

protected ArrowHead _arrowHeadStart
The ArrowHead at the start of the line

_arrowHeadEnd

protected ArrowHead _arrowHeadEnd
The ArrowHead at the end of the line

_pathItems

protected Vector _pathItems
The items that are accumulated along the path, a vector.
Constructor Detail

FigEdge

public FigEdge(Fig s,
               Fig d,
               FigNode sfn,
               FigNode dfn,
               Object edge)
Contruct a new FigEdge with the given source and destination port figs and FigNodes. The new FigEdge will represent the given edge (an object from some underlying model).

FigEdge

public FigEdge()
Contruct a new FigEdge without any underlying edge.
Method Detail

makeEdgeFig

protected abstract Fig makeEdgeFig()
Abstract method to make the Fig that will be drawn for this FigEdge. In FigEdgeLine this method constructs a FigLine. In FigEdgeRectiline, this method constructs a FigPoly.

getFig

public Fig getFig()
Return the Fig that will be drawn.

setFig

public void setFig(Fig f)

setSourcePortFig

public void setSourcePortFig(Fig fig)
Get the Fig reprenting this FigEdge's from-port.

getSourcePortFig

public Fig getSourcePortFig()

setDestPortFig

public void setDestPortFig(Fig fig)
Get the Fig reprenting this FigEdge's to-port.

getDestPortFig

public Fig getDestPortFig()

getSourceFigNode

public Fig getSourceFigNode()

getDestFigNode

public Fig getDestFigNode()

setSourceFigNode

public void setSourceFigNode(FigNode fn)
Set the FigNode reprenting this FigEdge's from-node.

setDestFigNode

public void setDestFigNode(FigNode fn)
Set the FigNode reprenting this FigEdge's to-node.

hitFig

public Fig hitFig(Rectangle r)

setOwner

public void setOwner(Object own)
Set the edge (some object in an underlying model) that this FigEdge should represent.
Overrides:
setOwner in class Fig

getSourceArrowHead

public ArrowHead getSourceArrowHead()
Get the ArrowHead at the start of this FigEdge.

getDestArrowHead

public ArrowHead getDestArrowHead()
Get the ArrowHead at the end of this FigEdge.

setSourceArrowHead

public void setSourceArrowHead(ArrowHead newArrow)
Set the ArrowHead at the start of this FigEdge.

setDestArrowHead

public void setDestArrowHead(ArrowHead newArrow)
Set the ArrowHead at the end of this FigEdge.

getPathItemsRaw

public Vector getPathItemsRaw()
Return the vector of path items on this FigEdge.

getPathItem

public Fig getPathItem(PathConv pointOnPath)
Return the path item on this FigEdge closest to the given location. needs-more-work: not implemented yet.

addPathItem

public void addPathItem(Fig newFig,
                        PathConv newPath)
Add a new path item to this FigEdge. newPath indicates both the location and the Fig (usually FigText) that should be drawn.

removePathItem

public void removePathItem(FigEdge.PathItem goneItem)
Removes the given path item.

getBetweenNearestPoints

public boolean getBetweenNearestPoints()
Get and set the flag about using Fig connection points rather than centers.

setBetweenNearestPoints

public void setBetweenNearestPoints(boolean un)

computeRoute

protected void computeRoute()
Method to compute the route a FigEdge should follow. By defualt this does nothing. Sublcasses, like FigEdgeRectiline override this method.

getBounds

public Rectangle getBounds()
Reply the bounding box for this FigEdge.
Overrides:
getBounds in class Fig

calcBounds

public void calcBounds()
Update my bounding box
Overrides:
calcBounds in class Fig

updatePathItemLocations

public void updatePathItemLocations()

contains

public boolean contains(int x,
                        int y)
Overrides:
contains in class Fig

intersects

public boolean intersects(Rectangle r)
Overrides:
intersects in class Fig

hit

public boolean hit(Rectangle r)
Overrides:
hit in class Fig

getPerimeterLength

public int getPerimeterLength()
Overrides:
getPerimeterLength in class Fig

stuffPointAlongPerimeter

public void stuffPointAlongPerimeter(int dist,
                                     Point res)
Overrides:
stuffPointAlongPerimeter in class Fig

setPoints

public void setPoints(Point[] ps)
Overrides:
setPoints in class Fig

getPoints

public Point[] getPoints()
Overrides:
getPoints in class Fig

setPoints

public void setPoints(int i,
                      int x,
                      int y)
Overrides:
setPoints in class Fig

setPoints

public void setPoints(Handle h,
                      int x,
                      int y)
Overrides:
setPoints in class Fig

getFirstPoint

public Point getFirstPoint()
Overrides:
getFirstPoint in class Fig

getLastPoint

public Point getLastPoint()
Overrides:
getLastPoint in class Fig

getPoints

public Point getPoints(int i)
Overrides:
getPoints in class Fig

getNumPoints

public int getNumPoints()
Overrides:
getNumPoints in class Fig

setNumPoints

public void setNumPoints(int npoints)
Overrides:
setNumPoints in class Fig

getXs

public int[] getXs()
Overrides:
getXs in class Fig

setXs

public void setXs(int[] xs)
Overrides:
setXs in class Fig

getYs

public int[] getYs()
Overrides:
getYs in class Fig

setYs

public void setYs(int[] ys)
Overrides:
setYs in class Fig

translateEdge

public void translateEdge(int dx,
                          int dy)

setLineColor

public void setLineColor(Color c)
Overrides:
setLineColor in class Fig

getLineColor

public Color getLineColor()
Overrides:
getLineColor in class Fig

setLineWidth

public void setLineWidth(int w)
Overrides:
setLineWidth in class Fig

getLineWidth

public int getLineWidth()
Overrides:
getLineWidth in class Fig

setDashed

public void setDashed(boolean d)
Overrides:
setDashed in class Fig

getDashed

public boolean getDashed()
Overrides:
getDashed in class Fig

isResizable

public boolean isResizable()
Overrides:
isResizable in class Fig

isReshapable

public boolean isReshapable()
Overrides:
isReshapable in class Fig

isRotatable

public boolean isRotatable()
Overrides:
isRotatable in class Fig

setHighlight

public void setHighlight(boolean b)
Specified by:
setHighlight in interface Highlightable

getHighlight

public boolean getHighlight()
Specified by:
getHighlight in interface Highlightable

paintArrowHeads

protected void paintArrowHeads(Graphics g)
Paint ArrowHeads on this FigEdge. Called from paint(). Determines placement and orientation by using pointAlongPerimeter().

paintPathItems

protected void paintPathItems(Graphics g)
Paint any labels that are located relative to this FigEdge.

paintHighlightLine

public void paintHighlightLine(Graphics g,
                               int x1,
                               int y1,
                               int x2,
                               int y2)

paint

public void paint(Graphics g)
Paint this FigEdge. Needs-more-work: take Highlight into account
Overrides:
paint in class Fig

propertyChange

public void propertyChange(PropertyChangeEvent pce)
Specified by:
propertyChange in interface PropertyChangeListener
Overrides:
propertyChange in class Fig

postLoad

public void postLoad()
After the file is loaded, re-establish any connections from the model to the Figs
Overrides:
postLoad in class Fig

cleanUp

public void cleanUp()
Overrides:
cleanUp in class Fig

delete

public void delete()
Overrides:
delete in class Fig