dojox/sketch/_Plugin.js

  • Provides:

    • dojox.sketch._Plugin
  • Requires:

    • dijit.form.Button in common in project dijit
  • dojox.sketch._Plugin

    • type
      Function
    • parameters:
      • args: (typeof Object)
    • source: [view]
        if(args){
         dojo.mixin(this, args);
        }
        this._connects=[];
    • summary
  • dojox.sketch._Plugin.figure

    • summary
  • dojox.sketch._Plugin.iconClassPrefix

    • summary
  • dojox.sketch._Plugin.itemGroup

    • summary
  • dojox.sketch._Plugin.button

    • summary
  • dojox.sketch._Plugin.queryCommand

    • summary
  • dojox.sketch._Plugin.shape

    • summary
  • dojox.sketch._Plugin.useDefaultCommand

    • summary
  • dojox.sketch._Plugin.buttonClass

    • summary
  • dojox.sketch._Plugin._initButton

    • type
      Function
    • source: [view]
        if(this.shape.length){
         //TODO: i18n
      //   var label = dojox.sketch.shapes[this.shape];
         var className = this.iconClassPrefix+" "+this.iconClassPrefix + this.shape.charAt(0).toUpperCase() + this.shape.substr(1);
         if(!this.button){
          var props = {
           label: this.shape, //I18N
           showLabel: false,
           iconClass: className,
           dropDown: this.dropDown,
           tabIndex: "-1"
          };
          this.button = new this.buttonClass(props);
          this.connect(this.button,'onClick','activate');
         }
        }
    • summary
  • dojox.sketch._Plugin.attr

    • type
      Function
    • parameters:
      • name: (typeof )
      • value: (typeof ?)
    • source: [view]
        return this.button.attr(name,value);
    • summary
  • dojox.sketch._Plugin.onActivate

    • type
      Function
    • source: [view]
      }
    • summary
  • dojox.sketch._Plugin.activate

    • type
      Function
    • parameters:
      • e: (typeof ?)
    • source: [view]
        this.onActivate();
        this.figure.setTool(this);
        this.attr('checked',true);
    • summary
  • dojox.sketch._Plugin.onMouseDown

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
      }
    • summary
  • dojox.sketch._Plugin.onMouseMove

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
      }
    • summary
  • dojox.sketch._Plugin.onMouseUp

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
      }
    • summary
  • dojox.sketch._Plugin.destroy

    • type
      Function
    • parameters:
      • f: (typeof )
    • source: [view]
        dojo.forEach(this._connects,dojo.disconnect);
    • summary
  • dojox.sketch._Plugin.connect

    • type
      Function
    • parameters:
      • o: (typeof )
      • f: (typeof )
      • tf: (typeof )
    • source: [view]
        this._connects.push(dojo.connect(o,f,this,tf));
    • summary
  • dojox.sketch._Plugin.setFigure

    • type
      Function
    • parameters:
      • figure: (typeof dijit._Widget)
    • source: [view]
      dojo.provide("dojox.sketch._Plugin");
      //dojo.require("dojox.sketch");
      dojo.require("dijit.form.Button");


      dojo.declare("dojox.sketch._Plugin", null, {
       // summary
       //  This represents a "plugin" to the dojox.sketch.Figure, which is basically
       //  a single button on the Toolbar and some associated code
       constructor: function(/*Object?*/args){
        if(args){
         dojo.mixin(this, args);
        }
        this._connects=[];
       },


       figure: null,
       iconClassPrefix: "dojoxSketchIcon",
       itemGroup: 'toolsGroup',
       button: null,
       queryCommand: null,
       shape: "",
       useDefaultCommand: true,
       buttonClass: dijit.form.ToggleButton,
       _initButton: function(){
        if(this.shape.length){
         //TODO: i18n
      //   var label = dojox.sketch.shapes[this.shape];
         var className = this.iconClassPrefix+" "+this.iconClassPrefix + this.shape.charAt(0).toUpperCase() + this.shape.substr(1);
         if(!this.button){
          var props = {
           label: this.shape, //I18N
           showLabel: false,
           iconClass: className,
           dropDown: this.dropDown,
           tabIndex: "-1"
          };
          this.button = new this.buttonClass(props);
          this.connect(this.button,'onClick','activate');
         }
        }
       },
       attr: function(name,/*?*/value){
        return this.button.attr(name,value);
       },
       onActivate: function(){},
       activate: function(/*?*/e){
        this.onActivate();
        this.figure.setTool(this);
        this.attr('checked',true);
       },
       onMouseDown: function(e){},
       onMouseMove: function(e){},
       onMouseUp: function(e){},
       destroy: function(f){
        dojo.forEach(this._connects,dojo.disconnect);
       },
       connect: function(o,f,tf){
        this._connects.push(dojo.connect(o,f,this,tf));
       },
       setFigure: function(/*dijit._Widget*/ figure){
        // FIXME: detatch from previous figure!!
        this.figure = figure;
    • summary
  • dojox.sketch._Plugin.setToolbar

    • type
      Function
    • parameters:
      • toolbar: (typeof dijit._Widget)
    • source: [view]
      dojo.provide("dojox.sketch._Plugin");
      //dojo.require("dojox.sketch");
      dojo.require("dijit.form.Button");


      dojo.declare("dojox.sketch._Plugin", null, {
       // summary
       //  This represents a "plugin" to the dojox.sketch.Figure, which is basically
       //  a single button on the Toolbar and some associated code
       constructor: function(/*Object?*/args){
        if(args){
         dojo.mixin(this, args);
        }
        this._connects=[];
       },


       figure: null,
       iconClassPrefix: "dojoxSketchIcon",
       itemGroup: 'toolsGroup',
       button: null,
       queryCommand: null,
       shape: "",
       useDefaultCommand: true,
       buttonClass: dijit.form.ToggleButton,
       _initButton: function(){
        if(this.shape.length){
         //TODO: i18n
      //   var label = dojox.sketch.shapes[this.shape];
         var className = this.iconClassPrefix+" "+this.iconClassPrefix + this.shape.charAt(0).toUpperCase() + this.shape.substr(1);
         if(!this.button){
          var props = {
           label: this.shape, //I18N
           showLabel: false,
           iconClass: className,
           dropDown: this.dropDown,
           tabIndex: "-1"
          };
          this.button = new this.buttonClass(props);
          this.connect(this.button,'onClick','activate');
         }
        }
       },
       attr: function(name,/*?*/value){
        return this.button.attr(name,value);
       },
       onActivate: function(){},
       activate: function(/*?*/e){
        this.onActivate();
        this.figure.setTool(this);
        this.attr('checked',true);
       },
       onMouseDown: function(e){},
       onMouseMove: function(e){},
       onMouseUp: function(e){},
       destroy: function(f){
        dojo.forEach(this._connects,dojo.disconnect);
       },
       connect: function(o,f,tf){
        this._connects.push(dojo.connect(o,f,this,tf));
       },
       setFigure: function(/*dijit._Widget*/ figure){
        // FIXME: detatch from previous figure!!
        this.figure = figure;
       },
       setToolbar: function(/*dijit._Widget*/ toolbar){
        // FIXME: prevent creating this if we don't need to (i.e., figure can't handle our command)
        this._initButton();
        if(this.button){
         toolbar.addChild(this.button);
        }
        if(this.itemGroup){
         toolbar.addGroupItem(this,this.itemGroup);
        }
    • summary
  • dojox.sketch._Plugin._connects

    • summary
  • this

    • mixins:
      • args: (normal)
    • summary
  • dojox.sketch

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary