Last Updated: 3/4/97
Class NFActiveRegion
Class NFActiveRegion
public class NFActiveRegion extends Observable implements Runnable
NFActiveRegion tracks user interaction with the mouse in
specified polygons on the screen. There are two types of interactions
at this time, a dwell interaction, and a button press interaction.
The dwell interaction occurs when the pointer (mouse) is left over
a specified polygon for the dwellTime. If an NFLabel has been
set, NFActiveRegion will post that label with the appropriate value
and inform any observers that it has posted the dwell label. If
an NFLabel has not been set, NFActiveRegion will inform the observers
that a dwell has taken place, and will additionally pass along the
dwell point x, y, and dwell label value. The observer keywords
are DwellOn, for when the mouse dwell occurs, and DwellOff, for
when the mouse is moved again.
The button press interaction occurs when a button press has taken
place over one of the specified polygons. If an applet context and
URL string have been assigned, the applet context's showDocument
method will be called with the appropriate url string. The observers
will also be notified. If an applet context or URL have not been set,
the observer will be notified of the button press and will additionally
be passed the x, y, button modifiers and activate label value. The
observer keyword for the button press is RegionPress.
Constructors
Methods
NFActiveRegion (long dwellTime,
Observer callback)
-
Constructor including dwellTime, and callback. dwellTime indicates
how long before a dwell is considered a dwell. The callback is the
observer object that will be notified.
-
NFActiveLabel addLabel (NFActiveLabel label)
-
Add the given active label to the list of labels being
tracked by this active region. If the given label is null,
a default label will be added and returned.
-
NFActiveLabel addLabel (Vector labels,
int nth)
-
Add the nth active label in the vector, if it doesn't
exist, add a default active label. In either case,
the active label added is returned.
-
NFActiveLabel findMatch (int x,
int y)
-
Returns the first active label which bounds the given point.
If no match is found, null is returned. NOTE: We search
backwards through the list, because we assume that the
last labels added correspond to the last data points to
be displayed.
-
synchronized boolean mouseDown(Event evt,
int x,
int y)
-
Called by an outside routine to provide a mouse down event
-
synchronized void mousePos(int x,
int y)
-
Called by an outside routine to update the mouse x and y
-
void removeAllLabels ()
-
Delete all active labels tracked by this active region
-
void removeLabel (NFActiveLabel label)
-
Delete the given active label from the list of labels being
tracked by this active region
-
void removeLabel (Vector v)
-
Delete all active labels in the given vector from the
list of labels being tracked
-
void run()
-
Keep checking the mouse position to see if the user is "dwelling".
If so, display the dwell label. If not, go to sleep and wait
for the mousePos() method to be called.
-
void setClickCount(int clickCount)
-
Sets the number of clicks required before an active label
is activated. note that the applet context must first have
been set using setDocument
-
void setDocument (Applet app,
int clickCount)
-
Use the given applet to determine the AppletContext in which
to show a document, or failing that, turn off document display.
-
void setDocument(AppletContext ac,
int clickCount)
-
Setting a non-null applet context indicates that the NFActiveRegion
object should attempt to "showDocument" If the applet context or the
showDocument will not be called, and the observer will be passed
back the x, y, and modifiers.
-
synchronized void setLabel (NFLabel label,
Component comp)
-
Setting a non-null NFLabel component indicates that the NFActiveRegion
object should attempt to post the NFLabel if a dwell occurs over a
data polygon. The corresponding data label value will be displayed
as the NFLabel's value. If label is null, dwell labels will not
be displayed and the observer will be passed back the point x, y,
and the label value
-
void start ()
-
Start the dwell thread
-
void startDwell ()
-
Start the dwell thread
-
void stop()
-
Stop the dwell thread
-
void stopDwell()
-
Stop the dwell thread