org.tigris.gef.graph.presentation
Class NetEdge

java.lang.Object
  extended by org.tigris.gef.graph.presentation.NetPrimitive
      extended by org.tigris.gef.graph.presentation.NetEdge
All Implemented Interfaces:
java.io.Serializable, GraphEdgeHooks
Direct Known Subclasses:
EdgeData, EdgePower, SampleEdge, SampleEdge2

public abstract class NetEdge
extends NetPrimitive
implements GraphEdgeHooks, java.io.Serializable

This class models an edge in our underlying connected graph model. This class is used by the DefaultGraphModel. If you define your own GraphModel, you can user your own application-specific objects as edges.

See Also:
Serialized Form

Field Summary
protected  NetPort _destPort
           
protected  java.util.Vector _ports
          The ports that are part of this edge.
protected  NetPort _sourcePort
          The start and end ports of this edge.
 
Fields inherited from class org.tigris.gef.graph.presentation.NetPrimitive
_changeSup, _highlight
 
Constructor Summary
NetEdge()
          Construct a new NetEdge
 
Method Summary
 boolean connect(GraphModel gm, java.lang.Object srcPort, java.lang.Object destPort)
          Connect the source and destination ports, iff they agree to being connected (i.e., canConnectTo() returns true).
 void deleteFromModel()
          Remove this NetEdge from the underlying connected graph model.
 NetPort getDestPort()
           
 java.util.Vector getPorts()
           
 NetPort getSourcePort()
           
abstract  FigEdge makePresentation(Layer lay)
          Abstract method that returns a FigEdge to represent this edge in a given Layer.
 NetPort otherEnd(NetPort oneEnd)
          Given one port (source or destination), reply the other port (destination or source).
 FigEdge presentationFor(Layer lay)
          The Fig to use in views of a given type
 void setDestPort(NetPort d)
           
 void setPorts(java.util.Vector v)
           
 void setSourcePort(NetPort s)
           
 
Methods inherited from class org.tigris.gef.graph.presentation.NetPrimitive
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getHighlight, getId, 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.GraphEdgeHooks
addPropertyChangeListener, removePropertyChangeListener, setHighlight
 

Field Detail

_sourcePort

protected NetPort _sourcePort
The start and end ports of this edge.


_destPort

protected NetPort _destPort

_ports

protected java.util.Vector _ports
The ports that are part of this edge. Most of the time Edges do not have any ports. However, in some connected graph notations, users are allowed to attach notes to edges, or something that requrires edges to go from an edge to a node, or an edge to an edge.

Constructor Detail

NetEdge

public NetEdge()
Construct a new NetEdge

Method Detail

setSourcePort

public void setSourcePort(NetPort s)

getSourcePort

public NetPort getSourcePort()

setDestPort

public void setDestPort(NetPort d)

getDestPort

public NetPort getDestPort()

otherEnd

public NetPort otherEnd(NetPort oneEnd)
Given one port (source or destination), reply the other port (destination or source).


getPorts

public java.util.Vector getPorts()

setPorts

public void setPorts(java.util.Vector v)

connect

public boolean connect(GraphModel gm,
                       java.lang.Object srcPort,
                       java.lang.Object destPort)
Connect the source and destination ports, iff they agree to being connected (i.e., canConnectTo() returns true). Reply true on success. This method is noramlly called after a new edge instance is made. Maybe this behavior should be in a constructor, but I want to use Class#newInstance so constructors do not get any arguments.


deleteFromModel

public void deleteFromModel()
Remove this NetEdge from the underlying connected graph model.

Specified by:
deleteFromModel in interface GraphEdgeHooks

presentationFor

public FigEdge presentationFor(Layer lay)
The Fig to use in views of a given type


makePresentation

public abstract FigEdge makePresentation(Layer lay)
Abstract method that returns a FigEdge to represent this edge in a given Layer. This is just a quick and simple way to do it if you use a DefaultGraphModel because DefaultgraphEdgeRenderer calls this. Override this method if you want your Edge subclasses to have a different look. The better way to do it is to implement your own GraphEdgeRenderer.