|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.architect.swingui.RelationshipUI
ca.sqlpower.architect.swingui.BasicRelationshipUI
public class BasicRelationshipUI
The BasicRelationshipUI is responsible for drawing the lines between tables. Subclasses decorate the ends of the lines.
| Field Summary | |
|---|---|
protected java.awt.Rectangle |
computedBounds
|
protected java.awt.geom.GeneralPath |
containmentPath
This is a closed path for use with contains() and intersects(). |
protected java.awt.BasicStroke |
idStroke
|
protected java.awt.BasicStroke |
nonIdStroke
|
protected java.awt.geom.GeneralPath |
path
This is the path that the relationship line follows. |
protected int |
radius
Points within radius pixels of this relationship's visible path are considered to be contained within this component. |
protected Relationship |
relationship
|
protected java.awt.Color |
selectedColor
|
protected java.awt.Color |
unselectedColor
|
| Fields inherited from class ca.sqlpower.architect.swingui.RelationshipUI |
|---|
CHILD_FACES_BOTTOM, CHILD_FACES_LEFT, CHILD_FACES_RIGHT, CHILD_FACES_TOP, CHILD_MASK, fkConnectionPoint, NO_FACING_EDGES, orientation, PARENT_FACES_BOTTOM, PARENT_FACES_LEFT, PARENT_FACES_RIGHT, PARENT_FACES_TOP, PARENT_MASK, pkConnectionPoint, snapRadius, UI_CLASS_ID |
| Constructor Summary | |
|---|---|
BasicRelationshipUI()
|
|
| Method Summary | |
|---|---|
void |
bestConnectionPoints()
Adjusts the UI's connection points to the default "best" position. |
java.awt.Point |
closestEdgePoint(boolean onPkTable,
java.awt.Point p)
Returns the closest point to p which is along an
edge of either the PK table (onPkTable true) or the FK table
(onPkTable false). |
protected java.awt.Rectangle |
computeBounds()
Compute bounds should only be called by objects in this package or from regress. |
boolean |
contains(PlayPenComponent c,
int x,
int y)
|
boolean |
contains(java.awt.Point p)
Determines if the given point touches the visible part of this relationship. |
static PlayPenComponentUI |
createUI(PlayPenComponent c)
|
void |
fixConnectionPoints()
Attempts to move the connection points if they collided with another relationship's connection points. |
protected int |
getFacingEdges(java.awt.Rectangle pktBounds,
java.awt.Rectangle fktBounds)
|
protected int |
getFacingEdges(java.awt.Rectangle pktBounds,
java.awt.Rectangle fktBounds,
java.awt.geom.Point2D.Double pkIntersectPt,
java.awt.geom.Point2D.Double fkIntersectPt)
|
java.awt.Stroke |
getIdentifyingStroke()
|
java.awt.Stroke |
getNonIdentifyingStroke()
|
java.awt.Point |
getPreferredLocation()
|
java.awt.Dimension |
getPreferredSize()
|
java.awt.Dimension |
getPreferredSize(PlayPenComponent c)
|
Relationship |
getRelationship()
|
java.awt.Shape |
getShape()
Returns the actual path that this relationship ui draws. |
int |
getShapeLength()
|
int |
getTerminationLength()
The distance that the termination extends perpendicularly away from the table's edge. |
int |
getTerminationWidth()
The distance that the termination extends parallel to the table's edge. |
void |
installUI(PlayPenComponent c)
|
boolean |
intersects(java.awt.Rectangle region)
Determines if the given rectangle is visibly touching this component. |
boolean |
intersectsShape(java.awt.Shape s)
Returns true iff this relationship's visible line intersects any part of the given shape. |
boolean |
isOrientationLegal()
Figures out if the current orientation is legal, given the current pkTable and fkTable positions. |
boolean |
isOverFkDecoration(java.awt.Point p)
Determines if the given point (in this Relationship's co-ordinates) is in the region defined as the primary key decoration. |
boolean |
isOverPkDecoration(java.awt.Point p)
Determines if the given point (in this Relationship's co-ordinates) is in the region defined as the primary key decoration. |
void |
paint(java.awt.Graphics2D g2)
|
void |
paint(java.awt.Graphics g,
PlayPenComponent c)
|
protected void |
paintTerminations(java.awt.Graphics2D g2,
java.awt.Point start,
java.awt.Point end,
int orientation)
Paints red dots. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
|
void |
revalidate()
|
protected void |
translatePoint(java.awt.Point modify,
java.awt.Point noModify)
Sums the X coordinates of the two arguments and saves the result in modify.x. |
void |
uninstallUI(PlayPenComponent c)
|
| Methods inherited from class ca.sqlpower.architect.swingui.RelationshipUI |
|---|
getFkConnectionPoint, getOrientation, getPkConnectionPoint, getSnapRadius, setFkConnectionPoint, setOrientation, setPkConnectionPoint, setSnapRadius |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Relationship relationship
protected java.awt.Rectangle computedBounds
protected java.awt.geom.GeneralPath path
containmentPathprotected java.awt.geom.GeneralPath containmentPath
protected java.awt.Color selectedColor
protected java.awt.Color unselectedColor
protected java.awt.BasicStroke nonIdStroke
protected java.awt.BasicStroke idStroke
protected int radius
contains(java.awt.Point)| Constructor Detail |
|---|
public BasicRelationshipUI()
| Method Detail |
|---|
public static PlayPenComponentUI createUI(PlayPenComponent c)
public void installUI(PlayPenComponent c)
installUI in interface PlayPenComponentUIpublic void uninstallUI(PlayPenComponent c)
uninstallUI in interface PlayPenComponentUIpublic void revalidate()
revalidate in interface PlayPenComponentUIpublic void paint(java.awt.Graphics2D g2)
paint in interface PlayPenComponentUI
public void paint(java.awt.Graphics g,
PlayPenComponent c)
g - The graphics to paint on. It should be in the
coordinate space of the containing playpen.public boolean contains(java.awt.Point p)
RelationshipUI
contains in interface PlayPenComponentUIcontains in class RelationshipUI
public boolean contains(PlayPenComponent c,
int x,
int y)
public boolean intersects(java.awt.Rectangle region)
RelationshipUI
intersects in class RelationshipUIregion - The region to test.
protected void paintTerminations(java.awt.Graphics2D g2,
java.awt.Point start,
java.awt.Point end,
int orientation)
public void bestConnectionPoints()
bestConnectionPoints in class RelationshipUI
public java.awt.Point closestEdgePoint(boolean onPkTable,
java.awt.Point p)
p which is along an
edge of either the PK table (onPkTable true) or the FK table
(onPkTable false).
NOTE: The orientation of the relationship will now be changed by
this method.
closestEdgePoint in class RelationshipUI
protected void translatePoint(java.awt.Point modify,
java.awt.Point noModify)
Note that this is similar to Point.translate(int,int) but it takes a second point as an argument rather than two integers.
protected int getFacingEdges(java.awt.Rectangle pktBounds,
java.awt.Rectangle fktBounds)
protected int getFacingEdges(java.awt.Rectangle pktBounds,
java.awt.Rectangle fktBounds,
java.awt.geom.Point2D.Double pkIntersectPt,
java.awt.geom.Point2D.Double fkIntersectPt)
public int getTerminationLength()
public int getTerminationWidth()
public Relationship getRelationship()
public java.awt.Stroke getIdentifyingStroke()
public java.awt.Stroke getNonIdentifyingStroke()
public boolean isOrientationLegal()
XXX: answers false sometimes when true would be more correct. A more sophisticated implementation is warranted when time allows.
public void fixConnectionPoints()
Guesses for new connection points in the following order: 7 5 3 1 origin 2 4 6 8
protected java.awt.Rectangle computeBounds()
public java.awt.Dimension getPreferredSize()
getPreferredSize in interface PlayPenComponentUIpublic java.awt.Dimension getPreferredSize(PlayPenComponent c)
public java.awt.Point getPreferredLocation()
getPreferredLocation in class RelationshipUIpublic boolean isOverPkDecoration(java.awt.Point p)
isOverPkDecoration in class RelationshipUIpublic boolean isOverFkDecoration(java.awt.Point p)
isOverFkDecoration in class RelationshipUIpublic void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange in interface java.beans.PropertyChangeListenerpublic boolean intersectsShape(java.awt.Shape s)
RelationshipUI
intersectsShape in class RelationshipUIs - The shape to test for intersection with.
public java.awt.Shape getShape()
getShape in class RelationshipUIpublic int getShapeLength()
getShapeLength in class RelationshipUI
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||