ilog.views.sdm.interactor
Class IlvMakeSDMNodeInteractor

java.lang.Object
  extended by ilog.views.IlvManagerViewInteractor
      extended by ilog.views.sdm.interactor.IlvMakeSDMNodeInteractor
All Implemented Interfaces:
IlvPermanentInteractorInterface, Serializable

public class IlvMakeSDMNodeInteractor
extends IlvManagerViewInteractor
implements IlvPermanentInteractorInterface

The class IlvMakeNodeInteractor lets the user create nodes by clicking in an SDM view.

Since:
JViews 4.0
See Also:
Serialized Form

Constructor Summary
IlvMakeSDMNodeInteractor()
          Creates a new interactor that adds new nodes to an SDM view.
 
Method Summary
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(float, float) when autoEditLabel is true.
protected  void createNode(float x, float 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.
 
Methods inherited from class ilog.views.IlvManagerViewInteractor
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvMakeSDMNodeInteractor

public IlvMakeSDMNodeInteractor()
Creates a new interactor that adds new nodes to an SDM view.

Method Detail

init

public void init()
Initializes the interactor. This method is called by the constructor.


getEngine

public IlvSDMEngine getEngine()
Returns the SDM Engine attached to this interactor

Since:
JViews 6.0

isGridMode

public final boolean isGridMode()
Returns true if the interactor snaps the dragged rectangle to the grid of the view; returns false otherwise.

See Also:
setGridMode(boolean), IlvGrid

setGridMode

public final void setGridMode(boolean value)
Changes the way the interactor works with the grid.

Parameters:
value - Set to true if you want the interactor to snap the dragged rectangle to the grid of the view; set to false otherwise.
See Also:
isGridMode(), IlvGrid

isPermanent

public final boolean isPermanent()
Returns false if the interactor is removed from the view once the object has been edited. The default value is false.

Specified by:
isPermanent in interface IlvPermanentInteractorInterface

setPermanent

public final void setPermanent(boolean permanent)
Specifies whether the interactor is removed from the view once the object has been edited. The default value is false.

Specified by:
setPermanent in interface IlvPermanentInteractorInterface
Parameters:
permanent - false if the interactor is removed from the view.

getCursor

public Cursor getCursor()
Returns the cursor used for editing.


setCursor

public void setCursor(Cursor cursor)
Changes the cursor used for editing.

Parameters:
cursor - The new cursor.

setTag

public void setTag(String tag)
Sets the tag of the objects that will be created by this interactor.

Parameters:
tag - The tag of the objects.

getTag

public String getTag()
Returns the tag of the objects that will be created by this interactor.


setPrototypeObject

public void setPrototypeObject(IlvSDMModel model,
                               Object object)
Sets the object that will be used as a prototype by this interactor to create new nodes. Only the prototype tag and properties will be copied to new nodes.

Parameters:
model - The data model that the object belongs to.
object - The prototype object.
See Also:
setNodeProperties(ilog.views.sdm.IlvSDMModel, java.lang.Object), setTag(java.lang.String)

getPrototypeModel

public IlvSDMModel getPrototypeModel()
Returns the data model that the prototype object belongs to.


getPrototypeObject

public Object getPrototypeObject()
Returns the prototype object used by this interactor to create new nodes.


isAutoEditLabel

public 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.

Since:
JViews 6.0

setAutoEditLabel

public void setAutoEditLabel(boolean autoEditLabel)
Sets the "auto-edit-label" mode of this interactor. In auto-edit-label mode, the interactor will automatically install a label editing interactor as soon as the new node is created.

Parameters:
autoEditLabel - The new value of the auto-edit-label flag.
Since:
JViews 6.0
See Also:
createEditLabelInteractor()

attach

protected void attach(IlvManagerView v)
This method is called when the interactor is attached to the specified manager view.

Overrides:
attach in class IlvManagerViewInteractor
Parameters:
v - The manager view.
See Also:
IlvManagerViewInteractor.detach()

detach

protected void detach()
This method is called when the interactor is detached from the specified manager view.

Overrides:
detach in class IlvManagerViewInteractor
See Also:
IlvManagerViewInteractor.attach(ilog.views.IlvManagerView)

processMouseEvent

protected void processMouseEvent(MouseEvent event)
Processes mouse events.

Overrides:
processMouseEvent in class IlvManagerViewInteractor
Parameters:
event - The event.
See Also:
IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)

processKeyEvent

protected void processKeyEvent(KeyEvent e)
Description copied from class: IlvManagerViewInteractor
Processes the key events. The method dispatches the event to the KeyListener registered with this interactor (if any).

Overrides:
processKeyEvent in class IlvManagerViewInteractor
Parameters:
e - The event.
See Also:
IlvManagerViewInteractor.addKeyListener(java.awt.event.KeyListener)

createNode

protected void createNode(float x,
                          float y)
Creates the new node. 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 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.

Parameters:
x - The x-position in manager coordinates.
y - The y-position in manager coordinates.

createEditLabelInteractor

protected IlvEditSDMLabelInteractor createEditLabelInteractor()
Factory to create the edit label interactor, used in createNode(float, float) when autoEditLabel is true.

Returns:
a new instance of IlvEditSDMLabelInteractor
Since:
JViews 8.1
See Also:
setAutoEditLabel(boolean)

setNodeProperties

protected void setNodeProperties(IlvSDMModel model,
                                 Object node)
Sets the initial properties of the newly created 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.

Parameters:
model - The data model of the SDM engine.
node - The node that has just been created by this interactor.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.