13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
 * @class SimpleTasks.ux.DragDrop
 * @extends Ext.grid.plugin.DragDrop
 * 
 * This plugin modifies the behavior of Ext.tree.plugin.TreeViewDragDrop. to allow the DropZone to handle
 * multiple types of records (Tasks and Lists)
 */
Ext.define('SimpleTasks.ux.DragDrop', {
    extend: 'Ext.tree.plugin.TreeViewDragDrop',
    alias: 'plugin.tasksdragdrop',
    requires: [
        'Ext.view.DragZone',
        'SimpleTasks.ux.DropZone'
    ], 
 
    /**
     * @event taskdrop
     * **This event is fired through the GridView. Add listeners to the GridView object**
     * 
     * Fires when a task record is dropped on the group view
     * @param {SimpleTasks.model.Task} task       The task record
     * @param {SimpleTasks.model.Group} group     The group that the task was dropped on
     */
 
    /**
     * @event groupdrop
     * **This event is fired through the GridView. Add listeners to the GridView object**
     * 
     * Fires when a group record is dropped on the group view
     * @param {SimpleTasks.model.Group} group         The group that was dropped
     * @param {SimpleTasks.model.Group} overGroup     The group that the group was dropped on
     * @param {String} position                 `"before"` or `"after"` depending on whether the mouse is above or below the midline of the node.
     */
 
    onViewRender : function(view) {
        var me = this;
 
        if (me.enableDrag) {
            me.dragZone = Ext.create('Ext.tree.ViewDragZone', {
                view: view,
                ddGroup: me.dragGroup || me.ddGroup,
                dragText: me.dragText,
                repairHighlightColor: me.nodeHighlightColor,
                repairHighlight: me.nodeHighlightOnRepair
            });
        }
 
        if (me.enableDrop) {
            me.dropZone = Ext.create('SimpleTasks.ux.DropZone', {
                view: view,
                ddGroup: me.dropGroup || me.ddGroup,
                allowContainerDrops: me.allowContainerDrops,
                appendOnly: me.appendOnly,
                allowParentInserts: me.allowParentInserts,
                expandDelay: me.expandDelay,
                dropHighlightColor: me.nodeHighlightColor,
                dropHighlight: me.nodeHighlightOnDrop
            });
        }
 
    }
 
});