public class DefaultHighlighterFactory.DefaultHighlighter extends java.lang.Object implements Highlighter
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.geom.Rectangle2D.Double |
bounds
cache for highlighter bounds
|
protected Element |
element
highlighted Element
|
protected PointIndexIterator |
pointIndexIterator
iterator over visible control-points
|
protected PicPoint |
ptBuffer
buffer used by paint only ; may be safely used by subclasses as well
|
protected java.awt.geom.Rectangle2D |
rectBuffer
buffer used by paint only ; may be safely used by subclasses as well
|
protected java.awt.Shape |
shape
highlighter shape ; should be null if N/A in subclass
|
| Constructor and Description |
|---|
DefaultHighlighter(Element element) |
| Modifier and Type | Method and Description |
|---|---|
void |
changedUpdate(DrawingEvent.EventType eventType,
double scale)
Give notification from the model that a change occured for an element's highlighting
this highlighter is responsible for rendering.
|
java.awt.geom.Rectangle2D |
getBounds() |
protected PointIndexIterator |
getControlPointsIterator()
Returns an iterator over control-points that should be displayed by the hightligher.
|
Element |
getElement()
returns the higlighted Element
|
HighlighterFactory |
getHighlighterFactory()
Fetches the HighlighterFactory implementation that is feeding the view hierarchy.
|
HitInfo |
hitTest(PEMouseEvent e)
Current implementation returns a HitInfo.Point if a click
occured on one of the controlled-point indices returned by
getControlPointsIterator() ; return null otherwise. |
void |
paint(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D allocation,
double scale)
Render the Highlighter to the given graphic context.
Current implementation paints end-points by delegating to a DefaultPointIndexIterator,
using the highlighter color if the given
allocation intersects the bounds of this view,
then iterates over the shapes array, and paints any non-null element. |
protected void |
syncBounds(double scale)
Synchronizes the highlighter's bounding rectangle (aka clip) with the model ;
"bounds" is first computed from the set of visible control-points,
then its size gets increased by BARBELL_SIZE.
|
protected void |
syncShape(double scale)
Synchronize the shape needed to paint this highlighter, with the model ;
This implementation does nothing.
|
protected Element element
protected PointIndexIterator pointIndexIterator
protected java.awt.Shape shape
protected java.awt.geom.Rectangle2D.Double bounds
protected java.awt.geom.Rectangle2D rectBuffer
protected PicPoint ptBuffer
public DefaultHighlighter(Element element)
element - the Element to be highlightedpublic Element getElement()
public HighlighterFactory getHighlighterFactory()
getHighlighterFactory in interface Highlighterpublic void changedUpdate(DrawingEvent.EventType eventType, double scale)
syncShape() if it's a DrawingEvent.GEOMETRY_CHANGE
syncBounds() if it's a DrawingEvent.GEOMETRY_CHANGE
changedUpdate in interface Highlighterprotected void syncBounds(double scale)
scale - The current scale factor from-model-to-screen for the Graphics2D context ;
this may be used to scale down line thickess, etc... so that e.g. barbells appear with the
same size on the screen whatever the scale factor being set to the graphic context.protected void syncShape(double scale)
scale - The current scale factor from-model-to-screen for the Graphics2D context ;
this may be used to scale down line thickess, etc... so that e.g. barbells appear with the
same size on the screen whatever the scale factor being set to the graphic context.public void paint(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D allocation,
double scale)
DefaultPointIndexIterator,
using the highlighter color if the given
allocation intersects the bounds of this view,
then iterates over the shapes array, and paints any non-null element.paint in interface Highlighterscale - The current scale factor from-model-to-screen for the Graphics2D context ;
this may be used to scale down line thickess, etc... so that e.g. barbells appear with the
same size on the screen whatever the scale factor being set to the graphic context.allocation - current clippingprotected PointIndexIterator getControlPointsIterator()
public java.awt.geom.Rectangle2D getBounds()
getBounds in interface Highlighterpublic HitInfo hitTest(PEMouseEvent e)
getControlPointsIterator() ; return null otherwise.hitTest in interface HighlighterSubmit a bug : syd@jpicedt.org