dijit/form/_Spinner.js

  • Provides:

    • dijit.form._Spinner
  • dijit.form._Spinner

    • type
      Function
    • chains:
      • dijit.form.RangeBoundTextBox: (prototype)
      • dijit.form.RangeBoundTextBox: (call)
    • summary
      Mixin for validation widgets with a spinner.
    • description
      This class basically (conceptually) extends `dijit.form.ValidationTextBox`.
      It modifies the template to have up/down arrows, and provides related handling code.
  • dijit.form._Spinner.defaultTimeout

    • type
      Number
    • summary
      Number of milliseconds before a held arrow key or up/down button becomes typematic
  • dijit.form._Spinner.minimumTimeout

    • type
      Number
    • summary
      minimum number of milliseconds that typematic event fires when held key or button is held
  • dijit.form._Spinner.timeoutChangeRate

    • type
      Number
    • summary
      Fraction of time used to change the typematic timer between events.
      1.0 means that each typematic event fires at defaultTimeout intervals.
      < 1.0 means that each typematic event fires at an increasing faster rate.
  • dijit.form._Spinner.smallDelta

    • type
      Number
    • summary
      Adjust the value by this much when spinning using the arrow keys/buttons
  • dijit.form._Spinner.largeDelta

    • type
      Number
    • summary
      Adjust the value by this much when spinning using the PgUp/Dn keys
  • dijit.form._Spinner.templateString

    • summary
  • dijit.form._Spinner.baseClass

    • summary
  • dijit.form._Spinner.cssStateNodes

    • type
      Object
    • summary
  • dijit.form._Spinner.adjust

    • type
      Function
    • parameters:
      • val: (typeof Object)
      • delta: (typeof Number)
    • source: [view]
         return val;
    • summary
      Overridable function used to adjust a primitive value(Number/Date/...) by the delta amount specified.
      The val is adjusted in a way that makes sense to the object type.
    • tags:
  • dijit.form._Spinner._arrowPressed

    • type
      Function
    • parameters:
      • nodePressed: (typeof Node)
      • direction: (typeof Number)
      • increment: (typeof Number)
    • source: [view]
         if(this.disabled || this.readOnly){ return; }
         this._setValueAttr(this.adjust(this.get('value'), direction*increment), false);
         dijit.selectInputText(this.textbox, this.textbox.value.length);
    • summary
      Handler for arrow button or arrow key being pressed
  • dijit.form._Spinner._arrowReleased

    • type
      Function
    • parameters:
      • node: (typeof Node)
    • source: [view]
         this._wheelTimer = null;
         if(this.disabled || this.readOnly){ return; }
    • summary
      Handler for arrow button or arrow key being released
  • dijit.form._Spinner._typematicCallback

    • type
      Function
    • parameters:
      • count: (typeof Number)
      • node: (typeof DOMNode)
      • evt: (typeof Event)
    • source: [view]
         var inc=this.smallDelta;
         if(node == this.textbox){
          var k=dojo.keys;
          var key = evt.charOrCode;
          inc = (key == k.PAGE_UP || key == k.PAGE_DOWN) ? this.largeDelta : this.smallDelta;
          node = (key == k.UP_ARROW || key == k.PAGE_UP) ? this.upArrowNode : this.downArrowNode;
         }
         if(count == -1){ this._arrowReleased(node); }
         else{ this._arrowPressed(node, (node == this.upArrowNode) ? 1 : -1, inc); }
    • summary
  • dijit.form._Spinner._wheelTimer

    • summary
  • dijit.form._Spinner._mouseWheeled

    • type
      Function
    • parameters:
      • evt: (typeof Event)
    • source: [view]
         dojo.stopEvent(evt);
         // FIXME: Safari bubbles


         // be nice to DOH and scroll as much as the event says to
         var scrollAmount = evt.detail ? (evt.detail * -1) : (evt.wheelDelta / 120);
         if(scrollAmount !== 0){
          var node = this[(scrollAmount > 0 ? "upArrowNode" : "downArrowNode" )];


          this._arrowPressed(node, scrollAmount, this.smallDelta);


          if(!this._wheelTimer){
           clearTimeout(this._wheelTimer);
          }
          this._wheelTimer = setTimeout(dojo.hitch(this,"_arrowReleased",node), 50);
         }
    • summary
      Mouse wheel listener where supported
  • dijit.form._Spinner.postCreate

    • type
      Function
    • source: [view]
         this.inherited(arguments);


         // extra listeners
         this.connect(this.domNode, !dojo.isMozilla ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled");
         this._connects.push(dijit.typematic.addListener(this.upArrowNode, this.textbox, {charOrCode:dojo.keys.UP_ARROW,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout, this.minimumTimeout));
         this._connects.push(dijit.typematic.addListener(this.downArrowNode, this.textbox, {charOrCode:dojo.keys.DOWN_ARROW,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout, this.minimumTimeout));
         this._connects.push(dijit.typematic.addListener(this.upArrowNode, this.textbox, {charOrCode:dojo.keys.PAGE_UP,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout, this.minimumTimeout));
         this._connects.push(dijit.typematic.addListener(this.downArrowNode, this.textbox, {charOrCode:dojo.keys.PAGE_DOWN,ctrlKey:false,altKey:false,shiftKey:false,metaKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout, this.minimumTimeout));
    • summary
  • dijit.form._Spinner.cssStateNodes.upArrowNode

    • summary
  • dijit.form._Spinner.cssStateNodes.downArrowNode

    • summary
  • dijit.form

    • type
      Object
    • summary
  • dijit

    • type
      Object
    • summary