public class ExcitableFigure extends Figure
Details:
An ExcitableFigure
extends Figure
with features to support "excitability," or the ability to render a portion of the figure in an "excited" state, such as seen during mouse-ExcitableDoodle
to provide this feature.
In applications, a single figure may be rendered simultaneously in multiple views.
When the mouse hovers over a Doodle
, three behaviors are possible:
The most appropriate behavior depends on the application. This class supports all three behaviors.
mDoodles, mDoodlesSorted
mToolTip, mZOrder
mParent
Constructor and Description |
---|
ExcitableFigure() |
Modifier and Type | Method and Description |
---|---|
void |
mouseMoved(InteractiveFigureView iView,
Point2D iPoint,
AffineTransform iTransform)
Enables responses to mouse movement.
|
boolean |
paint(FigGraphics iG)
Renders figure.
|
add, remove, sendDoodleChanged, subscribe, unsubscribe
contains, draw, getBounds, getDoodles, getDoodlesAt, getZOrder, hasDescendant, identifyDoodle, setZOrder
getToolTip, setToolTip
getDefaultOrigin, getParent, redraw, setParent
public void mouseMoved(InteractiveFigureView iView, Point2D iPoint, AffineTransform iTransform)
Details:
mouseMoved
is called by InteractiveFigureViewDelegate
whenever the mouse has moved over this figure.
This allows the figure to support interactive functions which may be implemented in subclasses.
iView
- the widget experiencing the mouse moveiPoint
- the logical position of the mousepublic boolean paint(FigGraphics iG)
Figure
Details:
paint
renders this figure using the supplied graphics environment.
Before this figure can be rendered correctly, its member shapes must be sorted by Z-draw
takes a "lazy" approach by re-sorting its members only when it has reason to believe that they may be unsorted.
There are two possible situations where re-sorting can be triggered:
1. Shapes have been added to this figure since the last time the collection was sorted.
When this situation occurs, paint
re-sorts the collection immediately before paint the figure.
2. While drawing the figure, paint
discovers unsorted shapes.
In this case, some painting may have already occurred, and paint
cannot continue, because continuing would result in an incorrect result.
Nor can paint
simply re-paint
's only recourse is to abort the operation and signal to the client that it was unsuccessful.
It is then up to the client to call paint
again.
The next time the client calls paint
, paint
will re-
The view, supplied as a InteractiveFigureView
, allows shapes to customize their appearance for various views.
For example, a shape could be configured to be invisible in one view, and visible in another.
Use of this parameter is optional, and null
is an acceptable value.
The caller of paint
should set this parameter to the widget on which the figure is being drawn.
(This model presupposes that each widget will only display one figure, an assumption that may be abandoned in the future.)
paint
returns true
if drawing was successful, false
otherwise.
Copyright © 2013. All Rights Reserved.