source: Dev/branches/rest-dojo-ui/client/dojox/layout/dnd/Avatar.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.3 KB
Line 
1dojo.provide("dojox.layout.dnd.Avatar");
2
3dojo.require("dojo.dnd.Avatar");
4dojo.require("dojo.dnd.common");
5
6dojo.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: Updates the avatar to reflect the current DnD state.
41                dojo.toggleClass(this.node, "dojoDndAvatarCanDrop", this.manager.canDropFlag);
42        },
43
44        _generateText: function(){ /* nada. */ }
45
46});
Note: See TracBrowser for help on using the repository browser.