Author: damoxc

Revision: 5626

Log:
        add an override to setValue within the ext spinner extension so 
setValue amounts are run through the strategy

Diff:
Modified: trunk/deluge/ui/web/js/ext-extensions-debug.js
===================================================================
--- trunk/deluge/ui/web/js/ext-extensions-debug.js      2009-08-03 21:45:03 UTC 
(rev 5625)
+++ trunk/deluge/ui/web/js/ext-extensions-debug.js      2009-08-03 22:26:18 UTC 
(rev 5626)
@@ -30,6 +30,7 @@
                'spinup' : true,
                'spindown' : true
        });
+       this.initStrategy();
 }
 
 Ext.extend(Ext.ux.form.Spinner, Ext.form.TriggerField, {
@@ -103,31 +104,33 @@
                this.dd.endDrag = this.endDrag.createDelegate(this);
                this.dd.startDrag = this.startDrag.createDelegate(this);
                this.dd.onDrag = this.onDrag.createDelegate(this);
+       },
+       
+       initStrategy: function() {
+               /*
+               jsakalos suggestion
+               http://extjs.com/forum/showthread.php?p=121850#post121850 */
+               if('object' == typeof this.strategy && this.strategy.xtype) {
+                   switch(this.strategy.xtype) {
+                       case 'number':
+                           this.strategy = new 
Ext.ux.form.Spinner.NumberStrategy(this.strategy);
+                               break;
+       
+                       case 'date':
+                           this.strategy = new 
Ext.ux.form.Spinner.DateStrategy(this.strategy);
+                               break;
+       
+                       case 'time':
+                           this.strategy = new 
Ext.ux.form.Spinner.TimeStrategy(this.strategy);
+                               break;
+       
+                       default:
+                           delete(this.strategy);
+                               break;
+                   }
+                   delete(this.strategy.xtype);
+               }
 
-        /*
-        jsakalos suggestion
-        http://extjs.com/forum/showthread.php?p=121850#post121850 */
-        if('object' == typeof this.strategy && this.strategy.xtype) {
-            switch(this.strategy.xtype) {
-                case 'number':
-                    this.strategy = new 
Ext.ux.form.Spinner.NumberStrategy(this.strategy);
-                       break;
-
-                case 'date':
-                    this.strategy = new 
Ext.ux.form.Spinner.DateStrategy(this.strategy);
-                       break;
-
-                case 'time':
-                    this.strategy = new 
Ext.ux.form.Spinner.TimeStrategy(this.strategy);
-                       break;
-
-                default:
-                    delete(this.strategy);
-                       break;
-            }
-            delete(this.strategy.xtype);
-        }
-
                if(this.strategy == undefined){
                        this.strategy = new 
Ext.ux.form.Spinner.NumberStrategy();
                }
@@ -299,6 +302,11 @@
                this.fireEvent("spin", this);
                this.fireEvent("spindown", this);
                this.fireEvent("change", this);
+       },
+       
+       setValue: function(value) {
+               value = this.strategy.fixBoundries(value);
+               this.setRawValue(value);
        }
 
 });



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to