com.bonevich.erj.diagram
Class FigForeignKey

java.lang.Object
  |
  +--org.tigris.gef.presentation.Fig
        |
        +--org.tigris.gef.presentation.FigEdge
              |
              +--com.bonevich.erj.diagram.FigForeignKey
All Implemented Interfaces:
java.lang.Cloneable, ErjConstants, java.util.EventListener, org.tigris.gef.ui.Highlightable, java.awt.event.MouseListener, org.tigris.gef.ui.PopupGenerator, java.beans.PropertyChangeListener, java.io.Serializable

public class FigForeignKey
extends org.tigris.gef.presentation.FigEdge
implements java.awt.event.MouseListener, ErjConstants

A Fig that paints edges between ports. This version automatically routes a rectilinear edge. The routing is not very good. It avoids the source and sink nodes and no other nodes. It is basically case-analysis, and some of the cases are wrong or missing. Anyway, the user can edit the edge by dragging handles. The 0th and last handles are fixed in position so that they stay connected to ports. If the user drags a handle next to a fixed handle, a new vertex is automatically inserted.

See Also:
FigPoly, Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.tigris.gef.presentation.FigEdge
org.tigris.gef.presentation.FigEdge.PathItem
 
Field Summary
 
Fields inherited from class org.tigris.gef.presentation.FigEdge
_arrowHeadEnd, _arrowHeadStart, _destFigNode, _destPortFig, _fig, _highlight, _pathItems, _sourceFigNode, _sourcePortFig, _useNearest
 
Fields inherited from class org.tigris.gef.presentation.Fig
_allowsSaving, _context, _dashes, _displayed, _fillColor, _filled, _group, _h, _layer, _lineColor, _lineWidth, _locked, _resource, _shown, _w, _x, _y, an, annotationOwner, annotationStatus, BORDER, DASH_ARRAYS, DASHED_CHOICES, MIN_SIZE
 
Fields inherited from interface com.bonevich.erj.ErjConstants
EDITOR_COLOR, EDITOR_FONT, EMPTY_STR, ICON_AK, ICON_DOMAIN, ICON_FK, ICON_FOREIGNKEY, ICON_NOTNULL, ICON_NULL, ICON_PK, ICON_RELATION, ICON_SCHEMA, ICON_SPLASH, INITIAL_FRAME_SIZE, LABEL_COLOR, LABEL_FILL, LABEL_FONT, LABEL_FONT_ITALIC, LABEL_FONT_SIZE, LABEL_FONTMETRICS, STATUSBAR_COLOR, STATUSBAR_FONT, STATUSBAR_FONT_ITALIC, STATUSBAR_MOD_FILL, SUBLABEL_FILL
 
Constructor Summary
FigForeignKey()
           
FigForeignKey(org.tigris.gef.presentation.Fig srcPort, org.tigris.gef.presentation.Fig dstPort, org.tigris.gef.presentation.FigNode srcNode, org.tigris.gef.presentation.FigNode dstNode, java.lang.Object edge)
           
 
Method Summary
 void computeRoute()
          Find the route that the edge should follow.
 java.util.Vector getPopUpActions(java.awt.event.MouseEvent e)
           
 boolean isSelfLoop()
           
protected  void layoutEdge()
          Internal function to actually compute the layout of the line if it has never been done on that line before.
protected  org.tigris.gef.presentation.Fig makeEdgeFig()
          Instanciate a FigRectilinear.
 void mouseClicked(java.awt.event.MouseEvent e)
          Open the default editor for the foreign key.
 void mouseEntered(java.awt.event.MouseEvent e)
          Do nothing when mouse enters.
 void mouseExited(java.awt.event.MouseEvent e)
          Do nothing when mouse exits.
 void mousePressed(java.awt.event.MouseEvent e)
          Do nothing when mouse is pressed in FigNode.
 void mouseReleased(java.awt.event.MouseEvent e)
          Do nothing when mouse is released in FigNode.
protected  java.awt.Point routingRectPoint(java.awt.Point p, java.awt.Rectangle r, int sector)
          Reply a point on the given routing rect that is "straight out" from the connection point in the proper direction.
 void setSelfLoop(boolean self)
           
 
Methods inherited from class org.tigris.gef.presentation.FigEdge
addPathItem, calcBounds, cleanUp, contains, delete, getBetweenNearestPoints, getBounds, getDashed, getDestArrowHead, getDestFigNode, getDestPortFig, getFig, getFirstPoint, getHighlight, getLastPoint, getLineColor, getLineWidth, getNumPoints, getPathItem, getPathItemFig, getPathItemFigs, getPathItemsRaw, getPerimeterLength, getPoints, getPoints, getPrivateData, getSourceArrowHead, getSourceFigNode, getSourcePortFig, getXs, getYs, hit, hitFig, intersects, isReshapable, isResizable, isRotatable, paint, paintArrowHeads, paintHighlightLine, paintPathItems, postLoad, propertyChange, removePathItem, removePathItem, setBetweenNearestPoints, setDashed, setDestArrowHead, setDestFigNode, setDestPortFig, setFig, setHighlight, setLineColor, setLineWidth, setNumPoints, setOwner, setPoints, setPoints, setPoints, setPrivateData, setSourceArrowHead, setSourceFigNode, setSourcePortFig, setXs, setYs, stuffPointAlongPerimeter, translateEdge, updatePathItemLocations
 
Methods inherited from class org.tigris.gef.presentation.Fig
addAnnotation, addPoint, addPropertyChangeListener, align, center, classNameAndBounds, clone, connectionPoint, contains, contains, countCornersContained, createDrag, damage, dispose, drawDashedLine, drawDashedPerimeter, endTrans, firePropChange, firePropChange, firePropChange, getAnnotationOwner, getAnnotationStrategy, getClosestPoint, getContext, getDashed01, getDashedString, getEnclosedFigs, getEnclosingFig, getFillColor, getFilled, getFilled01, getGravityPoints, getGroup, getHalfHeight, getHalfWidth, getHandleBox, getHeight, getId, getLayer, getLocation, getLocked, getMinimumSize, getOwner, getPreferedSize, getResource, getSize, getTipString, getTrapRect, getUseTrapRect, getVisState, getWidth, getX, getY, initAnnotations, insertPoint, isAnnotation, isDisplayed, isLowerRightResizable, isMovable, makeSelection, OK, pointAlongPerimeter, postSave, preSave, print, removeAnnotation, removePoint, removePropertyChangeListener, reorder, routingRect, savingAllowed, setAnnotationOwner, setAnnotationStatus, setAnnotationStrategy, setBounds, setBounds, setCenter, setContext, setDashedString, setDisplayed, setEnclosingFig, setFillColor, setFilled, setGroup, setHandleBox, setHeight, setLayer, setLocation, setLocation, setLocked, setPoints, setPoints, setResource, setSavingAllowed, setSize, setSize, setVisState, setWidth, setX, setY, startTrans, stuffBounds, translate, unsetAnnotationOwner, updateAnnotationPositions, updateVisState, within
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tigris.gef.ui.Highlightable
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

FigForeignKey

public FigForeignKey()

FigForeignKey

public FigForeignKey(org.tigris.gef.presentation.Fig srcPort,
                     org.tigris.gef.presentation.Fig dstPort,
                     org.tigris.gef.presentation.FigNode srcNode,
                     org.tigris.gef.presentation.FigNode dstNode,
                     java.lang.Object edge)
Method Detail

makeEdgeFig

protected org.tigris.gef.presentation.Fig makeEdgeFig()
Instanciate a FigRectilinear.

Specified by:
makeEdgeFig in class org.tigris.gef.presentation.FigEdge

computeRoute

public void computeRoute()
Find the route that the edge should follow. Basically case analysis to route around source and destination nodes. Needs-More-Work: A better algorithm would really be useful. Needs-More-Work: Sometimes the edge can get non-rectilinear.

Overrides:
computeRoute in class org.tigris.gef.presentation.FigEdge

layoutEdge

protected void layoutEdge()
Internal function to actually compute the layout of the line if it has never been done on that line before.


routingRectPoint

protected java.awt.Point routingRectPoint(java.awt.Point p,
                                          java.awt.Rectangle r,
                                          int sector)
Reply a point on the given routing rect that is "straight out" from the connection point in the proper direction.


setSelfLoop

public void setSelfLoop(boolean self)

isSelfLoop

public boolean isSelfLoop()

getPopUpActions

public java.util.Vector getPopUpActions(java.awt.event.MouseEvent e)
Specified by:
getPopUpActions in interface org.tigris.gef.ui.PopupGenerator
Overrides:
getPopUpActions in class org.tigris.gef.presentation.Fig

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Do nothing when mouse enters.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Do nothing when mouse exits.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Do nothing when mouse is pressed in FigNode.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Do nothing when mouse is released in FigNode.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Open the default editor for the foreign key.

Specified by:
mouseClicked in interface java.awt.event.MouseListener


Copyright © 2001-2003 bonevich.com. All Rights Reserved.