public interface FolderDropHandler
extends com.google.gwt.event.shared.EventHandler
Modifier and Type | Method and Description |
---|---|
void |
onFolderDrop(FolderDropEvent event)
Process a drop of one or more nodes on a TreeGrid folder.
Note: See TreeGridDrop
for an overview of TreeGrid drag and drop behavior. |
void onFolderDrop(FolderDropEvent event)
TreeGridDrop
for an overview of TreeGrid drag and drop behavior. Add logic in your drop handler to perform custom drop behaviors;
to suppress the built-in behavior described below, use event.cancel()
The default behavior is to
simply delegate to the transferNodes()
method; thus, the
correct way to perform a programmatic folder drop, with all the built-in behaviors described below, is to call
transferNodes()
If this is a self-drop, nodes are simply reordered. An "update" operation will be
submitted to update the parentId
field of the moved
node(s).
For a drop from another widget, transferDragData()
is called which, depending on the dragDataAction
specified on the source widget, may either remove the source nodes from the original list
(dragDataAction:"move"
) or just provide a copy to this tree (dragDataAction:"copy"
).
In
either case the new row(s) appear in the folder
at the index
specified by the arguments of the
same name.
If this grid is databound, the new nodes will be added to the dataset by calling DataSource.addData()
. Further, if the new nodes were dragged from another
databound component, and addDropValues
is true,
getDropValues
will be called for every item being
dropped.
As a special case, if the sourceWidget
is also databound and a foreignKey
relationship is declared from the
sourceWidget
's DataSource to this TreeGrid's DataSource, the interaction will be treated as a "drag
recategorization" use case such as files being placed in folders, employees being assigned to teams, etc. "update"
DSRequests will be submitted that change the foreignKey field in the dropped records to point to the tree folder that
was the target of the drop. In this case no change will be made to the Tree data as such, only to the dropped records.
For multi-record drops, Queuing is automatically used to combine all DSRequests into a single HTTP Request (see QuickStart Guide, Server Framework chapter). This allows the server to persist all changes caused by the drop in a single transaction (and this is automatically done when using the built-in server DataSources with Power Edition and above).
If these default persistence behaviors are undesirable, use event.cancel()
, then implement
your own behavior, typically by using grid.updateData() or addData() to add new records.
NOTE: the records
you receive in this event are the actual Records from the source component. Use DataSource.copyRecords()
to create a copy before modifying the records
or using them with updateData() or addData().
event
- the event