ptolemy.data.unit
Class BasicEdgeHighlighter

java.lang.Object
  extended bydiva.canvas.AbstractFigure
      extended bydiva.canvas.AbstractFigureContainer
          extended bydiva.canvas.FigureDecorator
              extended byptolemy.data.unit.BasicEdgeHighlighter
All Implemented Interfaces:
CanvasComponent, Figure, FigureContainer, FigureSet, UserObjectContainer, VisibleComponent

public class BasicEdgeHighlighter
extends FigureDecorator

A decorator figure that displays a highlight behind an edge. This capability was planned for BasicHighlighter but there doesn't seem to be an easy way to determine that an edge is being painted. This class is a stripped down version of BasicHighlighter with the paint method modified so that it assumnes that an edge is being highlighted.

Since:
Ptolemy II 4.0
Version:
$Id: BasicEdgeHighlighter.java,v 1.1 2004/04/20 16:48:57 rowland Exp $
Author:
Rowland R Johnson
Accepted Rating:
Red (rowland)
Proposed Rating:
Red (rowland)

Constructor Summary
BasicEdgeHighlighter()
          Create a new highlighter with a default paint, "halo", and stroke.
 
Method Summary
 boolean hit(java.awt.geom.Rectangle2D region)
          Return false.
 FigureDecorator newInstance(Figure f)
          Create a new instance of this highlighter.
 void paint(java.awt.Graphics2D g)
          Paint the edge.
 void repaint()
          Request a repaint of the figure and highlight.
 void repaint(DamageRegion d)
          Receive repaint notification.
 
Methods inherited from class diva.canvas.FigureDecorator
add, contains, figures, figuresFromBack, figuresFromFront, getBounds, getChild, getContainer, getDecoratedFigure, getFigureCount, getShape, remove, replaceChild, setChild, transform, translate
 
Methods inherited from class diva.canvas.AbstractFigureContainer
decorate, pick, pick, undecorate
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, setVisible
 
Methods inherited from interface diva.canvas.CanvasComponent
getParent, getTransformContext
 

Constructor Detail

BasicEdgeHighlighter

public BasicEdgeHighlighter()
Create a new highlighter with a default paint, "halo", and stroke.

Method Detail

hit

public boolean hit(java.awt.geom.Rectangle2D region)
Return false. This method always returns false, as it is meaningless (and dangerous!) to be able to hit a highlight.

Specified by:
hit in interface Figure
Overrides:
hit in class FigureDecorator

newInstance

public FigureDecorator newInstance(Figure f)
Create a new instance of this highlighter.

Specified by:
newInstance in class FigureDecorator

paint

public void paint(java.awt.Graphics2D g)
Paint the edge. This method first paints the highlight over the contained edge by drawing a line width determined by halo. It then paints the contained edge.

Specified by:
paint in interface VisibleComponent
Overrides:
paint in class FigureDecorator

repaint

public void repaint(DamageRegion d)
Receive repaint notification. This method generates another repaint() call, with a larger region, in order to ensure that the highlight is repainted.

Specified by:
repaint in interface CanvasComponent
Overrides:
repaint in class AbstractFigureContainer

repaint

public void repaint()
Request a repaint of the figure and highlight. This method reads the bounding box of the highlighted figure, and requests a repaint of that box stretched in each direction by the halo.

Specified by:
repaint in interface CanvasComponent
Overrides:
repaint in class AbstractFigure