public class IlvMakePolyPointsInteractor extends IlvManagerViewInteractor implements IlvPermanentInteractorInterface
makePolyPoint(ilog.views.IlvPoint[])
is called. This method will create an
IlvPolyline
. You can
customize the class by setting a factory to create your own type
of graphic object (note that the object must implement the
interface IlvPolyPointsInterface
).Constructor and Description |
---|
IlvMakePolyPointsInteractor()
Creates and initializes the interactor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(IlvPoint p)
Checks whether a point may be added at this location.
|
protected void |
addPolyPoints(IlvGraphic obj)
Adds the object to the manager.
|
boolean |
allowsMultiplePoints()
Deprecated.
Use
isAllowingMultiplePoints . |
void |
allowsMultiplePoints(boolean allow)
Deprecated.
Use
setAllowingMultiplePoints . |
protected void |
attach(IlvManagerView v)
This method is called when the
interactor is attached to the manager view.
|
int |
count()
Returns the number of points actually created.
|
protected void |
detach()
This method is called when the interactor
is detached from the view.
|
protected void |
doIt()
Called when all points are selected.
|
protected void |
drawGhost(Graphics g)
Draws a polyline as the points are being selected.
|
protected boolean |
endOnDoubleClick()
Returns
true if the interactor will stop
requesting points when the user performs a double-click. |
Color |
getBackground()
Returns the background color that is used when creating the polypoint.
|
Cursor |
getCursor()
Returns the cursor used for editing.
|
Color |
getForeground()
Returns the foreground color used when creating the polypoint.
|
double |
getMinPointsDistance()
Returns the minimum distance between two created
points.
|
IlvPolyPointsObjectFactory |
getObjectFactory()
Returns the factory installed, if any.
|
protected IlvPoint[] |
getPoints(boolean transformed)
Returns an array of the points that have already been created.
|
boolean |
isAllowingMultiplePoints()
Returns
true if the interactor allows
more than two points to be entered. |
boolean |
isCreationInSubManagersAllowed()
Returns
true if the creation of objects in submanagers
is allowed, and false otherwise. |
boolean |
isGrapherMode()
Returns
true if the interactor is in grapher mode. |
boolean |
isGridMode()
Returns
true if the interactor snaps the points
to the grid of the view; false otherwise. |
boolean |
isOpaqueMode()
Returns an indication of whether the interactor is in Opaque mode
or not.
|
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 |
isXORGhost()
Returns the ghost drawing mode.
|
protected IlvGraphic |
makePolyPoint(IlvPoint[] points)
Called to create the polypoint object.
|
protected boolean |
numberOfPointsReached()
Returns
true if the number of desired points is reached. |
protected void |
processMouseEvent(MouseEvent event)
Processes the mouse events.
|
protected void |
processMouseMotionEvent(MouseEvent event)
Processes the mouse motion events.
|
protected void |
react(IlvPoint p)
Allows you to implement an interaction when the user moves the
mouse to add a point to the polypoint.
|
protected void |
reInitialize()
Reinitializes the interactor.
|
void |
setAllowingMultiplePoints(boolean allow)
Changes the number of points the user can select
with the interactor.
|
void |
setBackground(Color color)
Changes the background color that is used when creating the polypoint.
|
void |
setCreationInSubManagersAllowed(boolean set)
Allows objects to be created in submanagers
(see
IlvManager.getManagers() ). |
void |
setCursor(Cursor cursor)
Changes the cursor used for editing.
|
void |
setForeground(Color color)
Changes the foreground color that is used when creating the polypoint.
|
void |
setGrapherMode(boolean value)
Sets the grapher mode value.
|
void |
setGridMode(boolean value)
Changes the way the interactor works with the grid.
|
void |
setMinPointsDistance(double minDist)
Sets the minimum distance between two consecutive points.
|
void |
setObjectFactory(IlvPolyPointsObjectFactory factory)
Installs a factory for the creation of the graphic object.
|
void |
setOpaqueMode(boolean set)
Sets the interactor in Opaque mode.
|
void |
setPermanent(boolean permanent)
Specifies if the interactor will 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.
|
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, processEvent, processFocusEvent, processKeyEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
public IlvMakePolyPointsInteractor()
public boolean isGridMode()
true
if the interactor snaps the points
to the grid of the view; false
otherwise. The default value
is true
.IlvGrid
public final void setGridMode(boolean value)
value
- Must be set to false
if you do not want the interactor to snap the points
to the grid of the view; true
otherwise. The default
value is true
.IlvGrid
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 final void setPermanent(boolean permanent)
false
.setPermanent
in interface IlvPermanentInteractorInterface
permanent
- the new mode.public final void setMinPointsDistance(double minDist)
5
.getMinPointsDistance()
public final double getMinPointsDistance()
5
.setMinPointsDistance(double)
protected void attach(IlvManagerView v)
attach
in class IlvManagerViewInteractor
v
- The manager view.IlvManagerViewInteractor.detach()
protected void detach()
detach
in class IlvManagerViewInteractor
IlvManagerViewInteractor.attach(ilog.views.IlvManagerView)
protected void reInitialize()
public Cursor getCursor()
public void setCursor(Cursor cursor)
@Deprecated public boolean allowsMultiplePoints()
isAllowingMultiplePoints
.true
if the interactor allows
more than two points to be entered.
The default implementation returns true
.public boolean isAllowingMultiplePoints()
true
if the interactor allows
more than two points to be entered.
The default value is true
.setAllowingMultiplePoints(boolean)
@Deprecated public void allowsMultiplePoints(boolean allow)
setAllowingMultiplePoints
.allow
- If true
then the interactor allows
selecting several points; otherwise only two points are allowed.public void setAllowingMultiplePoints(boolean allow)
allow
- If true
then the interactor allows
selecting several points; otherwise only two points are allowed.isAllowingMultiplePoints()
public final int count()
protected IlvPoint[] getPoints(boolean transformed)
null
if no points have been created.transformed
- If true
the points are transformed
by the current transformer of the manager view.protected boolean numberOfPointsReached()
true
if the number of desired points is reached.
This method returns true
if the interactor allows only two
points to be selected (see the isAllowingMultiplePoints
member
function) and two points have been selected.isAllowingMultiplePoints()
protected boolean endOnDoubleClick()
true
if the interactor will stop
requesting points when the user performs a double-click.
The default implementation returns true
when the interactor
allows more than two points to be entered; otherwise it returns
false
.isAllowingMultiplePoints()
protected boolean accept(IlvPoint p)
true
.p
- The point, in manager coordinates.protected void react(IlvPoint p)
protected void processMouseEvent(MouseEvent event)
processMouseEvent
in class IlvManagerViewInteractor
event
- The event.IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)
protected void processMouseMotionEvent(MouseEvent event)
processMouseMotionEvent
in class IlvManagerViewInteractor
event
- The event.IlvManagerViewInteractor.addMouseMotionListener(java.awt.event.MouseMotionListener)
public Color getForeground()
public void setForeground(Color color)
public Color getBackground()
public void setBackground(Color color)
public void setOpaqueMode(boolean set)
reInitialize()
.
You should set the Opaquemode before the interactor is activated.isOpaqueMode()
,
IlvManagerViewInteractor.setXORGhost(boolean)
public boolean isOpaqueMode()
setOpaqueMode(boolean)
,
IlvManagerViewInteractor.setXORGhost(boolean)
public boolean isXORGhost()
Paint
mode (not XOR
mode) when the method isOpaqueMode()
returns true
.isXORGhost
in class IlvManagerViewInteractor
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)
true
.addPolyPoints(ilog.views.IlvGraphic)
public boolean isSelectionMode()
true
if the graphic object is
selected after creation, while the other objects are
deselected. Returns false
otherwise.
IlvManager.isSelectable(IlvGraphic)
are
not selected.addPolyPoints(ilog.views.IlvGraphic)
public final void setObjectFactory(IlvPolyPointsObjectFactory factory)
createObject
method of the factory is called to create the object.getObjectFactory()
public final IlvPolyPointsObjectFactory getObjectFactory()
protected IlvGraphic makePolyPoint(IlvPoint[] points)
IlvPolyline
object
is created. The foreground and background colors are set on
the object.points
- The selected points in the object's coordinate space.setObjectFactory(ilog.views.interactor.IlvPolyPointsObjectFactory)
,
setBackground(java.awt.Color)
,
setForeground(java.awt.Color)
protected void doIt()
makePolyPoint(ilog.views.IlvPoint[])
to create
the object.
In ghost mode, it uses the object that has already been
created.
The method adds the created object to the manager using
the method addPolyPoints(ilog.views.IlvGraphic)
.protected void drawGhost(Graphics g)
drawGhost
in class IlvManagerViewInteractor
g
- The graphics context.
Its current color is already set to the view's default ghost
color, see IlvManagerView.getDefaultGhostColor()
.
Also, in XOR ghost drawing mode, the graphics context is already
set to XOR mode, with the view's default XOR color, see
IlvManagerView.getDefaultXORColor()
.setOpaqueMode(boolean)
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.
true
public boolean isCreationInSubManagersAllowed()
true
if the creation of objects in submanagers
is allowed, and false
otherwise.protected void addPolyPoints(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.
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 polypoint object.setGrapherMode(boolean)
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 IlvGrapher.addNode(ilog.views.IlvGraphic, boolean)
method.
If false
, they will be added with IlvManager.addObject(ilog.views.IlvGraphic, int, boolean)
.value
- The value to be set.isGrapherMode()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.