Search this API

y.view
Class InterfacePort

java.lang.Object
  extended by y.view.Port
      extended by 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.

 
Your browser does not support SVG content.

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(javax.swing.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(java.awt.geom.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, java.awt.geom.Point2D result)
          Returns true iff the coordinate (ix,iy) lies within the visual shape of this port and the coordinate (ox,oy> lies outside of that shape.
 javax.swing.Icon getIcon()
          Returns the icon associated with this port.
 void paint(java.awt.Graphics2D gfx, NodeRealizer r)
          Paints the icon associated with this port.
 void read(java.io.ObjectInputStream in)
          Deprecated. Use the GraphML format instead.
 void setIcon(javax.swing.Icon icon)
          Sets an icon that is displayed at the port location.
 java.lang.String toString()
          Returns a string representation of this port.
 void write(java.io.ObjectOutputStream out)
          Deprecated. Use the GraphML format instead.
 
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(javax.swing.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(javax.swing.Icon icon)
Sets an icon that is displayed at the port location.


getIcon

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


calcUnionRect

public void calcUnionRect(java.awt.geom.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,
                                java.awt.geom.Point2D result)
Returns true iff the coordinate (ix,iy) lies within the visual shape of this port and the coordinate (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(java.awt.Graphics2D gfx,
                  NodeRealizer r)
Paints the icon associated with this port. If there is no icon the paint the super behavior 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(java.io.ObjectOutputStream out)
           throws java.io.IOException
Deprecated. Use the GraphML format instead.

Writes out this port in a serialized form.

Overrides:
write in class Port
Throws:
java.io.IOException

read

public void read(java.io.ObjectInputStream in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Deprecated. Use the GraphML format instead.

Reads in a serialized form of a port that was previously written out by the method write(ObjectOutputStream out).

Overrides:
read in class Port
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

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

Overrides:
toString in class Port

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