CH.ifa.draw.standard
Class AbstractConnector

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractConnector
All Implemented Interfaces:
Connector, Storable, java.io.Serializable
Direct Known Subclasses:
ChopBoxConnector, LocatorConnector, ShortestDistanceConnector

public abstract class AbstractConnector
extends java.lang.Object
implements Connector

AbstractConnector provides default implementation for the Connector interface.

See Also:
Connector, Serialized Form

Constructor Summary
AbstractConnector()
          Constructs a connector that has no owner.
AbstractConnector(Figure owner)
          Constructs a connector with the given owner figure.
 
Method Summary
 boolean containsPoint(int x, int y)
          Tests if a point is contained in the connector.
 java.awt.Rectangle displayBox()
          Gets the display box of the connector.
 void draw(java.awt.Graphics g)
          Draws this connector.
 java.awt.Point findEnd(ConnectionFigure connection)
          Finds the end point for the connection.
protected  java.awt.Point findPoint(ConnectionFigure connection)
          Gets the connection point.
 java.awt.Point findStart(ConnectionFigure connection)
          Finds the start point for the connection.
 Figure owner()
          Gets the connector's owner.
 void read(StorableInput dr)
          Reads the connector and its owner from a StorableInput.
 void write(StorableOutput dw)
          Stores the connector and its owner to a StorableOutput.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConnector

public AbstractConnector()
Constructs a connector that has no owner. It is only used internally to resurrect a connectors from a StorableOutput. It should never be called directly.


AbstractConnector

public AbstractConnector(Figure owner)
Constructs a connector with the given owner figure.

Method Detail

owner

public Figure owner()
Gets the connector's owner.

Specified by:
owner in interface Connector

findStart

public java.awt.Point findStart(ConnectionFigure connection)
Description copied from interface: Connector
Finds the start point for the connection.

Specified by:
findStart in interface Connector

findEnd

public java.awt.Point findEnd(ConnectionFigure connection)
Description copied from interface: Connector
Finds the end point for the connection.

Specified by:
findEnd in interface Connector

findPoint

protected java.awt.Point findPoint(ConnectionFigure connection)
Gets the connection point. Override when the connector does not need to distinguish between the start and end point of a connection.


displayBox

public java.awt.Rectangle displayBox()
Gets the display box of the connector.

Specified by:
displayBox in interface Connector

containsPoint

public boolean containsPoint(int x,
                             int y)
Tests if a point is contained in the connector.

Specified by:
containsPoint in interface Connector

draw

public void draw(java.awt.Graphics g)
Draws this connector. By default connectors are invisible.

Specified by:
draw in interface Connector

write

public void write(StorableOutput dw)
Stores the connector and its owner to a StorableOutput.

Specified by:
write in interface Storable

read

public void read(StorableInput dr)
          throws java.io.IOException
Reads the connector and its owner from a StorableInput.

Specified by:
read in interface Storable
Throws:
java.io.IOException