dojox/wire/_base.js

  • Provides:

    • dojox.wire._base
  • dojox.wire._wireClasses

    • type
      Object
    • summary
  • dojox.wire._wireClasses.attribute

    • summary
  • dojox.wire._wireClasses.path

    • summary
  • dojox.wire._wireClasses.children

    • summary
  • dojox.wire._wireClasses.columns

    • summary
  • dojox.wire._wireClasses.nodes

    • summary
  • dojox.wire._wireClasses.segments

    • summary
  • dojox.wire.register

    • type
      Function
    • parameters:
      • wireClass: (typeof Function||String)
        A class or full qualified class name
      • key: (typeof String)
        A key property of arguments to create a Wire
    • source: [view]
       if(!wireClass || !key){
        return; //undefined
       }
       if(dojox.wire._wireClasses[key]){ // key already in use
        return; //undefined
       }
       dojox.wire._wireClasses[key] = wireClass;
    • summary
      Register a Wire class
      desription:
      The specified Wire class or a class name is registered with
      a key property of arguments to create a Wire
    • returns
      undefined
  • dojox.wire._getClass

    • type
      Function
    • parameters:
      • name: (typeof String)
        A class name
    • source: [view]
       dojo["require"](name); // use dojo["require"] instead of dojo.require to avoid a build problem
       return dojo.getObject(name); //Function
    • summary
      Returns a class
    • description
      The class is loaded by dojo.require() and returned
      by dojo.getObject().
    • return_summary
      A class
    • returns
      Function
  • dojox.wire.create

    • type
      Function
    • parameters:
      • args: (typeof Object)
        Arguments to create a Wire
    • source: [view]
       if(!args){
        args = {};
       }
       var wireClass = args.wireClass;
       if(wireClass){
        if(dojo.isString(wireClass)){
         wireClass = dojox.wire._getClass(wireClass);
        }
       }else{
        for(var key in args){
         if(!args[key]){
          continue;
         }
         wireClass = dojox.wire._wireClasses[key];
         if(wireClass){
          if(dojo.isString(wireClass)){
           wireClass = dojox.wire._getClass(wireClass);
           dojox.wire._wireClasses[key] = wireClass;
          }
          break;
         }
        }
       }
       if(!wireClass){
        if(dojo.isString(dojox.wire._defaultWireClass)){
         dojox.wire._defaultWireClass = dojox.wire._getClass(dojox.wire._defaultWireClass);
        }
        wireClass = dojox.wire._defaultWireClass;
       }
       return new wireClass(args); //Object
    • summary
      Create a Wire from arguments
    • description
      If 'args' specifies 'wireClass', it is used as a class or full
      qualified class name to create a Wire with 'args' as arguments.
      Otherwise, a Wire class is determined by other proeprties of 'args'
      checking if 'args' specifies a key property for a Wire class.
      If no key property found, the default Wire class is used.
    • return_summary
      A Wire
    • returns
      Object
  • dojox.wire.isWire

    • type
      Function
    • parameters:
      • wire: (typeof Object)
        An object to check
    • source: [view]
       return (wire && wire._wireClass); //Boolean
    • summary
      Check if an object is a Wire
    • description
      If the specified object is a Wire, true is returned.
      Otherwise, false is returned.
    • return_summary
      True if the object is a Wire, otherwise false
    • returns
      Boolean
  • dojox.wire.transfer

    • type
      Function
    • parameters:
      • source: (typeof Wire||Object)
        A Wire or arguments to create a Wire for a source value
      • target: (typeof Wire||Object)
        A Wire or arguments to create a Wire for a target value
      • defaultObject: (typeof Object)
        defaultTargetObject;
        Optional default root objects passed to Wires
      • defaultTargetObject: (typeof Object)
    • source: [view]
       if(!source || !target){
        return; //undefined
       }
       if(!dojox.wire.isWire(source)){
        source = dojox.wire.create(source);
       }
       if(!dojox.wire.isWire(target)){
        target = dojox.wire.create(target);
       }


       var value = source.getValue(defaultObject);
       target.setValue(value, (defaultTargetObject || defaultObject));
    • summary
      Transfer a source value to a target value
    • description
      If 'source' and/or 'target' are not Wires, Wires are created with
      them as arguments.
      A value is got through the source Wire and set through the target
      Wire.
      'defaultObject' is passed to Wires as a default root object.
      If 'defaultTargetObject' is specified, it is passed to the target
      Wire as a default root object, instead of 'defaultObject'.
    • returns
      undefined
  • dojox.wire.connect

    • type
      Function
    • parameters:
      • trigger: (typeof Object)
        An event or topic to trigger a transfer
      • source: (typeof Wire||Object)
        A Wire or arguments to create a Wire for a source value
      • target: (typeof Wire||Object)
        A Wire or arguments to create a Wire for a target value
    • source: [view]
       if(!trigger || !source || !target){
        return; //undefined
       }


       var connection = {topic: trigger.topic};
       if(trigger.topic){
        connection.handle = dojo.subscribe(trigger.topic, function(){
         dojox.wire.transfer(source, target, arguments);
        });
       }else if(trigger.event){
        connection.handle = dojo.connect(trigger.scope, trigger.event, function(){
         dojox.wire.transfer(source, target, arguments);
        });
       }
       return connection; //Object
    • summary
      Transfer a source value to a target value on a trigger event or
      topic
    • description
      If 'trigger' specifies 'topic', the topic is subscribed to transer
      a value on the topic.
      Otherwise, the event specified to 'event' of 'trigger' is listened
      to transfer a value.
      On the specified event or topic, transfer() is called with
      'source', 'target' and the arguments of the event or topic (as
      default root objects).
    • return_summary
      A connection handle for disconnect()
    • returns
      undefined|Object
  • dojox.wire.disconnect

    • type
      Function
    • parameters:
      • connection: (typeof Object)
        A connection handle returned by connect()
    • source: [view]
       if(!connection || !connection.handle){
        return; //undefined
       }


       if(connection.topic){
        dojo.unsubscribe(connection.handle);
       }else{
        dojo.disconnect(connection.handle);
       }
    • summary
      Remove a connection or subscription for transfer
    • description
      If 'handle' has 'topic', the topic is unsubscribed.
      Otherwise, the listener to an event is removed.
    • returns
      undefined
  • dojox.wire._defaultWireClass

    • summary
  • dojox.wire._base

    • type
      Object
    • summary
  • dojox.wire

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary