ca.sqlpower.architect.swingui
Class RelationshipUI

java.lang.Object
  extended by ca.sqlpower.architect.swingui.RelationshipUI
All Implemented Interfaces:
PlayPenComponentUI, java.io.Serializable
Direct Known Subclasses:
BasicRelationshipUI

public abstract class RelationshipUI
extends java.lang.Object
implements PlayPenComponentUI, java.io.Serializable

See Also:
Serialized Form

Field Summary
static int CHILD_FACES_BOTTOM
           
static int CHILD_FACES_LEFT
           
static int CHILD_FACES_RIGHT
           
static int CHILD_FACES_TOP
           
static int CHILD_MASK
           
protected  java.awt.Point fkConnectionPoint
          This is the point where this relationship meets its FK table.
static int NO_FACING_EDGES
           
protected  int orientation
          A bitmask of the constants (PARENT|CHILD)_FACES_(LEFT|RIGHT|TOP|BOTTOM).
static int PARENT_FACES_BOTTOM
           
static int PARENT_FACES_LEFT
           
static int PARENT_FACES_RIGHT
           
static int PARENT_FACES_TOP
           
static int PARENT_MASK
           
protected  java.awt.Point pkConnectionPoint
          This is the point where this relationship meets its PK table.
protected  int snapRadius
          The minimum number of pixels for a "kink" in the relationship line.
static java.lang.String UI_CLASS_ID
           
 
Constructor Summary
RelationshipUI()
           
 
Method Summary
abstract  void bestConnectionPoints()
          Adjusts the UI's connection points to the default "best" position.
abstract  java.awt.Point closestEdgePoint(boolean onPkTable, java.awt.Point p)
           
abstract  boolean contains(java.awt.Point p)
          Determines if the given point touches the visible part of this relationship.
 java.awt.Point getFkConnectionPoint()
           
 int getOrientation()
          Returns the current orientation of this relationship; that is, which sides of its PK table and its FK table it is attached to.
 java.awt.Point getPkConnectionPoint()
           
abstract  java.awt.Point getPreferredLocation()
           
abstract  java.awt.Shape getShape()
          Returns the visible shape of this relationship's line.
abstract  int getShapeLength()
           
 int getSnapRadius()
           
abstract  boolean intersects(java.awt.Rectangle region)
          Determines if the given rectangle is visibly touching this component.
abstract  boolean intersectsShape(java.awt.Shape s)
          Returns true iff this relationship's visible line intersects any part of the given shape.
abstract  boolean isOverFkDecoration(java.awt.Point p)
           
abstract  boolean isOverPkDecoration(java.awt.Point p)
           
 void setFkConnectionPoint(java.awt.Point p)
           
 void setOrientation(int o)
           
 void setPkConnectionPoint(java.awt.Point p)
           
 void setSnapRadius(int v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.sqlpower.architect.swingui.PlayPenComponentUI
getPreferredSize, installUI, paint, revalidate, uninstallUI
 

Field Detail

UI_CLASS_ID

public static final java.lang.String UI_CLASS_ID
See Also:
Constant Field Values

orientation

protected int orientation
A bitmask of the constants (PARENT|CHILD)_FACES_(LEFT|RIGHT|TOP|BOTTOM).


NO_FACING_EDGES

public static final int NO_FACING_EDGES
See Also:
Constant Field Values

PARENT_FACES_RIGHT

public static final int PARENT_FACES_RIGHT
See Also:
Constant Field Values

PARENT_FACES_LEFT

public static final int PARENT_FACES_LEFT
See Also:
Constant Field Values

PARENT_FACES_BOTTOM

public static final int PARENT_FACES_BOTTOM
See Also:
Constant Field Values

PARENT_FACES_TOP

public static final int PARENT_FACES_TOP
See Also:
Constant Field Values

CHILD_FACES_RIGHT

public static final int CHILD_FACES_RIGHT
See Also:
Constant Field Values

CHILD_FACES_LEFT

public static final int CHILD_FACES_LEFT
See Also:
Constant Field Values

CHILD_FACES_BOTTOM

public static final int CHILD_FACES_BOTTOM
See Also:
Constant Field Values

CHILD_FACES_TOP

public static final int CHILD_FACES_TOP
See Also:
Constant Field Values

CHILD_MASK

public static final int CHILD_MASK
See Also:
Constant Field Values

PARENT_MASK

public static final int PARENT_MASK
See Also:
Constant Field Values

snapRadius

protected int snapRadius
The minimum number of pixels for a "kink" in the relationship line. If the kink would be smaller than snapRadius, it snaps to a straight line.


pkConnectionPoint

protected java.awt.Point pkConnectionPoint
This is the point where this relationship meets its PK table. The point is in the table's coordinate space.


fkConnectionPoint

protected java.awt.Point fkConnectionPoint
This is the point where this relationship meets its FK table. The point is in the table's coordinate space.

Constructor Detail

RelationshipUI

public RelationshipUI()
Method Detail

bestConnectionPoints

public abstract void bestConnectionPoints()
Adjusts the UI's connection points to the default "best" position.


closestEdgePoint

public abstract java.awt.Point closestEdgePoint(boolean onPkTable,
                                                java.awt.Point p)

getPreferredLocation

public abstract java.awt.Point getPreferredLocation()

isOverPkDecoration

public abstract boolean isOverPkDecoration(java.awt.Point p)

isOverFkDecoration

public abstract boolean isOverFkDecoration(java.awt.Point p)

getSnapRadius

public int getSnapRadius()

setSnapRadius

public void setSnapRadius(int v)

setPkConnectionPoint

public void setPkConnectionPoint(java.awt.Point p)

getPkConnectionPoint

public java.awt.Point getPkConnectionPoint()

setOrientation

public void setOrientation(int o)

setFkConnectionPoint

public void setFkConnectionPoint(java.awt.Point p)

getFkConnectionPoint

public java.awt.Point getFkConnectionPoint()

intersects

public abstract boolean intersects(java.awt.Rectangle region)
Determines if the given rectangle is visibly touching this component.

Parameters:
region - The region to test.
Returns:
Whether or not this Relationship visibly intersects the given region

contains

public abstract boolean contains(java.awt.Point p)
Determines if the given point touches the visible part of this relationship.

Specified by:
contains in interface PlayPenComponentUI

intersectsShape

public abstract boolean intersectsShape(java.awt.Shape s)
Returns true iff this relationship's visible line intersects any part of the given shape.

Parameters:
s - The shape to test for intersection with.
Returns:
Whether or not this relationship intersects s.

getShape

public abstract java.awt.Shape getShape()
Returns the visible shape of this relationship's line.


getShapeLength

public abstract int getShapeLength()

getOrientation

public int getOrientation()
Returns the current orientation of this relationship; that is, which sides of its PK table and its FK table it is attached to. The return value is a bitmask of the constants (PARENT|CHILD)_FACES_(LEFT|RIGHT|TOP|BOTTOM).



Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca