public class IlvMakeSDMLinkInteractor extends IlvMakeLinkInteractor implements IlvLinkImageFactory
IlvMakeSDMLinkInteractor
lets the user
create links by clicking in an SDM view.Constructor and Description |
---|
IlvMakeSDMLinkInteractor()
Creates a new interactor that adds new links
to an SDM view.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptDestination(IlvPoint p,
IlvGraphic toNode)
This method tests whether a node can be the destination of the link.
|
protected boolean |
acceptOrigin(IlvPoint p,
IlvGraphic fromNode)
This method tests whether a node can be the origin of the link.
|
protected void |
addPolyPoints(IlvGraphic obj)
Adds the new link inside the grapher.
|
protected void |
attach(IlvManagerView v)
This method is called when the interactor
is attached to the specified manager view.
|
IlvLinkImage |
createObject(IlvGraphic from,
IlvGraphic to,
IlvPoint[] points,
boolean oriented)
Implementation of
IlvLinkImageFactory . |
protected IlvLinkImage |
createObjectInOpaqueMode(IlvGraphic from,
IlvGraphic to,
IlvPoint[] points,
boolean oriented)
This method is called by
createObject(ilog.views.IlvGraphic, ilog.views.IlvGraphic, ilog.views.IlvPoint[], boolean) when the interactor is
in Opaque mode, to create the temporary link drawn to show
feedback during the interaction. |
protected void |
detach()
This method is called when the interactor
is detached from the specified manager view.
|
protected Object |
getCompositeChild(IlvGraphic obj,
IlvPoint p) |
IlvSDMEngine |
getEngine()
Returns the SDM Engine attached to this interactor.
|
Object |
getFromObject()
Returns the SDM model object that will be the origin of the newly created link.
|
Class<?> |
getLinkImageClass()
Implementation of
IlvLinkImageFactory . |
IlvSDMModel |
getPrototypeModel()
Returns the data model that the prototype object belongs to.
|
Object |
getPrototypeObject()
Returns the prototype object used by this interactor
to create new links.
|
String |
getTag()
Returns the tag of the objects that will be created by this interactor.
|
Object |
getToObject()
Returns the SDM model object that will be the destination of the newly created link.
|
protected void |
highlight(IlvGraphic obj)
Highlights a node when moving over it.
|
protected IlvGraphic |
makePolyPoint(IlvPoint[] points)
Called to create the link instance.
|
protected void |
processKeyEvent(KeyEvent e)
Processes the key events.
|
protected void |
react(IlvPoint p)
Highlights or unhighlights the node
under the specified point.
|
protected void |
setLinkProperties(IlvSDMModel model,
Object link)
Sets the initial properties of the newly created link.
|
void |
setPrototypeObject(IlvSDMModel model,
Object object)
Sets the object that will be used as a prototype by this
interactor to create new links.
|
void |
setTag(String tag)
Sets the tag of the objects that will be created by this interactor.
|
protected void |
unHighlight(IlvGraphic obj)
Unhighlights a node when moving over another node.
|
accept, doIt, drawGhost, endOnDoubleClick, getFrom, getGrapher, getLinkClass, getLinkFactory, getTo, isGridMode, isOriented, isSelectionMode, isSelfLinkAllowed, numberOfPointsReached, reInitialize, setLinkFactory, setOriented, setSelectionMode, setSelfLinkAllowed
allowsMultiplePoints, allowsMultiplePoints, count, getBackground, getCursor, getForeground, getMinPointsDistance, getObjectFactory, getPoints, isAllowingMultiplePoints, isCreationInSubManagersAllowed, isGrapherMode, isOpaqueMode, isPermanent, isXORGhost, processMouseEvent, processMouseMotionEvent, setAllowingMultiplePoints, setBackground, setCreationInSubManagersAllowed, setCursor, setForeground, setGrapherMode, setGridMode, setMinPointsDistance, setObjectFactory, setOpaqueMode, setPermanent
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, processEvent, processFocusEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
public IlvMakeSDMLinkInteractor()
public IlvSDMEngine getEngine()
public void setTag(String tag)
tag
- The new tag.public String getTag()
public void setPrototypeObject(IlvSDMModel model, Object object)
model
- The data model the object belongs to.object
- The prototype object.public IlvSDMModel getPrototypeModel()
public Object getPrototypeObject()
protected void attach(IlvManagerView v)
attach
in class IlvMakeLinkInteractor
v
- The manager view.IlvMakePolyPointsInteractor.detach()
protected void detach()
detach
in class IlvMakePolyPointsInteractor
IlvManagerViewInteractor.attach(ilog.views.IlvManagerView)
public IlvLinkImage createObject(IlvGraphic from, IlvGraphic to, IlvPoint[] points, boolean oriented)
IlvLinkImageFactory
.
Creates a new link.
If a prototype object was set using
setPrototypeObject(ilog.views.sdm.IlvSDMModel, java.lang.Object)
, the new object is a copy of
the prototype object. Otherwise, the object is a new object
with the tag specified by setTag(java.lang.String)
.
If this interactor is in Opaque mode, and if this
method is being called to create the temporary link drawn to
show feedback during the interaction, then the method
createObjectInOpaqueMode(ilog.views.IlvGraphic, ilog.views.IlvGraphic, ilog.views.IlvPoint[], boolean)
is called to create the
temporary link.
If IlvSDMEngine.isDropToGroupEnabled()
returns true
, the new link is created as a child of the
common ancestor of the source and target nodes.
If IlvSDMEngine.isDropToGroupEnabled()
returns false
or if the source and target nodes
have no common ancestor, the link is created at the top level
of the model.
createObject
in interface IlvLinkImageFactory
from
- The start node of the link.to
- The end node of the link.points
- The points defining the link.oriented
- true
if the link must end with an arrow showing
the orientation.IlvMakePolyPointsInteractor.setOpaqueMode(boolean)
,
createObjectInOpaqueMode(ilog.views.IlvGraphic, ilog.views.IlvGraphic, ilog.views.IlvPoint[], boolean)
public Object getFromObject()
setLinkProperties(ilog.views.sdm.IlvSDMModel, java.lang.Object)
, to set
special properties on a link according to its origin node.public Object getToObject()
setLinkProperties(ilog.views.sdm.IlvSDMModel, java.lang.Object)
, to set
special properties on a link according to its destination node.protected IlvLinkImage createObjectInOpaqueMode(IlvGraphic from, IlvGraphic to, IlvPoint[] points, boolean oriented)
createObject(ilog.views.IlvGraphic, ilog.views.IlvGraphic, ilog.views.IlvPoint[], boolean)
when the interactor is
in Opaque mode, to create the temporary link drawn to show
feedback during the interaction.
By default, this method returns a new instance of
IlvGeneralLink
.
You can override this method to create a different link or to customize the link.
from
- The start node of the link.to
- The end node of the link.points
- The points defining the link.oriented
- true
if the link must end with an arrow showing
the orientation.IlvMakePolyPointsInteractor.setOpaqueMode(boolean)
,
createObject(ilog.views.IlvGraphic, ilog.views.IlvGraphic, ilog.views.IlvPoint[], boolean)
protected void setLinkProperties(IlvSDMModel model, Object link)
This basic implementation copies the properties of
the prototype object specified by a call to setPrototypeObject(ilog.views.sdm.IlvSDMModel, java.lang.Object)
.
If no prototype object was specified, this method does nothing.
model
- The data model of the SDM engine.link
- The link that has just been created by this interactor.protected boolean acceptOrigin(IlvPoint p, IlvGraphic fromNode)
acceptOrigin
in class IlvMakeLinkInteractor
p
- The point clicked, in manager coordinates.fromNode
- The origin node to test.acceptDestination(ilog.views.IlvPoint, ilog.views.IlvGraphic)
protected boolean acceptDestination(IlvPoint p, IlvGraphic toNode)
acceptDestination
in class IlvMakeLinkInteractor
p
- The point clicked, in manager coordinates.toNode
- The destination node to test.IlvMakeLinkInteractor.isSelfLinkAllowed()
,
IlvMakeLinkInteractor.getFrom()
protected void react(IlvPoint p)
IlvMakeLinkInteractor
react
in class IlvMakeLinkInteractor
p
- The point in the coordinate space of the manager.protected Object getCompositeChild(IlvGraphic obj, IlvPoint p)
protected void highlight(IlvGraphic obj)
highlight
in class IlvMakeLinkInteractor
obj
- The node.protected void unHighlight(IlvGraphic obj)
unHighlight
in class IlvMakeLinkInteractor
obj
- The node.protected IlvGraphic makePolyPoint(IlvPoint[] points)
makePolyPoint
in class IlvMakeLinkInteractor
points
- The selected points in the object's coordinate space.IlvLinkImage
(or a subclass), or null
if the factory
returns a null
object.IlvMakeLinkInteractor.setLinkFactory(ilog.views.interactor.IlvLinkImageFactory)
,
IlvMakePolyPointsInteractor.setBackground(java.awt.Color)
,
IlvMakePolyPointsInteractor.setForeground(java.awt.Color)
protected void addPolyPoints(IlvGraphic obj)
addPolyPoints
in class IlvMakeLinkInteractor
obj
- The new link.IlvMakePolyPointsInteractor.setGrapherMode(boolean)
public Class<?> getLinkImageClass()
IlvLinkImageFactory
.
Returns the class of the link that is created by createObject
.getLinkImageClass
in interface IlvLinkImageFactory
protected void processKeyEvent(KeyEvent e)
IlvManagerViewInteractor
KeyListener
registered with this interactor (if any).processKeyEvent
in class IlvManagerViewInteractor
e
- The event.IlvManagerViewInteractor.addKeyListener(java.awt.event.KeyListener)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.