dijit/tree/_dndContainer.js

  • Provides:

    • dijit.tree._dndContainer
  • dijit.tree._dndContainer

    • type
      Function
    • summary
      A constructor of the Container
    • parameters:
      • tree: (typeof Node)
        Node or node's id to build the container on
      • params: (typeof dijit.tree.__SourceArgs)
        A dict of parameters, which gets mixed into the object
    • source: [view]
         this.tree = tree;
         this.node = tree.domNode; // TODO: rename; it's not a TreeNode but the whole Tree
         dojo.mixin(this, params);


         // class-specific variables
         this.map = {};
         this.current = null; // current TreeNode's DOM node


         // states
         this.containerState = "";
         dojo.addClass(this.node, "dojoDndContainer");


         // set up events
         this.events = [
          // container level events
          dojo.connect(this.node, "onmouseenter", this, "onOverEvent"),
          dojo.connect(this.node, "onmouseleave", this, "onOutEvent"),


          // switching between TreeNodes
          dojo.connect(this.tree, "_onNodeMouseEnter", this, "onMouseOver"),
          dojo.connect(this.tree, "_onNodeMouseLeave", this, "onMouseOut"),


          // cancel text selection and text dragging
          dojo.connect(this.node, "ondragstart", dojo, "stopEvent"),
          dojo.connect(this.node, "onselectstart", dojo, "stopEvent")
         ];
    • tags:
  • dijit.tree._dndContainer.current

    • type
      DomNode
    • summary
      The currently hovered TreeNode.rowNode (which is the DOM node
      associated w/a given node in the tree, excluding it's descendants)
  • dijit.tree._dndContainer.getItem

    • type
      Function
    • parameters:
      • key: (typeof String)
    • source: [view]
         var widget = this.selection[key],
          ret = {
           data: widget,
           type: ["treeNode"]
          };


         return ret; // dojo.dnd.Item
    • summary
      Returns the dojo.dnd.Item (representing a dragged node) by it's key (id).
      Called by dojo.dnd.Source.checkAcceptance().
    • tags:
    • returns
      dojo.dnd.Item
  • dijit.tree._dndContainer.destroy

    • type
      Function
    • source: [view]
         dojo.forEach(this.events, dojo.disconnect);
         // this.clearItems();
         this.node = this.parent = null;
    • summary
      Prepares this object to be garbage-collected
  • dijit.tree._dndContainer.onMouseOver

    • type
      Function
    • parameters:
      • widget: (typeof TreeNode)
      • evt: (typeof Event)
    • source: [view]
         this.current = widget;
    • summary
      Called when mouse is moved over a TreeNode
    • tags:
  • dijit.tree._dndContainer.onMouseOut

    • type
      Function
    • parameters:
      • widget: (typeof TreeNode)
      • evt: (typeof Event)
    • source: [view]
         this.current = null;
    • summary
      Called when mouse is moved away from a TreeNode
    • tags:
  • dijit.tree._dndContainer._changeState

    • type
      Function
    • parameters:
      • type: (typeof String)
        A name of the state to change
      • newState: (typeof String)
        new state
    • source: [view]
         var prefix = "dojoDnd" + type;
         var state = type.toLowerCase() + "State";
         //dojo.replaceClass(this.node, prefix + newState, prefix + this[state]);
         dojo.replaceClass(this.node, prefix + newState, prefix + this[state]);
         this[state] = newState;
    • summary
      Changes a named state to new state value
  • dijit.tree._dndContainer._addItemClass

    • type
      Function
    • parameters:
      • node: (typeof Node)
        A node
      • type: (typeof String)
        A variable suffix for a class name
    • source: [view]
         dojo.addClass(node, "dojoDndItem" + type);
    • summary
      Adds a class with prefix "dojoDndItem"
  • dijit.tree._dndContainer._removeItemClass

    • type
      Function
    • parameters:
      • node: (typeof Node)
        A node
      • type: (typeof String)
        A variable suffix for a class name
    • source: [view]
         dojo.removeClass(node, "dojoDndItem" + type);
    • summary
      Removes a class with prefix "dojoDndItem"
  • dijit.tree._dndContainer.onOverEvent

    • type
      Function
    • source: [view]
         this._changeState("Container", "Over");
    • summary
      This function is called once, when mouse is over our container
    • tags:
  • dijit.tree._dndContainer.onOutEvent

    • type
      Function
    • source: [view]
         this._changeState("Container", "");
    • summary
      This function is called once, when mouse is out of our container
    • tags:
  • dijit.tree._dndContainer.node

    • summary
  • dijit.tree._dndContainer.tree

    • type
      Node
    • summary
      Node or node's id to build the container on
  • dijit.tree._dndContainer.map

    • summary
  • dijit.tree._dndContainer.containerState

    • summary
  • dijit.tree._dndContainer.events

    • summary
  • dijit.tree._compareNodes

    • type
      Function
    • parameters:
      • n1: (typeof )
      • n2: (typeof )
    • source: [view]
       if(n1 === n2){
        return 0;
       }

       
       if('sourceIndex' in document.documentElement){ //IE
        //TODO: does not yet work if n1 and/or n2 is a text node
        return n1.sourceIndex - n2.sourceIndex;
       }else if('compareDocumentPosition' in document.documentElement){ //FF, Opera
        return n1.compareDocumentPosition(n2) & 2 ? 1: -1;
       }else if(document.createRange){ //Webkit
        var r1 = doc.createRange();
        r1.setStartBefore(n1);


        var r2 = doc.createRange();
        r2.setStartBefore(n2);


        return r1.compareBoundaryPoints(r1.END_TO_END, r2);
       }else{
        throw Error("dijit.tree._compareNodes don't know how to compare two different nodes in this browser");
       }
    • summary
  • this

    • mixins:
      • params: (normal)
    • summary
  • dijit.tree

    • type
      Object
    • summary
  • dijit

    • type
      Object
    • summary