uci.gef.demo
Class PortPower

java.lang.Object
  |
  +--uci.gef.NetPrimitive
        |
        +--uci.gef.NetPort
              |
              +--uci.gef.demo.PortPower

public class PortPower
extends NetPort
implements Serializable

An example subclass of NetPort for the EquipmentApplet demo. As part of the example I constrain the ports to only connect to PortPowers.

See Also:
EquipmentApplet, Serialized Form

Field Summary
protected  int _type
           
static int RECEPTICAL
           
static int SOCKET
           
 
Fields inherited from class uci.gef.NetPort
_edges, _parent, DEFAULT_EDGE_CLASS
 
Fields inherited from class uci.gef.NetPrimitive
_changeSup, _highlight
 
Constructor Summary
PortPower(NetNode parent, int type)
           
 
Method Summary
 boolean canConnectTo(GraphModel gm, Object otherPort)
          Add the constraint that PortPowers can only be connected to other ports of the same type.
protected  Class defaultEdgeClass(NetPort otherPort)
           
 int type()
           
 void type(int t)
           
 
Methods inherited from class uci.gef.NetPort
addEdge, dispose, getEdges, getParent, getParentEdge, getParentNode, makeEdgeFor, postConnect, postDisconnect, removeEdge
 
Methods inherited from class uci.gef.NetPrimitive
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getHighlight, removePropertyChangeListener, setHighlight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOCKET

public static final int SOCKET

RECEPTICAL

public static final int RECEPTICAL

_type

protected int _type
Constructor Detail

PortPower

public PortPower(NetNode parent,
                 int type)
Method Detail

type

public int type()

type

public void type(int t)

defaultEdgeClass

protected Class defaultEdgeClass(NetPort otherPort)
Overrides:
defaultEdgeClass in class NetPort

canConnectTo

public boolean canConnectTo(GraphModel gm,
                            Object otherPort)
Add the constraint that PortPowers can only be connected to other ports of the same type. And SOCKETs can only be connected to RECEPTICALs.
Overrides:
canConnectTo in class NetPort