Class PortPower

  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:, GraphPortHooks

public class PortPower
extends NetPort

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
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


public static final int SOCKET
See Also:
Constant Field Values


public static final int RECEPTICAL
See Also:
Constant Field Values


protected int _type
Constructor Detail


public PortPower(NetNode parent,
                 int type)
Method Detail


public int type()


public void type(int t)


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

defaultEdgeClass in class NetPort


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
canConnectTo in class NetPort