public class IlvMakeRectangleInteractor extends IlvDragRectangleInteractor implements IlvPermanentInteractorInterface
IlvRectangle
.
You can set an object factory on this interactor. When such a
factory is installed, it is responsible for creating the graphic
object as soon as the drag operation is finished.
The interactor has two modes: the Opaque mode and the
Ghost mode.
In Opaque mode, the IlvRectangle
object
that the user creates is drawn for each drag event.
In Ghost mode, the object is drawn only
when the user releases the mouse button.
The default mode is the Ghost mode.
Constructor and Description |
---|
IlvMakeRectangleInteractor()
Creates the interactor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addObject(IlvGraphic obj)
Adds the new object in the manager.
|
protected void |
detach()
Called when the interactor
is detached from the specified manager view.
|
protected void |
drawGhost(Graphics g)
Draws the rectangle while it is being dragged.
|
protected void |
fireRectangleDraggedEvent(IlvRect rectangle,
MouseEvent event)
Called by the interactor
when the mouse is released.
|
Color |
getBackground()
Returns the background color used to create the object.
|
Color |
getForeground()
Returns the foreground color used to create the object.
|
IlvRectangularObjectFactory |
getObjectFactory()
Returns the factory installed, if any.
|
boolean |
isCreationInSubManagersAllowed()
Returns
true if the creation of objects in submanagers
is allowed, and false otherwise. |
boolean |
isFillOn()
Returns
true if the inside of the created
object should be filled. |
boolean |
isGrapherMode()
Returns
true if the interactor is in grapher mode. |
boolean |
isPermanent()
Returns
false if the interactor will be removed from the
view once the object is created. |
boolean |
isSelectionMode()
Returns
true if the graphic object is
selected after creation, while the other objects are
deselected. |
boolean |
isStrokeOn()
Returns
true if the created
object should be stroked. |
boolean |
isXORGhost()
Returns the ghost drawing mode.
|
protected IlvGraphic |
makeObject(IlvRect rect)
Creates the
. |
protected void |
resizeObject(IlvGraphic obj,
IlvRect rect)
Resizes the graphic object.
|
void |
setBackground(Color color)
Changes the background color that is used to create the object.
|
void |
setCreationInSubManagersAllowed(boolean set)
Allows objects to be created in submanagers
(see
IlvManager.getManagers() ). |
void |
setFillOn(boolean set)
If
true , specifies that the inside of the created
object should be filled. |
void |
setForeground(Color color)
Changes the foreground color used to create the object.
|
void |
setGrapherMode(boolean value)
Sets the grapher mode value.
|
void |
setObjectFactory(IlvRectangularObjectFactory factory)
Installs a factory for the creation of the graphic object.
|
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 |
setSelectionMode(boolean select)
Enables the selection of the created graphic object and
the deselection of the other graphic objects contained
in the manager after the creation.
|
void |
setStrokeOn(boolean set)
When set to
true , specifies that the created
object should be stroked. |
addRectangleDraggedListener, attach, dragscroll, getCursor, getDraggedRectangle, getLineStyle, getRectangleAspectRatio, getStartDragModifier, getStartPoint, handleButtonDown, handleButtonDragged, handleButtonUp, isGridMode, isOpaqueMode, isRotationAllowed, isStartDragModifierDown, processMouseEvent, processMouseMotionEvent, removeRectangleDraggedListener, setCursor, setGridMode, setLineStyle, setOpaqueMode, setRectangleAspectRatio, setRotationAllowed, setStartDragModifier
adjustPointIfOutsideView, doAutoScroll, getMaximumScrollDistance, getScrollTiming, isProgressiveScroll, setMaximumScrollDistance, setProgressiveScroll, setScrollTiming, startDraggingScrollTimer, stopDraggingScrollTimer
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, processEvent, processFocusEvent, processKeyEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
public IlvMakeRectangleInteractor()
protected void detach()
detach
method of the parent class and performs additional cleaning
operations.detach
in class IlvDragRectangleInteractor
IlvManagerViewInteractor.attach(ilog.views.IlvManagerView)
protected void fireRectangleDraggedEvent(IlvRect rectangle, MouseEvent event)
makeObject
.
In ghost mode, it uses the object that has already been
created.
By default, the object is of type
.
If an object factory is attached, the type of the object
is determined by this factory.
IlvRectangle
The method calls addObject(ilog.views.IlvGraphic)
to add the created
object into the manager.
fireRectangleDraggedEvent
in class IlvDragRectangleInteractor
rectangle
- The rectangle that was dragged in the
manager coordinate system.event
- The mouse released event.makeObject(ilog.views.IlvRect)
,
setObjectFactory(ilog.views.interactor.IlvRectangularObjectFactory)
public void setCreationInSubManagersAllowed(boolean set)
IlvManager.getManagers()
). If creation in
submanagers is not allowed, the object is always created in the
IlvManager
displayed by the IlvManagerView
to which this interactor is attached.
The default value is true
.
public boolean isCreationInSubManagersAllowed()
true
if the creation of objects in submanagers
is allowed, and false
otherwise.protected void addObject(IlvGraphic obj)
addObject
on
the manager in default mode.
The method calls addNode
on the grapher in grapher mode if the
interactor is attached to a grapher view.
If the method isSelectionMode()
returns
true
and the created object is selected, the created
object is selected
(see IlvManager.setSelected(IlvGraphic, boolean, boolean)
)
and all the other objects are deselected
(see IlvManager.deSelectAll(boolean, boolean)
).
If the method isSelectionMode()
returns
true
and the created object is selectable
(IlvManager.isSelectable(IlvGraphic)
), the created object is selected
(see IlvManager.setSelected(IlvGraphic, boolean, boolean)
)
and all the other objects are deselected
(see IlvManager.deSelectAll(boolean, boolean)
).
obj
- The object to be added.setGrapherMode(boolean)
public final boolean isPermanent()
false
if the interactor will be removed from the
view once the object is created.
The default value is false
.isPermanent
in interface IlvPermanentInteractorInterface
public void setPermanent(boolean permanent)
false
.setPermanent
in interface IlvPermanentInteractorInterface
permanent
- the new mode.public boolean isXORGhost()
XOR
mode
when the method IlvDragRectangleInteractor.isOpaqueMode()
returns false
and to
force the Paint
mode when the method IlvDragRectangleInteractor.isOpaqueMode()
returns true
.isXORGhost
in class IlvDragRectangleInteractor
true
if the drawing needs to be performed in
XOR
mode, false
otherwise.IlvManagerViewInteractor.setXORGhost(boolean)
,
IlvManagerViewInteractor.handleExpose(java.awt.Graphics)
,
IlvManagerViewInteractor.drawGhost(java.awt.Graphics)
public void setSelectionMode(boolean select)
The default value is false
.
addObject(ilog.views.IlvGraphic)
public boolean isSelectionMode()
true
if the graphic object is
selected after creation, while the other objects are
deselected. Returns false
otherwise.
Objects that are not selectable
(see IlvManager.isSelectable(IlvGraphic)
are
not selected.
addObject(ilog.views.IlvGraphic)
public final void setObjectFactory(IlvRectangularObjectFactory factory)
createObject
method of the factory is called to create the object.getObjectFactory()
public IlvRectangularObjectFactory getObjectFactory()
protected IlvGraphic makeObject(IlvRect rect)
IlvRectangle
.
This method is called by the interactor to create the rectangle.
The default implementation creates an
if no
factory is installed; otherwise it calls the
IlvRectangle
method of the factory.createObject
public Color getForeground()
setForeground(java.awt.Color)
public void setForeground(Color color)
getForeground()
public Color getBackground()
setBackground(java.awt.Color)
public void setBackground(Color color)
getBackground()
public boolean isFillOn()
true
if the inside of the created
object should be filled.setFillOn(boolean)
public void setFillOn(boolean set)
true
, specifies that the inside of the created
object should be filled.isFillOn()
public boolean isStrokeOn()
true
if the created
object should be stroked.setStrokeOn(boolean)
public void setStrokeOn(boolean set)
true
, specifies that the created
object should be stroked.isStrokeOn()
public boolean isGrapherMode()
true
if the interactor is in grapher mode.
The default is false
.setGrapherMode(boolean)
public void setGrapherMode(boolean value)
true
, created objects will be
added to the grapher of the attached view with addNode
method.
If false
, they will be added with addObject
.isGrapherMode()
protected void drawGhost(Graphics g)
drawGhost(Graphics)
method of the
parent class.drawGhost
in class IlvDragRectangleInteractor
g
- The Graphics.IlvDragRectangleInteractor.setOpaqueMode(boolean)
protected void resizeObject(IlvGraphic obj, IlvRect rect)
IlvGraphic.moveResize(IlvRect)
.IlvDragRectangleInteractor.setOpaqueMode(boolean)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.