All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface CH.ifa.draw.framework.ConnectionFigure

public interface interface ConnectionFigure
extends Figure, FigureChangeListener
Figures to connect Connectors provided by Figures. A ConnectionFigure knows its start and end Connector. It uses the Connectors to locate its connection points.

A ConnectionFigure can have multiple segments. It provides operations to split and join segments.


Design Patterns

 o Strategy
Strategy is used encapsulate the algorithm to locate the connection point. ConnectionFigure is the Strategy context and Connector is the Strategy.
 o Observer
Observer is used to track changes of the connected figures. A connection figure registers itself as listeners or observers of the source and target connector.


See Also:
Connector

Method Index

 o canConnect(Figure, Figure)
Checks if two figures can be connected.
 o connectEnd(Connector)
Sets the end Connector of the connection.
 o connectsSame(ConnectionFigure)
Checks if the ConnectionFigure connects the same figures.
 o connectStart(Connector)
Sets the start Connector of the connection.
 o disconnectEnd()
Disconnects the end figure from the dependent figure
 o disconnectStart()
Disconnects the start figure from the dependent figure
 o end()
Gets the end Connector.
 o endPoint()
Gets the end point.
 o endPoint(int, int)
Sets the end point.
 o joinSegments(int, int)
Joins the hit segments.
 o pointAt(int)
Gets the Point at the given position
 o pointCount()
Gets the number of points or nodes of the connection
 o setPointAt(Point, int)
Sets the position of the point at the given position
 o splitSegment(int, int)
Splits the hit segment.
 o start()
Gets the start Connector
 o startPoint()
Gets the start point.
 o startPoint(int, int)
Sets the start point.
 o updateConnection()
Updates the connection

Methods

 o connectStart
 public abstract void connectStart(Connector start)
Sets the start Connector of the connection.

Parameters:
figure - the start figure of the connection
 o connectEnd
 public abstract void connectEnd(Connector end)
Sets the end Connector of the connection.

Parameters:
figure - the end figure of the connection
 o updateConnection
 public abstract void updateConnection()
Updates the connection

 o disconnectStart
 public abstract void disconnectStart()
Disconnects the start figure from the dependent figure

 o disconnectEnd
 public abstract void disconnectEnd()
Disconnects the end figure from the dependent figure

 o start
 public abstract Connector start()
Gets the start Connector

 o end
 public abstract Connector end()
Gets the end Connector.

 o canConnect
 public abstract boolean canConnect(Figure start,
                                    Figure end)
Checks if two figures can be connected. Implement this method to constrain the allowed connections between figures.

 o connectsSame
 public abstract boolean connectsSame(ConnectionFigure other)
Checks if the ConnectionFigure connects the same figures.

 o startPoint
 public abstract void startPoint(int x,
                                 int y)
Sets the start point.

 o endPoint
 public abstract void endPoint(int x,
                               int y)
Sets the end point.

 o startPoint
 public abstract Point startPoint()
Gets the start point.

 o endPoint
 public abstract Point endPoint()
Gets the end point.

 o setPointAt
 public abstract void setPointAt(Point p,
                                 int index)
Sets the position of the point at the given position

 o pointAt
 public abstract Point pointAt(int index)
Gets the Point at the given position

 o pointCount
 public abstract int pointCount()
Gets the number of points or nodes of the connection

 o splitSegment
 public abstract int splitSegment(int x,
                                  int y)
Splits the hit segment.

Parameters:
x, - y the position where the figure should be split
Returns:
the index of the splitting point
 o joinSegments
 public abstract boolean joinSegments(int x,
                                      int y)
Joins the hit segments.

Parameters:
x, - y the position where the figure should be joined.
Returns:
whether the segment was joined

All Packages  Class Hierarchy  This Package  Previous  Next  Index