public class IlvSDMDropTarget extends Object implements IlvSDMConstants, DropTargetListener, Serializable
IlvSDMDropTarget
handles the "drop"
part of drag-and-drop interactions between SDM engines.
To enable drag-and-drop between two SDM engines,
create an IlvSDMDragSource
associated with
one engine and an IlvSDMDropTarget
associated with
the other engine.ANCHOR_TAG
Constructor and Description |
---|
IlvSDMDropTarget(IlvSDMEngine engine,
IlvManagerView view)
Creates a new drop target associated with the specified
engine and the specified view.
|
Modifier and Type | Method and Description |
---|---|
void |
dragEnter(DropTargetDragEvent e)
Implementation of
DropTargetListener . |
void |
dragExit(DropTargetEvent e)
Implementation of
DropTargetListener . |
void |
dragOver(DropTargetDragEvent e)
Implementation of
DropTargetListener . |
void |
drop(DropTargetDropEvent e)
Implementation of
DropTargetListener . |
void |
dropActionChanged(DropTargetDragEvent e)
Implementation of
DropTargetListener . |
IlvSDMEngine |
getEngine()
Returns the SDM engine with which this drag source
is associated.
|
IlvManagerView |
getView()
Returns the manager view with which this drag source
is associated.
|
boolean |
isEnabled()
Returns the flag indicating whether the drag source is enabled.
|
protected void |
objectDropped(Object parent,
Object obj,
DropTargetDropEvent e)
This method is called during a drop, for each object that was dropped,
after the object was inserted in the model and its graphic representation
was moved to the drop location.
|
void |
setEnabled(boolean enabled)
Enables or disables the drag source.
|
public IlvSDMDropTarget(IlvSDMEngine engine, IlvManagerView view)
engine
- The SDM engine.view
- The manager view to which objects will be dropped.public IlvSDMEngine getEngine()
public IlvManagerView getView()
public void setEnabled(boolean enabled)
enabled
- If true
,
the drag source is enabled. Otherwise, no drag can be
initiated.public boolean isEnabled()
public void dragEnter(DropTargetDragEvent e)
DropTargetListener
.dragEnter
in interface DropTargetListener
e
- The event.public void dragExit(DropTargetEvent e)
DropTargetListener
.
This method does nothing.dragExit
in interface DropTargetListener
e
- The event.public void dragOver(DropTargetDragEvent e)
DropTargetListener
.
This method does nothing.dragOver
in interface DropTargetListener
e
- The event.public void drop(DropTargetDropEvent e)
DropTargetListener
.
This method adds a copy of the dragged object
to the data model of this view.
If IlvSDMEngine.isDropToGroupEnabled()
returns true
, the new object 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 object is created at the top level of the model.
drop
in interface DropTargetListener
e
- The event.protected void objectDropped(Object parent, Object obj, DropTargetDropEvent e)
This method can be overridden to modify the properties of the dropped object depending on the location where it was dropped.
The default implementation of this method does nothing, so you do not need to call the superclass when you override it.
parent
- The parent in which the object was dropped, or null
if the object was dropped at the top level.obj
- The dropped object.e
- The drop event.public void dropActionChanged(DropTargetDragEvent e)
DropTargetListener
.
This method does nothing.dropActionChanged
in interface DropTargetListener
e
- The event.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.