verinec.gui.core
Class NwWire

java.lang.Object
  extended by java.awt.geom.Line2D
      extended by java.awt.geom.Line2D.Float
          extended by verinec.gui.core.NwWire
All Implemented Interfaces:
Shape, Cloneable

public class NwWire
extends Line2D.Float

Base class for wires. This class offers standard implementations of methods that every wire must contain. A wire is always connected to a binding of a node and to a hub, even if only two nodes are connected.

Author:
Renato Loeffel

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Line2D
Line2D.Double, Line2D.Float
 
Field Summary
protected  NwHub dest
          The hub this wire is connected to.
protected  VerinecStudio gui
          The main application
protected  NwBinding source
          The binding this wire is connected to.
protected  int type
          The network type of this wire.
protected  Color wireColor
          How this wire should be drawn.
protected  BasicStroke wireStroke
          How this wire should be drawn.
 
Fields inherited from class java.awt.geom.Line2D.Float
x1, x2, y1, y2
 
Constructor Summary
NwWire(int type, NwBinding source, NwHub dest, VerinecStudio gui)
          Create a wire and connect it to the source and dest.
 
Method Summary
 void delete()
          Notify owners that the wire doesn't exist any longer.
 void endPointMoved()
          Notify the wire that one end point has moved.
 NwBinding getBinding()
          Returns the binding of the wire.
 Color getColor()
          Returns the color of the wire.
 NwHub getDest()
          Get the hub this wire is connected to.
 BasicStroke getStroke()
          Returns the stroke of the wire.
 int getType()
          Get the network type of this wire.
 void resizeWire(float factor)
          Resizes the wire.
 
Methods inherited from class java.awt.geom.Line2D.Float
getBounds2D, getP1, getP2, getX1, getX2, getY1, getY2, setLine, setLine
 
Methods inherited from class java.awt.geom.Line2D
clone, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gui

protected VerinecStudio gui
The main application


type

protected int type
The network type of this wire.


source

protected NwBinding source
The binding this wire is connected to.


dest

protected NwHub dest
The hub this wire is connected to.


wireStroke

protected BasicStroke wireStroke
How this wire should be drawn.


wireColor

protected Color wireColor
How this wire should be drawn.

Constructor Detail

NwWire

public NwWire(int type,
              NwBinding source,
              NwHub dest,
              VerinecStudio gui)
Create a wire and connect it to the source and dest.

Parameters:
type - The network type of this wire.
source - The binding this wire is attached to.
dest - The destination this wire is attached to.
gui - The main application reference.
Method Detail

getType

public int getType()
Get the network type of this wire.

Returns:
Network type id.

getBinding

public NwBinding getBinding()
Returns the binding of the wire.

Returns:
The binding of the wire.

getDest

public NwHub getDest()
Get the hub this wire is connected to.

Returns:
The hub this wire is connected to.

getStroke

public BasicStroke getStroke()
Returns the stroke of the wire.

Returns:
the stroke of the wire.

getColor

public Color getColor()
Returns the color of the wire.

Returns:
the color of the wire.

endPointMoved

public void endPointMoved()
Notify the wire that one end point has moved. Updates the start and end coordinates and repaints the wire.


resizeWire

public void resizeWire(float factor)
Resizes the wire. Also adjusts the dasharray of the line, if it is painted dashed.

Parameters:
factor - the resize factor.

delete

public void delete()
Notify owners that the wire doesn't exist any longer.


Copyright © 2005 Verinec, DIUF