net.clackrouter.router.graph
Class WireView

java.lang.Object
  extended by EdgeView
      extended by net.clackrouter.router.graph.WireView
All Implemented Interfaces:
ClackPaintable, Alerter.Alertable

public class WireView
extends EdgeView
implements Alerter.Alertable, ClackPaintable

Represents a view of both a RouterWire and TopoWire . Based heavily on the EdgeView JGraph class.


Nested Class Summary
static class WireView.EdgeHandle
           
 
Field Summary
 WireRenderer wireRenderer
           
 
Constructor Summary
WireView(java.lang.Object cell, JGraph graph, CellMapper mapper)
          Constructs an edge view for the specified model object.
 
Method Summary
 void addPoint(int index, java.awt.geom.Point2D p)
          Adds p at position index.
 void alert()
           
 void clackPaint()
           
 java.awt.geom.Rectangle2D getBounds()
          Returns the location for this portview.
 ClackView getClackView()
           
 CellHandle getHandle(GraphContext context)
          Returns a cell handle for the view.
 java.awt.geom.Point2D getLabelPosition()
          Returns a point that describes the position of the label.
static double getLength(CellView view)
           
 java.awt.geom.Point2D getPoint(int index)
          Returns the cached points for this edge.
 int getPointCount()
          Returns the number of point for this edge.
 java.util.List getPoints()
          Returns the points.
 CellViewRenderer getRenderer()
           
 java.awt.Shape getShape()
          Returns the shape of the view according to the last rendering state
 CellView getSource()
          Returns the CellView that represents the source of the edge.
 CellView getTarget()
          Returns the CellView that represents the target of the edge.
 boolean intersects(java.awt.Graphics g, java.awt.geom.Rectangle2D rect)
          Returns true if this view intersects the given rectangle.
 boolean isHighlighted()
           
 void refresh(boolean createDependentViews)
          Overrides the parent method to udpate the cached points, source and target port.
 void removePoint(int index)
          Removes the point at position index.
 void setLabelPosition(java.awt.geom.Point2D pos)
          Sets the description of the label position.
 void setPoint(int index, java.awt.geom.Point2D p)
          Sets the point at index to p.
 void setSource(CellView sourceView)
          Sets the sourceView of the edge.
 void setTarget(CellView targetView)
          Sets the targetView of the edge.
 void startHighlight()
           
 void update()
          Update attributes and recurse children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wireRenderer

public WireRenderer wireRenderer
Constructor Detail

WireView

public WireView(java.lang.Object cell,
                JGraph graph,
                CellMapper mapper)
Constructs an edge view for the specified model object.

Parameters:
cell - reference to the model object
Method Detail

getRenderer

public CellViewRenderer getRenderer()

getClackView

public ClackView getClackView()
Specified by:
getClackView in interface ClackPaintable

isHighlighted

public boolean isHighlighted()

startHighlight

public void startHighlight()

clackPaint

public void clackPaint()
Specified by:
clackPaint in interface ClackPaintable

alert

public void alert()
Specified by:
alert in interface Alerter.Alertable

refresh

public void refresh(boolean createDependentViews)
Overrides the parent method to udpate the cached points, source and target port. If the source or target is removed, a point is inserted into the array of points.


update

public void update()
Update attributes and recurse children.


getShape

public java.awt.Shape getShape()
Returns the shape of the view according to the last rendering state


intersects

public boolean intersects(java.awt.Graphics g,
                          java.awt.geom.Rectangle2D rect)
Returns true if this view intersects the given rectangle.


getBounds

public java.awt.geom.Rectangle2D getBounds()
Returns the location for this portview.


getHandle

public CellHandle getHandle(GraphContext context)
Returns a cell handle for the view.


getSource

public CellView getSource()
Returns the CellView that represents the source of the edge.


setSource

public void setSource(CellView sourceView)
Sets the sourceView of the edge.


getTarget

public CellView getTarget()
Returns the CellView that represents the target of the edge.


setTarget

public void setTarget(CellView targetView)
Sets the targetView of the edge.


getLabelPosition

public java.awt.geom.Point2D getLabelPosition()
Returns a point that describes the position of the label.


setLabelPosition

public void setLabelPosition(java.awt.geom.Point2D pos)
Sets the description of the label position.


getPoints

public java.util.List getPoints()
Returns the points.

Returns:
java.util.List

getPointCount

public int getPointCount()
Returns the number of point for this edge.


getPoint

public java.awt.geom.Point2D getPoint(int index)
Returns the cached points for this edge.


setPoint

public void setPoint(int index,
                     java.awt.geom.Point2D p)
Sets the point at index to p.


addPoint

public void addPoint(int index,
                     java.awt.geom.Point2D p)
Adds p at position index.


removePoint

public void removePoint(int index)
Removes the point at position index.


getLength

public static double getLength(CellView view)