Package ptolemy.vergil.actor
Class PortConnectSite
- java.lang.Object
-
- diva.canvas.AbstractSite
-
- ptolemy.vergil.actor.PortConnectSite
-
- All Implemented Interfaces:
Site
public class PortConnectSite extends AbstractSite
A site for instances of PortTerminal. For non-muiltiports, a PortTerminal will have exactly one of these sites, and it will be the connect site for the terminal. Multiports, however, will generate distinct site for each connection to the multiport.The normal for this site (the direction in which connections are made to it) is fixed when the site is constructed, and cannot be changed after that.
- Since:
- Ptolemy II 5.2
- Version:
- $Id$
- Author:
- Edward A. Lee
- See Also:
PortTerminal
- Pt.AcceptedRating:
- Red (eal)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Field Summary
-
Fields inherited from class diva.canvas.AbstractSite
_hasNormal, _normal
-
-
Constructor Summary
Constructors Constructor Description PortConnectSite(Figure figure, PortTerminal terminal, int id, double normal)
Create a port connect site for the specified figure and id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Figure
getFigure()
Return the parent figure specified in the constructor.int
getID()
Return the ID specified in the constructor.java.awt.geom.Point2D
getPoint(double normal)
Get the position of this site.PortTerminal
getTerminal()
Get the terminal to which this site belongs.double
getX()
Get the horizontal position of this site with the normal that was set up by the constructor.double
getY()
Get the vertical position of this site with the normal that was set up by the constructor.void
setNormal(double normal)
Do nothing.java.lang.String
toString()
Return a string representation of this connect site.-
Methods inherited from class diva.canvas.AbstractSite
getNormal, getPoint, getPoint, getPoint, getTransformContext, hasNormal, isNormal, translate
-
-
-
-
Constructor Detail
-
PortConnectSite
public PortConnectSite(Figure figure, PortTerminal terminal, int id, double normal)
Create a port connect site for the specified figure and id. An id of zero is the default site at the port icon. Larger ids are reserved for sites that are used to distinguish multiple connections to a multiport.- Parameters:
figure
- The parent figure.terminal
- The port terminal.id
- The ID.normal
- The normal for this connect site.
-
-
Method Detail
-
getFigure
public Figure getFigure()
Return the parent figure specified in the constructor.- Specified by:
getFigure
in interfaceSite
- Specified by:
getFigure
in classAbstractSite
- Returns:
- The parent figure.
-
getID
public int getID()
Return the ID specified in the constructor. The default ID is zero. When additional instances of this site are associated with an instance of PortTerminal, they each get a unique ID starting with 1 and increasing by 1. The ID determines the position of the site relative to the port.- Specified by:
getID
in interfaceSite
- Specified by:
getID
in classAbstractSite
- Returns:
- The ID of the site.
-
getPoint
public java.awt.geom.Point2D getPoint(double normal)
Get the position of this site.- Specified by:
getPoint
in interfaceSite
- Overrides:
getPoint
in classAbstractSite
- Parameters:
normal
- The normal.- Returns:
- The position of this site.
-
getTerminal
public PortTerminal getTerminal()
Get the terminal to which this site belongs.- Returns:
- The terminal to which this site belongs.
-
getX
public double getX()
Get the horizontal position of this site with the normal that was set up by the constructor.- Specified by:
getX
in interfaceSite
- Specified by:
getX
in classAbstractSite
- Returns:
- The horizontal position of this site.
-
getY
public double getY()
Get the vertical position of this site with the normal that was set up by the constructor.- Specified by:
getY
in interfaceSite
- Specified by:
getY
in classAbstractSite
- Returns:
- The vertical position of this site.
-
setNormal
public void setNormal(double normal)
Do nothing. The normal is fixed at the time this is constructed.- Specified by:
setNormal
in interfaceSite
- Overrides:
setNormal
in classAbstractSite
- Parameters:
normal
- The normal.
-
toString
public java.lang.String toString()
Return a string representation of this connect site.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The name of the port and the ID.
-
-