[483] | 1 | dojo.provide("dojox.layout.dnd.Avatar"); |
---|
| 2 | |
---|
| 3 | dojo.require("dojo.dnd.Avatar"); |
---|
| 4 | dojo.require("dojo.dnd.common"); |
---|
| 5 | |
---|
| 6 | dojo.declare("dojox.layout.dnd.Avatar", dojo.dnd.Avatar, { |
---|
| 7 | // summary: |
---|
| 8 | // An Object, which represents the object being moved in a GridContainer |
---|
| 9 | constructor: function(manager, opacity){ |
---|
| 10 | this.opacity = opacity || 0.9; |
---|
| 11 | }, |
---|
| 12 | |
---|
| 13 | construct: function(){ |
---|
| 14 | // summary: |
---|
| 15 | // A constructor function. it is separate so it can be (dynamically) |
---|
| 16 | // overwritten in case of need. |
---|
| 17 | |
---|
| 18 | var source = this.manager.source, |
---|
| 19 | node = source.creator ? |
---|
| 20 | // create an avatar representation of the node |
---|
| 21 | source._normalizedCreator(source.getItem(this.manager.nodes[0].id).data, "avatar").node : |
---|
| 22 | // or just clone the node and hope it works |
---|
| 23 | this.manager.nodes[0].cloneNode(true) |
---|
| 24 | ; |
---|
| 25 | |
---|
| 26 | dojo.addClass(node, "dojoDndAvatar"); |
---|
| 27 | |
---|
| 28 | node.id = dojo.dnd.getUniqueId(); |
---|
| 29 | node.style.position = "absolute"; |
---|
| 30 | node.style.zIndex = 1999; |
---|
| 31 | node.style.margin = "0px" |
---|
| 32 | node.style.width = dojo.marginBox(source.node).w + "px" |
---|
| 33 | |
---|
| 34 | // add contructor object params to define it |
---|
| 35 | dojo.style(node, "opacity", this.opacity); |
---|
| 36 | this.node = node; |
---|
| 37 | }, |
---|
| 38 | |
---|
| 39 | update: function(){ |
---|
| 40 | // summary: |
---|
| 41 | // Updates the avatar to reflect the current DnD state. |
---|
| 42 | dojo.toggleClass(this.node, "dojoDndAvatarCanDrop", this.manager.canDropFlag); |
---|
| 43 | }, |
---|
| 44 | |
---|
| 45 | _generateText: function(){ /* nada. */ } |
---|
| 46 | |
---|
| 47 | }); |
---|