public class InteractiveFigureViewDelegate extends FigureViewDelegate implements InteractiveFigureViewManager
Details:
An InteractiveFigureViewDelegate
provides generic figure drawing and mouse support to a InteractiveFigureView
, thus allowing the InteractiveFigureView
to become a view of the figure.
The features offered in this class are generic and useful for implementing figure views in any GUI platform, including AWT, Swing, and SWT.
To access platform-
Any UI component that implements InteractiveFigureView
can become a view of a Figure
by creating a private, concrete instance of this class and decorating it with the desired public methods (read up on the "decorator design pattern," if necessary).
Minimally, only the original widget's paint requests need to be forwarded to this class.
A FigureViewDelegate
can render its figure in any translation, scale, or rotation.
Methods provided in this class make it possible to change the view's orientation at any time.
A FigureViewDelegate
also maintains a registry of FigMouseListener
s, sending them FigMouseEvent
s whenever applicable mouse events occur.
mFigure, mTransform, mWidget
Constructor and Description |
---|
InteractiveFigureViewDelegate(InteractiveFigureView iCanvas,
FigureTransform iTransform) |
Modifier and Type | Method and Description |
---|---|
void |
addMouseButtonListener(Doodle iDoodle,
FigMouseButtonListener iListener)
Registers mouse button listener.
|
void |
addMouseMotionListener(Doodle iDoodle,
FigMouseMotionListener iListener)
Registers mouse motion listener.
|
void |
addMouseWheelListener(Doodle iDoodle,
FigMouseWheelListener iListener)
Registers mouse wheel listener.
|
void |
addTransformInteractor(TransformInteractor iInteractor)
Attaches transform interactor.
|
protected FigMouseEvent.ConstructorForm |
createFigMouseEventForm(EventObject iEvent,
int iX,
int iY)
Prepares parameter form for FigMouseEvent constructor.
|
void |
dispose() |
void |
doodleRemoved(Figure iFigure,
Doodle iDoodle)
Doodle was removed from figure.
|
Object |
getCachedHint(Object iKey) |
protected void |
mouseMoved(FigMouseEvent iEvent) |
protected void |
mousePressed(FigMouseEvent iEvent) |
protected void |
mouseReleased(FigMouseEvent iEvent) |
void |
mouseWheelMoved(FigMouseEvent iEvent) |
void |
removeMouseButtonListener(Doodle iDoodle,
FigMouseButtonListener iListener)
Unregisters mouse button listener.
|
void |
removeMouseMotionListener(Doodle iDoodle,
FigMouseMotionListener iListener)
Unregisters mouse motion listener.
|
void |
removeMouseWheelListener(Doodle iDoodle,
FigMouseWheelListener iListener)
Unregisters mouse wheel listener.
|
void |
removeTransformInteractor(TransformInteractor iInteractor)
Detaches transform interactor.
|
void |
setCachedHint(Object iKey,
Object iValue) |
doodleAdded, doodleChanged, getDetailLevel, getFigure, getTransform, paint, setDetailLevel, setFigure
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDetailLevel, getFigure, getTransform, paint, setDetailLevel, setFigure
public InteractiveFigureViewDelegate(InteractiveFigureView iCanvas, FigureTransform iTransform)
public final void addTransformInteractor(TransformInteractor iInteractor)
InteractiveFigureViewManager
Details: This method attaches the given transform interactor to the view.
addTransformInteractor
in interface InteractiveFigureViewManager
iInteractor
- the interactorpublic final void removeTransformInteractor(TransformInteractor iInteractor)
InteractiveFigureViewManager
Details: This method detaches the given transform interactor from the view.
removeTransformInteractor
in interface InteractiveFigureViewManager
iInteractor
- the interactorpublic final void addMouseButtonListener(Doodle iDoodle, FigMouseButtonListener iListener)
InteractiveFigureViewManager
Details: This method registers the given mouse button listener with the view and given doodle. When mouse button events occur in this view over the given doodle, those events will be transmitted to the listener through its callback methods.
addMouseButtonListener
in interface InteractiveFigureViewManager
iDoodle
- the doodleiListener
- the listenerpublic final void removeMouseButtonListener(Doodle iDoodle, FigMouseButtonListener iListener)
InteractiveFigureViewManager
Details: This method unregisters the given mouse button listener from the view and given doodle. The listener will no longer receive events related to the view and given doodle.
removeMouseButtonListener
in interface InteractiveFigureViewManager
iDoodle
- the doodleiListener
- the listenerprotected void mousePressed(FigMouseEvent iEvent)
protected void mouseReleased(FigMouseEvent iEvent)
public final void addMouseMotionListener(Doodle iDoodle, FigMouseMotionListener iListener)
InteractiveFigureViewManager
Details: This method registers the given mouse motion listener with the view and given doodle. When mouse motion events occur in this view over the given doodle, those events will be transmitted to the listener through its callback methods.
addMouseMotionListener
in interface InteractiveFigureViewManager
iDoodle
- the doodleiListener
- the listenerpublic final void removeMouseMotionListener(Doodle iDoodle, FigMouseMotionListener iListener)
InteractiveFigureViewManager
Details: This method unregisters the given mouse motion listener from the view and given doodle. The listener will no longer receive events related to the view and given doodle.
removeMouseMotionListener
in interface InteractiveFigureViewManager
iDoodle
- the doodleiListener
- the listenerprotected void mouseMoved(FigMouseEvent iEvent)
public final void addMouseWheelListener(Doodle iDoodle, FigMouseWheelListener iListener)
InteractiveFigureViewManager
Details: This method registers the given mouse motion listener with the view and given doodle. When mouse wheel events (i.e. rotations) occur in this view over the given doodle, those events will be transmitted to the listener through its callback methods.
addMouseWheelListener
in interface InteractiveFigureViewManager
iDoodle
- the doodleiListener
- the listenerpublic final void removeMouseWheelListener(Doodle iDoodle, FigMouseWheelListener iListener)
InteractiveFigureViewManager
Details: This method unregisters the given mouse wheel listener from the view and given doodle. The listener will no longer receive events related to the view and given doodle.
removeMouseWheelListener
in interface InteractiveFigureViewManager
iDoodle
- the doodleiListener
- the listenerpublic void mouseWheelMoved(FigMouseEvent iEvent)
public void doodleRemoved(Figure iFigure, Doodle iDoodle)
FigureObserver
Details:
doodleRemoved
notifies this listener that a doodle was removed from the figure.
This callback will always be followed by a call to FigureObserver.doodleChanged(Figure, Doodle)
, so it is not critical to respond to this message.
doodleRemoved
in interface FigureObserver
doodleRemoved
in class FigureViewDelegate
iFigure
- affected figureiDoodle
- removed doodlepublic void dispose()
protected final FigMouseEvent.ConstructorForm createFigMouseEventForm(EventObject iEvent, int iX, int iY)
Details:
This method creates, fills out, and returns a new parameter form for the FigMouseEvent
constructor.
iEvent
- the platform eventiX
- physical x-coordinate of eventiY
- physical y-coordinate of eventCopyright © 2013. All Rights Reserved.