y.view
Class InterfacePort

java.lang.Object
  |
  +--y.view.Port
        |
        +--y.view.InterfacePort

public class InterfacePort
extends Port

Defines a logical end point of an edge relative to the center location of a node. This port can display an icon at the interface between an edge and node.


Field Summary
 
Fields inherited from class y.view.Port
realizer, xoff, yoff
 
Constructor Summary
InterfacePort()
          Constructs a new InterfacePort with default offset 0.0 and no icon.
InterfacePort(Icon icon)
          Constructs a new InterfacePort with default offset 0.0 displaying the given icon at the interface location between node and edge.
InterfacePort(Port port)
          Constructs a new InterfacePort as a copy of the given port.
 
Method Summary
 void calcUnionRect(Rectangle2D rect, NodeRealizer r)
          Enlarges the given rectangle such that it will contain the complete visual representation of this port.
 boolean contains(double x, double y)
          Whether or not the given coordinate lies within this port.
 Port createCopy()
          Creates and returns a copy of this port.
 boolean findIntersection(NodeRealizer r, double ix, double iy, double ox, double oy, Point2D result)
          Returns true iff the coord (ix,iy) lies within the visual shape of this port and the coord (ox,oy> lies outside of that shape.
 Icon getIcon()
          Returns the icon associated with this port.
 void paint(Graphics2D gfx, NodeRealizer r)
          Paints the icon associated with this port.
 void read(ObjectInputStream in)
          Reads in a serialized form of a port that was previously written out by the method InterfacePort.write(ObjectOutputStream out).
 void setIcon(Icon icon)
          Sets an icon that is displayed at the port location.
 String toString()
          Returns a string representation of this port.
 void write(ObjectOutputStream out)
          Writes out this port in a serialized form.
 
Methods inherited from class y.view.Port
createRotatedPort, getOffsetX, getOffsetY, getOwner, getX, getY, setDirty, setOffsets, setOffsetX, setOffsetY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InterfacePort

public InterfacePort()
Constructs a new InterfacePort with default offset 0.0 and no icon.


InterfacePort

public InterfacePort(Icon icon)
Constructs a new InterfacePort with default offset 0.0 displaying the given icon at the interface location between node and edge.


InterfacePort

public InterfacePort(Port port)
Constructs a new InterfacePort as a copy of the given port. If the given port is not an instance of InterfacePort, only the values of the base type will be copied.

Method Detail

createCopy

public Port createCopy()
Creates and returns a copy of this port.

Overrides:
createCopy in class Port

setIcon

public void setIcon(Icon icon)
Sets an icon that is displayed at the port location.


getIcon

public Icon getIcon()
Returns the icon associated with this port.


calcUnionRect

public void calcUnionRect(Rectangle2D rect,
                          NodeRealizer r)
Enlarges the given rectangle such that it will contain the complete visual representation of this port.

Overrides:
calcUnionRect in class Port
Parameters:
r - The node realizer this port is connected to.

findIntersection

public boolean findIntersection(NodeRealizer r,
                                double ix,
                                double iy,
                                double ox,
                                double oy,
                                Point2D result)
Returns true iff the coord (ix,iy) lies within the visual shape of this port and the coord (ox,oy> lies outside of that shape. In that case the intersection point of the line (ix,iy) - (ox,oy) with that shape will be stored in the given point. Method is used for node/edge intersection machinery

Overrides:
findIntersection in class Port

paint

public void paint(Graphics2D gfx,
                  NodeRealizer r)
Paints the icon associated with this port. If there is no icon the paint the super behaviour will be used.

Overrides:
paint in class Port

contains

public boolean contains(double x,
                        double y)
Whether or not the given coordinate lies within this port. Hit test functionality.

Overrides:
contains in class Port

write

public void write(ObjectOutputStream out)
           throws IOException
Writes out this port in a serialized form.

Overrides:
write in class Port
IOException

read

public void read(ObjectInputStream in)
          throws IOException,
                 ClassNotFoundException
Reads in a serialized form of a port that was previously written out by the method InterfacePort.write(ObjectOutputStream out).

Overrides:
read in class Port
IOException
ClassNotFoundException

toString

public String toString()
Returns a string representation of this port.

Overrides:
toString in class Port

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003