org.tigris.gef.demo
Class PortPower

java.lang.Object
  extended by org.tigris.gef.graph.presentation.NetPrimitive
      extended by org.tigris.gef.graph.presentation.NetPort
          extended by org.tigris.gef.demo.PortPower
All Implemented Interfaces:
java.io.Serializable, GraphPortHooks

public class PortPower
extends NetPort
implements java.io.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 org.tigris.gef.graph.presentation.NetPort
DEFAULT_EDGE_CLASS
 
Fields inherited from class org.tigris.gef.graph.presentation.NetPrimitive
_changeSup, _highlight
 
Constructor Summary
PortPower(NetNode parent, int type)
           
 
Method Summary
 boolean canConnectTo(GraphModel gm, java.lang.Object otherPort)
          Add the constraint that PortPowers can only be connected to other ports of the same type.
protected  java.lang.Class defaultEdgeClass(NetPort otherPort)
          reply the java Class to be used to make new arcs.
 int type()
           
 void type(int t)
           
 
Methods inherited from class org.tigris.gef.graph.presentation.NetPort
addEdge, deleteFromModel, getEdges, getId, getParent, getParentEdge, getParentNode, makeEdgeFor, postConnect, postDisconnect, removeEdge
 
Methods inherited from class org.tigris.gef.graph.presentation.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
 
Methods inherited from interface org.tigris.gef.graph.GraphPortHooks
addPropertyChangeListener, removePropertyChangeListener, setHighlight
 

Field Detail

SOCKET

public static final int SOCKET
See Also:
Constant Field Values

RECEPTICAL

public static final int RECEPTICAL
See Also:
Constant Field Values

_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 java.lang.Class defaultEdgeClass(NetPort otherPort)
Description copied from class: NetPort
reply the java Class to be used to make new arcs. This is a utility function called from NetPort#makeEdgeFor

Overrides:
defaultEdgeClass in class NetPort

canConnectTo

public boolean canConnectTo(GraphModel gm,
                            java.lang.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.

Specified by:
canConnectTo in interface GraphPortHooks
Overrides:
canConnectTo in class NetPort