uk.ac.ic.doc.automed.editor
Class DrawVertex

java.lang.Object
  extended by uk.ac.ic.doc.automed.editor.DrawVertex
All Implemented Interfaces:
Drawable, DrawableVertex
Direct Known Subclasses:
DefaultDrawConstraintVertex, DefaultDrawLinkNodalVertex, DefaultDrawLinkVertex, DefaultDrawNodalVertex, DrawERGeneralisationVertex, DrawERRelationshipVertex, DrawHDMVertex, DrawNetwork, DrawSchema

public class DrawVertex
extends java.lang.Object
implements DrawableVertex

The default implementation of DrawableVertex that the editor will use to draw any vertex it does not know (or has been told) to draw otherwise.

Author:
Michael Boyd (mboyd@doc.ic.ac.uk), Peter McBrien (pjm@doc.ic.ac.uk)

Field Summary
protected  java.awt.Rectangle bounds
           
protected static java.awt.Stroke dashedStroke
           
protected  Positionable[] dependent
           
protected  EditorPanel ep
           
protected static java.awt.FontMetrics fm
           
protected  Positionable p
           
protected static java.awt.Stroke standardStroke
           
protected  int symbolHeight
           
protected  int symbolWidth
           
protected  java.lang.String text
           
protected  int textHeight
           
protected  int textWidth
           
static int thickness
           
protected static java.awt.Stroke thickStroke
           
protected static java.awt.Stroke thinStroke
           
protected static int xInset
           
protected static int yInset
           
protected static java.awt.Point zeroOffset
           
 
Constructor Summary
DrawVertex(EditorPanel ep, Positionable p)
           
DrawVertex(EditorPanel ep, Positionable p, Positionable[] dependent)
           
 
Method Summary
 java.awt.Rectangle getBounds()
          Describe the rectangular area within the EditorPanel where this Drawable vertex is to be painted.
 java.awt.Point getCentre()
          Describe where the centre of the Drawable visually appears to a viewer.
 java.awt.Point getCentreOffset()
          Implements the Drawable
 java.awt.Point getConnectionPoint(java.awt.Point other)
          Calculate the Point where a DrawableArc connecting to this DrawableVertex should be drawn to, no
 java.awt.Point getConnectionPointMovableCentre(java.awt.Point other)
          A more visually pleasing implementation of getConnectionPoint(java.awt.Point) for use on rectangular Drawables that allows the centre of the object you are connecting with to be treated as only loosely defining where the connection point should be aligned to, such that as the other point moves to the right, so the centre of the drawable moves a little to the right
 Positionable[] getConnectsTo()
           
 Positionable getPositionable()
          Return the Positionable that this Drawable is providing a graphical representation of.
static java.awt.Point intersectLine(java.awt.Rectangle bounds, java.awt.Polygon p, int x1, int y1, int x2, int y2)
          Return the Point where a line intersects a Polygon
 void paintComponent(java.awt.Graphics2D g)
           
 void paintSymbol(java.awt.Graphics2D g)
           
 void paintText(java.awt.Graphics2D g)
           
protected  void setText(java.lang.String s)
          Set the text that will be used in this {link @Drawable}, and record its width and height in textBounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fm

protected static java.awt.FontMetrics fm

thickness

public static final int thickness
See Also:
Constant Field Values

thinStroke

protected static final java.awt.Stroke thinStroke

standardStroke

protected static final java.awt.Stroke standardStroke

thickStroke

protected static final java.awt.Stroke thickStroke

dashedStroke

protected static final java.awt.Stroke dashedStroke

xInset

protected static final int xInset
See Also:
Constant Field Values

yInset

protected static final int yInset
See Also:
Constant Field Values

text

protected java.lang.String text

textWidth

protected int textWidth

textHeight

protected int textHeight

symbolWidth

protected int symbolWidth

symbolHeight

protected int symbolHeight

bounds

protected java.awt.Rectangle bounds

p

protected Positionable p

zeroOffset

protected static final java.awt.Point zeroOffset

dependent

protected Positionable[] dependent

ep

protected EditorPanel ep
Constructor Detail

DrawVertex

public DrawVertex(EditorPanel ep,
                  Positionable p,
                  Positionable[] dependent)

DrawVertex

public DrawVertex(EditorPanel ep,
                  Positionable p)
Method Detail

getPositionable

public Positionable getPositionable()
Return the Positionable that this Drawable is providing a graphical representation of.

Specified by:
getPositionable in interface Drawable

getConnectsTo

public Positionable[] getConnectsTo()
Specified by:
getConnectsTo in interface Drawable

setText

protected final void setText(java.lang.String s)
Set the text that will be used in this {link @Drawable}, and record its width and height in textBounds.


getBounds

public java.awt.Rectangle getBounds()
Description copied from interface: DrawableVertex
Describe the rectangular area within the EditorPanel where this Drawable vertex is to be painted.

Specified by:
getBounds in interface DrawableVertex

getCentreOffset

public java.awt.Point getCentreOffset()
Implements the Drawable

Specified by:
getCentreOffset in interface DrawableVertex
Returns:
A point that is an offset within getBounds(), where the graphical centre of this Drawable lies

getCentre

public java.awt.Point getCentre()
Describe where the centre of the Drawable visually appears to a viewer.

Specified by:
getCentre in interface DrawableVertex
Returns:
A point that is the absolute coordinate of the , graphical centre of this Drawable.

getConnectionPoint

public java.awt.Point getConnectionPoint(java.awt.Point other)
Description copied from interface: DrawableVertex
Calculate the Point where a DrawableArc connecting to this DrawableVertex should be drawn to, no

Specified by:
getConnectionPoint in interface DrawableVertex
Returns:
Point

getConnectionPointMovableCentre

public java.awt.Point getConnectionPointMovableCentre(java.awt.Point other)
A more visually pleasing implementation of getConnectionPoint(java.awt.Point) for use on rectangular Drawables that allows the centre of the object you are connecting with to be treated as only loosely defining where the connection point should be aligned to, such that as the other point moves to the right, so the centre of the drawable moves a little to the right


paintSymbol

public void paintSymbol(java.awt.Graphics2D g)

paintText

public void paintText(java.awt.Graphics2D g)

paintComponent

public void paintComponent(java.awt.Graphics2D g)
Specified by:
paintComponent in interface Drawable

intersectLine

public static java.awt.Point intersectLine(java.awt.Rectangle bounds,
                                           java.awt.Polygon p,
                                           int x1,
                                           int y1,
                                           int x2,
                                           int y2)
Return the Point where a line intersects a Polygon