diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dijit/tree/_dndContainer.js.uncompressed.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dijit/tree/_dndContainer.js.uncompressed.js')
-rw-r--r-- | lib/dijit/tree/_dndContainer.js.uncompressed.js | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/lib/dijit/tree/_dndContainer.js.uncompressed.js b/lib/dijit/tree/_dndContainer.js.uncompressed.js new file mode 100644 index 000000000..8f457e6d5 --- /dev/null +++ b/lib/dijit/tree/_dndContainer.js.uncompressed.js @@ -0,0 +1,150 @@ +define("dijit/tree/_dndContainer", [ + "dojo/aspect", // aspect.after + "dojo/_base/declare", // declare + "dojo/dom-class", // domClass.add domClass.remove domClass.replace + "dojo/_base/event", // event.stop + "dojo/_base/lang", // lang.getObject lang.mixin lang.hitch + "dojo/mouse", // mouse.enter, mouse.leave + "dojo/on" +], function(aspect, declare, domClass, event, lang, mouse, on){ + + // module: + // dijit/tree/_dndContainer + // summary: + // This is a base class for `dijit.tree._dndSelector`, and isn't meant to be used directly. + // It's modeled after `dojo.dnd.Container`. + + return declare("dijit.tree._dndContainer", null, { + + // summary: + // This is a base class for `dijit.tree._dndSelector`, and isn't meant to be used directly. + // It's modeled after `dojo.dnd.Container`. + // tags: + // protected + + /*===== + // current: DomNode + // The currently hovered TreeNode.rowNode (which is the DOM node + // associated w/a given node in the tree, excluding it's descendants) + current: null, + =====*/ + + constructor: function(tree, params){ + // summary: + // A constructor of the Container + // tree: Node + // Node or node's id to build the container on + // params: dijit.tree.__SourceArgs + // A dict of parameters, which gets mixed into the object + // tags: + // private + this.tree = tree; + this.node = tree.domNode; // TODO: rename; it's not a TreeNode but the whole Tree + lang.mixin(this, params); + + // class-specific variables + this.current = null; // current TreeNode's DOM node + + // states + this.containerState = ""; + domClass.add(this.node, "dojoDndContainer"); + + // set up events + this.events = [ + // container level events + on(this.node, mouse.enter, lang.hitch(this, "onOverEvent")), + on(this.node, mouse.leave, lang.hitch(this, "onOutEvent")), + + // switching between TreeNodes + aspect.after(this.tree, "_onNodeMouseEnter", lang.hitch(this, "onMouseOver"), true), + aspect.after(this.tree, "_onNodeMouseLeave", lang.hitch(this, "onMouseOut"), true), + + // cancel text selection and text dragging + on(this.node, "dragstart", lang.hitch(event, "stop")), + on(this.node, "selectstart", lang.hitch(event, "stop")) + ]; + }, + + destroy: function(){ + // summary: + // Prepares this object to be garbage-collected + + var h; + while(h = this.events.pop()){ h.remove(); } + + // this.clearItems(); + this.node = this.parent = null; + }, + + // mouse events + onMouseOver: function(widget /*===== , evt =====*/){ + // summary: + // Called when mouse is moved over a TreeNode + // widget: TreeNode + // evt: Event + // tags: + // protected + this.current = widget; + }, + + onMouseOut: function(/*===== widget, evt =====*/){ + // summary: + // Called when mouse is moved away from a TreeNode + // widget: TreeNode + // evt: Event + // tags: + // protected + this.current = null; + }, + + _changeState: function(type, newState){ + // summary: + // Changes a named state to new state value + // type: String + // A name of the state to change + // newState: String + // new state + var prefix = "dojoDnd" + type; + var state = type.toLowerCase() + "State"; + //domClass.replace(this.node, prefix + newState, prefix + this[state]); + domClass.replace(this.node, prefix + newState, prefix + this[state]); + this[state] = newState; + }, + + _addItemClass: function(node, type){ + // summary: + // Adds a class with prefix "dojoDndItem" + // node: Node + // A node + // type: String + // A variable suffix for a class name + domClass.add(node, "dojoDndItem" + type); + }, + + _removeItemClass: function(node, type){ + // summary: + // Removes a class with prefix "dojoDndItem" + // node: Node + // A node + // type: String + // A variable suffix for a class name + domClass.remove(node, "dojoDndItem" + type); + }, + + onOverEvent: function(){ + // summary: + // This function is called once, when mouse is over our container + // tags: + // protected + this._changeState("Container", "Over"); + }, + + onOutEvent: function(){ + // summary: + // This function is called once, when mouse is out of our container + // tags: + // protected + this._changeState("Container", ""); + } + }); +}); |