public class IlvMakeSDMNodeInteractor extends IlvManagerViewInteractor implements IlvPermanentInteractorInterface
IlvMakeNodeInteractor
lets the user
create nodes by clicking in an SDM view.Constructor and Description |
---|
IlvMakeSDMNodeInteractor()
Creates a new interactor that adds new nodes
to an SDM view.
|
Modifier and Type | Method and Description |
---|---|
protected void |
attach(IlvManagerView v)
This method is called when the interactor
is attached to the specified manager view.
|
protected IlvEditSDMLabelInteractor |
createEditLabelInteractor()
Factory to create the edit label interactor, used in
createNode(double, double) when autoEditLabel is true. |
protected void |
createNode(double x,
double y)
Creates the new node.
|
protected void |
detach()
This method is called when the interactor
is detached from the specified manager view.
|
Cursor |
getCursor()
Returns the cursor used for editing.
|
IlvSDMEngine |
getEngine()
Returns the SDM Engine attached to this interactor
|
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 nodes.
|
String |
getTag()
Returns the tag of the objects that will be created by this interactor.
|
void |
init()
Initializes the interactor.
|
boolean |
isAutoEditLabel()
Returns
true if this interactor is in "auto-edit-label" mode,
that is, if it will automatically install a label editing interactor as soon
as the new node is created. |
boolean |
isGridMode()
Returns
true if the interactor snaps the dragged rectangle
to the grid of the view; returns false otherwise. |
boolean |
isPermanent()
Returns
false if the interactor is removed from the
view once the object has been edited. |
protected void |
processKeyEvent(KeyEvent e)
Processes the key events.
|
protected void |
processMouseEvent(MouseEvent event)
Processes mouse events.
|
void |
setAutoEditLabel(boolean autoEditLabel)
Sets the "auto-edit-label" mode of this interactor.
|
void |
setCursor(Cursor cursor)
Changes the cursor used for editing.
|
void |
setGridMode(boolean value)
Changes the way the interactor works with the grid.
|
protected void |
setNodeProperties(IlvSDMModel model,
Object node)
Sets the initial properties of the newly created node.
|
void |
setPermanent(boolean permanent)
Specifies whether the interactor is removed from the view once
the object has been edited.
|
void |
setPrototypeObject(IlvSDMModel model,
Object object)
Sets the object that will be used as a prototype by this
interactor to create new nodes.
|
void |
setTag(String tag)
Sets the tag of the objects that will be created by this interactor.
|
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, isXORGhost, processEvent, processFocusEvent, processMouseMotionEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
public IlvMakeSDMNodeInteractor()
public void init()
public IlvSDMEngine getEngine()
public final boolean isGridMode()
true
if the interactor snaps the dragged rectangle
to the grid of the view; returns false
otherwise.setGridMode(boolean)
,
IlvGrid
public final void setGridMode(boolean value)
value
- Set to true
if you want the interactor to snap the dragged rectangle
to the grid of the view; set to false
otherwise.isGridMode()
,
IlvGrid
public final boolean isPermanent()
false
if the interactor is removed from the
view once the object has been edited.
The default value is false
.isPermanent
in interface IlvPermanentInteractorInterface
public final void setPermanent(boolean permanent)
false
.setPermanent
in interface IlvPermanentInteractorInterface
permanent
- false
if the interactor is removed from the view.public Cursor getCursor()
public void setCursor(Cursor cursor)
cursor
- The new cursor.public void setTag(String tag)
tag
- The tag of the objects.public String getTag()
public void setPrototypeObject(IlvSDMModel model, Object object)
model
- The data model that the object belongs to.object
- The prototype object.setNodeProperties(ilog.views.sdm.IlvSDMModel, java.lang.Object)
,
setTag(java.lang.String)
public IlvSDMModel getPrototypeModel()
public Object getPrototypeObject()
public boolean isAutoEditLabel()
true
if this interactor is in "auto-edit-label" mode,
that is, if it will automatically install a label editing interactor as soon
as the new node is created.public void setAutoEditLabel(boolean autoEditLabel)
autoEditLabel
- The new value of the auto-edit-label flag.createEditLabelInteractor()
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 processMouseEvent(MouseEvent event)
processMouseEvent
in class IlvManagerViewInteractor
event
- The event.IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)
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)
protected void createNode(double x, double y)
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 IlvSDMEngine.isDropToGroupEnabled()
returns true
, the new node is created as a child of the
parent object located at the specified coordinates.
If IlvSDMEngine.isDropToGroupEnabled()
returns false
, or if no parent is at the specified
location, the new node is created at the top level of the model.
x
- The x-position in manager coordinates.y
- The y-position in manager coordinates.protected IlvEditSDMLabelInteractor createEditLabelInteractor()
createNode(double, double)
when autoEditLabel is true.IlvEditSDMLabelInteractor
setAutoEditLabel(boolean)
protected void setNodeProperties(IlvSDMModel model, Object node)
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.
If the prototype object has children, the children are also copied.
model
- The data model of the SDM engine.node
- The node that has just been created by this interactor.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.