public class IlvMagnifyInteractor extends IlvManagerViewInteractor implements IlvPermanentInteractorInterface
RECTANGULAR or a circle when the mode is set to CIRCULAR
or LENS.
This interactor can be directly used on an IlvManagerView (waiting
for the user to press a mouse button) or
it can be used inside another interactor. For example, if you want to
show the magnifier when pressing the mouse down with the Alt key as modifier
during the work of the IlvSelectInteractor you can subclass this
interactor to do the following:
public MagSelectInteractor extends IlvSelectInteractor
{
IlvMagnifyInteractor inter = null;
protected void processMouseEvent(MouseEvent e)
{
if (e.getID() == MouseEvent.MOUSE_PRESSED && e.isAltDown()) {
if (!dispatchToSelection(e)) {
if (inter == null) {
inter = new IlvMagnifyInteractor() ;
inter.setFactor(2.5);
}
getManagerView().pushInteractor(inter, e);
}
} else
super.processMouseEvent(e);
}
}
Notice that the LENS mode may consume a large amount of memory if the magnification factor is high and the size of the magnification area is large. In LENS mode, the amount of memory is quadratic proportional to the magnification factor and to the size. RECTANGULAR and CIRCULAR mode use less memory since the amount of memory is only proportional to the size but not influenced by the magnification factor.
setMode(short),
IlvManagerView.pushInteractor(ilog.views.IlvManagerViewInteractor, java.awt.AWTEvent),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static short |
CIRCULAR
The area of magnification is a regular circle.
|
static short |
LENS
The area of magnification is a circle which preserves the continuity
between the magnification area and the view.
|
static short |
RECTANGULAR
The area of magnification is a rectangle.
|
| Constructor and Description |
|---|
IlvMagnifyInteractor()
Constructs and initializes a new instance of the
IlvMagnifyInteractor. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
attach(IlvManagerView view)
Called when the interactor is attached to the manager view.
|
protected void |
detach()
Called when the interactor is detached from the view.
|
protected void |
drawMagnifier(Graphics g)
Draws the magnifier.
|
protected IlvRect |
getDrawingRect()
Returns a copy of the rectangle representing the area
in which the magnifier is drawn.
|
double |
getFactor()
Returns the magnification factor used by the interactor.
|
Color |
getFrameColor()
Returns the color of the frame drawn around the magnified area.
|
short |
getMode()
Returns the mode used to draw the magnification area.
|
int |
getSize()
Returns the size of the magnification area in manager view coordinates.
|
protected void |
handleExpose(Graphics g)
Called by the view when the view
is drawn,;it actually calls the method that draws the magnifier
using
drawMagnifier(java.awt.Graphics). |
boolean |
isPermanent()
Returns
false if the interactor will be removed from the
view once the object was created. |
protected void |
processMouseEvent(MouseEvent e)
Processes the mouse events.
|
protected void |
processMouseMotionEvent(MouseEvent e)
Processes the mouse motion events.
|
void |
setFactor(double factor)
Sets the magnification factor used by the interactor.
|
void |
setFrameColor(Color c)
Sets the color of the frame drawn around the magnified area.
|
void |
setMode(short mode)
Sets the mode used to draw the magnification area.
|
void |
setPermanent(boolean permanent)
Allows you to specify if the interactor will or will not be removed
from the view once the object is created.
|
void |
setSize(int size)
Sets the size of the magnification area.
|
protected void |
update()
Called by
handleExpose(Graphics) when it becomes necessary to update the magnified view. |
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, isXORGhost, processEvent, processFocusEvent, processKeyEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhostpublic static final short RECTANGULAR

setMode(short),
Constant Field Valuespublic static final short CIRCULAR

setMode(short),
Constant Field Valuespublic static final short LENS

setMode(short),
Constant Field Valuespublic IlvMagnifyInteractor()
IlvMagnifyInteractor.protected void attach(IlvManagerView view)
attach in class IlvManagerViewInteractorview - The manager view.IlvManagerViewInteractor.detach()protected void detach()
detach in class IlvManagerViewInteractorIlvManagerViewInteractor.attach(ilog.views.IlvManagerView)public final void setSize(int size)
size - The size to be set, in manager view coordinate values.getSize()public final int getSize()
128.setSize(int)public final void setMode(short mode)
Notice that the LENS mode may consume a large amount of memory if the magnification factor is high and the size is large. In LENS mode, the amount of memory is quadratic proportional to the magnification factor and to the size. RECTANGULAR and CIRCULAR mode use less memory since the amount of memory is only proportional to the size but not influenced by the magnification factor.
mode - The magnification mode: RECTANGULAR (the default),
CIRCULAR, or LENS.RECTANGULAR,
CIRCULAR,
LENS,
getMode()public final short getMode()
setMode(short)public final void setFactor(double factor)
1 and smaller or equal to
4.factor - The magnification factor as a value from 1
through 4.getFactor()public final double getFactor()
setFactor(double)public final void setFrameColor(Color c)
c - The color of the frame. Should not be transparent and not
null.getFrameColor()public final Color getFrameColor()
setFrameColor(java.awt.Color)protected void processMouseEvent(MouseEvent e)
processMouseEvent in class IlvManagerViewInteractore - The mouse event.IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)protected void processMouseMotionEvent(MouseEvent e)
processMouseMotionEvent in class IlvManagerViewInteractore - The mouse motion event.IlvManagerViewInteractor.addMouseMotionListener(java.awt.event.MouseMotionListener)protected void handleExpose(Graphics g)
drawMagnifier(java.awt.Graphics).handleExpose in class IlvManagerViewInteractorg - The view graphics.IlvManagerViewInteractor.drawGhost(java.awt.Graphics),
IlvManagerViewInteractor.isXORGhost(),
IlvManagerView.getDefaultXORColor()protected void update()
handleExpose(Graphics) when it becomes necessary to update the magnified view.protected IlvRect getDrawingRect()
protected void drawMagnifier(Graphics g)
getDrawingRect() method to return a rectangle containing
the additional drawings.g - The view graphics.public final boolean isPermanent()
false if the interactor will be removed from the
view once the object was created.
The default value is false.isPermanent in interface IlvPermanentInteractorInterfacepublic final void setPermanent(boolean permanent)
false.setPermanent in interface IlvPermanentInteractorInterfacepermanent - If true the interactor will be removed,
otherwise not.© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.