dojox/wire/TreeAdapter.js

  • Provides:

    • dojox.wire.TreeAdapter
  • Requires:

    • dojox.wire.CompositeWire in common
  • dojox.wire.TreeAdapter

    • type
      Function
    • chains:
      • dojox.wire.CompositeWire: (prototype)
      • dojox.wire.CompositeWire: (call)
    • summary
      Initialize properties
    • description
      If object properties ('node', 'title' and 'children') of array
      elements specified in 'nodes' property are not Wires, Wires are
      created from them as arguments, with 'parent' property set to
      this Wire instance.
    • parameters:
      • args: (typeof Object)
        Arguments to initialize properties
        nodes:
        An array containing objects for child Wires for node values
    • source: [view]
        this._initializeChildren(this.nodes);
  • dojox.wire.TreeAdapter._wireClass

    • summary
  • dojox.wire.TreeAdapter._getValue

    • type
      Function
    • parameters:
      • object: (typeof Array)
        A root array
    • source: [view]
        if(!object || !this.nodes){
         return object; //Array
        }


        var array = object;
        if(!dojo.isArray(array)){
         array = [array];
        }


        var nodes = [];
        for(var i in array){
         for(var i2 in this.nodes){
          nodes = nodes.concat(this._getNodes(array[i], this.nodes[i2]));
         }
        }
        return nodes; //Array
    • summary
      Return an array of tree node values
    • description
      This method iterates over an array specified to 'object'
      argument and calls getValue() method of 'node' Wires with each
      element of the array to get object(s) that represetns nodes.
      (If 'node' Wires are omitted, the array element is used for
      further processing.)
      Then, getValue() method of 'title' Wires are called to get
      title strings for nodes.
      (If 'title' Wires are omitted, the objects representing nodes
      are used as title strings.)
      And if an array of objects with 'node' and 'title' Wires is
      specified to 'children', it is used to gather child nodes and
      their title strings in the same way recursively.
      Finally, an array of the top-level node objects are retuned.
    • return_summary
      An array of tree node values
    • returns
      Array
  • dojox.wire.TreeAdapter._setValue

    • type
      Function
    • parameters:
      • object: (typeof Array)
      • value: (typeof Array)
    • source: [view]
        throw new Error("Unsupported API: " + this._wireClass + "._setValue");
    • summary
      Not supported
  • dojox.wire.TreeAdapter._initializeChildren

    • type
      Function
    • parameters:
      • children: (typeof Array)
        An array of objects containing child Wires
    • source: [view]
        if(!children){
         return; //undefined
        }


        for(var i in children){
         var child = children[i];
         if(child.node){
          child.node.parent = this;
          if(!dojox.wire.isWire(child.node)){
           child.node = dojox.wire.create(child.node);
          }
         }
         if(child.title){
          child.title.parent = this;
          if(!dojox.wire.isWire(child.title)){
           child.title = dojox.wire.create(child.title);
          }
         }
         if(child.children){
          this._initializeChildren(child.children);
         }
        }
    • summary
      Initialize child Wires
    • description
      If 'node' or 'title' properties of array elements specified in
      'children' argument are not Wires, Wires are created from them
      as arguments, with 'parent' property set to this Wire instance.
      If an array element has 'children' property, this method is
      called recursively with it.
    • returns
      undefined
  • dojox.wire.TreeAdapter._getNodes

    • type
      Function
    • parameters:
      • object: (typeof Object)
        An object
      • child: (typeof Object)
        An object with child Wires
    • source: [view]
        var array = null;
        if(child.node){
         array = child.node.getValue(object);
         if(!array){
          return [];
         }
         if(!dojo.isArray(array)){
          array = [array];
         }
        }else{
         array = [object];
        }


        var nodes = [];
        for(var i in array){
         object = array[i];
         var node = {};
         if(child.title){
          node.title = child.title.getValue(object);
         }else{
          node.title = object;
         }
         if(child.children){
          var children = [];
          for(var i2 in child.children){
           children = children.concat(this._getNodes(object, child.children[i2]));
          }
          if(children.length > 0){
           node.children = children;
          }
         }
         nodes.push(node);
        }
        return nodes; //Array
    • summary
      Return an array of tree node values
    • description
      This method calls getValue() method of 'node' Wires with
      'object' argument to get object(s) that represents nodes.
      (If 'node' Wires are omitted, 'object' is used for further
      processing.)
      Then, getValue() method of 'title' Wires are called to get
      title strings for nodes.
      (If 'title' Wires are omitted, the objects representing nodes
      are used as title strings.)
      And if an array of objects with 'node' and 'title' Wires is
      specified to 'children', it is used to gather child nodes and
      their title strings in the same way recursively.
      Finally, an array of node objects are returned.
    • return_summary
    • returns
      Array
  • dojox.wire

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary