Debian Codegraph @

dojox/mdnd/DropIndicator.js

raw symbols SCIP
1 define(["dojo/_base/kernel",
2 "dojo/_base/declare",
3 "dojo/dom-class",
4 "dojo/dom-construct",
5 "./AreaManager"
6 ], function(dojo, declare, domClass, domConstruct, AreaManager){
7 var di = declare(
8 "dojox.mdnd.DropIndicator",
9 null,
10 {
11 // summary:
12 // DropIndicator managment for DnD.
13
14 // node: DOMNode
15 // the drop indicator node
16 node : null,
17
18 constructor: function(){
19 //console.log("dojox.mdnd.DropIndicator ::: constructor");
20 var dropIndicator = document.createElement("div");
21 var subDropIndicator = document.createElement("div");
22 dropIndicator.appendChild(subDropIndicator);
23 domClass.add(dropIndicator, "dropIndicator");
24 this.node = dropIndicator;
25 },
26
27 place: function(/*Node*/area, /*Node*/nodeRef, /*Object*/size){
28 // summary:
29 // Place the DropIndicator in the right place
30 // area:
31 // the dnd targer area node
32 // nodeRef:
33 // node where the dropIndicator have to be placed into the area
34 // dragNode:
35 // the node which is dragged
36 // returns:
37 // the node inserted or null if it crashes
38
39 //console.log("dojox.mdnd.DropIndicator ::: place");
40 if(size){
41 this.node.style.height = size.h + "px";
42 }
43 try{
44 if(nodeRef){
45 area.insertBefore(this.node, nodeRef);
46 }
47 else{
48 // empty target area or last node => appendChild
49 area.appendChild(this.node);
50 }
51 return this.node; // DOMNode
52 }catch(e){
53 return null;
54 }
55 },
56
57 remove: function(){
58 // summary:
59 // remove the DropIndicator (not destroy)
60
61 //console.log("dojox.mdnd.DropIndicator ::: remove");
62 if(this.node){
63 //FIX : IE6 problem
64 this.node.style.height = "";
65 if(this.node.parentNode){
66 this.node.parentNode.removeChild(this.node);
67 }
68 }
69 },
70
71 destroy: function(){
72 // summary:
73 // destroy the dropIndicator
74
75 //console.log("dojox.mdnd.DropIndicator ::: destroy");
76 if(this.node){
77 if(this.node.parentNode){
78 this.node.parentNode.removeChild(this.node);
79 }
80 domConstruct.destroy(this.node);
81 delete this.node;
82 }
83 }
84 });
85
86 AreaManager.areaManager()._dropIndicator = new di();
87
88 return di;
89 });