Related to 18072: Focus handling in form and grid editing needs to be cleaned up, results in unpredictable behavior
authorMartin Taal <martin.taal@openbravo.com>
Mon, 01 Aug 2011 16:04:40 +0200
changeset 13363 b6c381dc939e
parent 13362 c087bb4d81c2
child 13364 48ce4704f0dc
Related to 18072: Focus handling in form and grid editing needs to be cleaned up, results in unpredictable behavior
Also removed not-needed code, prevent too many focus actions from taking place
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js	Mon Aug 01 15:51:20 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js	Mon Aug 01 16:04:40 2011 +0200
@@ -198,10 +198,6 @@
     }
   },
   
-  doSelectElement: function() {
-    this.Super('doSelectElement', [this.dateTextField]);
-  },
-  
   // update the value in update value as this is called from cellEditEnd in the
   // grid
   updateValue: function() {
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Mon Aug 01 15:51:20 2011 +0200
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Mon Aug 01 16:04:40 2011 +0200
@@ -89,17 +89,6 @@
     }
     return this._original_compareValues(value1, value2);
   },
- 
-  // overridden because when a formitem has showDisabled false
-  // then still its icons are shown disabled
-  _getIconURL: isc.FormItem.getPrototype().getIconURL,
-  getIconURL: function (icon, over, disabled, focused) {
-    if (disabled && !this.showDisabled) {
-      return this._getIconURL(icon, over, false, focused);
-    } else {
-      return this._getIconURL(icon, over, disabled, focused);
-    }
-  },
   
   _handleTitleClick: isc.FormItem.getPrototype().handleTitleClick,
   handleTitleClick: function() {
@@ -113,6 +102,16 @@
     return this._handleTitleClick();
   },
   
+  // prevent to many calls to focus in item if there is already focus
+  _focusInItem: isc.FormItem.getPrototype().focusInItem,
+  focusInItem: function() {
+    if (this.hasFocus) {
+      this.selectValue();
+      return;
+    }
+    this._focusInItem();
+  },
+
   titleClick: function(form, item){
     item.focusInItem();
     if (item.linkButtonClick) {
@@ -144,27 +143,6 @@
     }
     this.hasFocus = true;
   },
-
-  doSelectElement: function(item, delayed) {
-    var me = this;
-    
-    if (!delayed && isc.Browser.isIE) {
-      this.fireOnPause("doSelectElement", function() {
-        me.doSelectElement(item, true);
-      }, 0, this);
-      return;
-    }
-    
-    item = item || this;
-    if (isc.isA.OBTextAreaItem(item)) {
-      // don't do anything here
-    } else if (item.getElement() && item.getElement().select) {
-      item.getElement().select();
-    } else {
-      // nothing else, just do the native stuff
-      this.selectValue();
-    }
-  },
   
   blur: function(form, item){
     if (item._hasChanged && form && form.handleItemChange) {