details:   https://code.openbravo.com/erp/devel/pi/rev/9b7cc13eaec9
changeset: 18124:9b7cc13eaec9
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu Oct 04 20:15:29 2012 +0200
summary:   Fixed issue 21728: Now when going back to child/parent tab, the 
focus remains in the same previous place

details:   https://code.openbravo.com/erp/devel/pi/rev/39b8bbea9038
changeset: 18125:39b8bbea9038
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu Oct 04 20:19:01 2012 +0200
summary:   Fixed issue 21786: ESC [KS] now does the expected behavior in combos

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
             |   7 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
                  |   9 ++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
         |  16 +++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
      |   2 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-keyboard-manager.js
 |  38 ++++++++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
        |   9 +-
 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  |  14 +++
 7 files changed, 84 insertions(+), 11 deletions(-)

diffs (197 lines):

diff -r cc537979b11b -r 39b8bbea9038 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Thu Oct 04 18:17:15 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Thu Oct 04 20:19:01 2012 +0200
@@ -1835,6 +1835,13 @@
 
   keyDown: function () {
     if (this.grid && this.grid.editFormKeyDown) {
+      // To fix issue https://issues.openbravo.com/view.php?id=21786
+      var focusedItem = this.getFocusItem(),
+          isEscape = isc.EH.getKey() === 'Escape' && !isc.EH.ctrlKeyDown() && 
!isc.EH.altKeyDown() && !isc.EH.shiftKeyDown();
+      if (isEscape && focusedItem && 
Object.prototype.toString.call(focusedItem.isPickListShown) === '[object 
Function]' && focusedItem.isPickListShown()) {
+        return true; // Then the event will bubble to ComboBoxItem.keyDown
+      }
+
       // To fix issue https://issues.openbravo.com/view.php?id=21382
       this.grid.editFormKeyDown(arguments);
     }
diff -r cc537979b11b -r 39b8bbea9038 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Thu Oct 04 18:17:15 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Thu Oct 04 20:19:01 2012 +0200
@@ -127,7 +127,14 @@
   },
 
   filterFieldsKeyDown: function (item, form, keyName) {
-    var response = OB.KeyboardManager.Shortcuts.monitor('OBGrid.filter', 
this.grid.fieldSourceGrid);
+    // To fix issue https://issues.openbravo.com/view.php?id=21786
+    var isEscape = isc.EH.getKey() === 'Escape' && !isc.EH.ctrlKeyDown() && 
!isc.EH.altKeyDown() && !isc.EH.shiftKeyDown(),
+        response;
+    if (isEscape && item && 
Object.prototype.toString.call(item.isPickListShown) === '[object Function]' && 
item.isPickListShown()) {
+      return true; // Then the event will bubble to ComboBoxItem.keyDown
+    }
+
+    response = OB.KeyboardManager.Shortcuts.monitor('OBGrid.filter', 
this.grid.fieldSourceGrid);
     if (response !== false) {
       response = this.Super('filterFieldsKeyDown', arguments);
     }
diff -r cc537979b11b -r 39b8bbea9038 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Thu Oct 04 18:17:15 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Thu Oct 04 20:19:01 2012 +0200
@@ -674,8 +674,20 @@
       this.viewGrid.enableShortcuts();
     }
 
-    if (this.isShowingForm && this.viewForm && this.viewForm.getFocusItem()) {
-      object = this.viewForm.getFocusItem();
+    if (this.isShowingForm && this.viewForm) {
+      if (this.lastFocusedItem && this.lastFocusedItem.getCanFocus()) {
+        object = this.lastFocusedItem;
+      } else if (this.viewForm.getFocusItem() && 
this.viewForm.getFocusItem().getCanFocus()) {
+        object = this.viewForm.getFocusItem();
+      } else {
+        var fields = this.viewForm.fields;
+        for (i = 0; i < fields.length; i++) {
+          if (fields[i].getCanFocus()) {
+            object = fields[i];
+            break;
+          }
+        }
+      }
       functionName = 'focusInItem';
     } else if (this.isEditingGrid && this.viewGrid.getEditForm() && 
this.viewGrid.getEditForm().getFocusItem()) {
       object = this.viewGrid.getEditForm();
diff -r cc537979b11b -r 39b8bbea9038 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
      Thu Oct 04 18:17:15 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
      Thu Oct 04 20:19:01 2012 +0200
@@ -36,7 +36,7 @@
     var theView = this.view,
         record, rowNum, actionObject;
 
-    if (!theView.isShowingForm && theView.viewGrid.getSelectedRecords().length 
=== 1) {
+    if (!theView.isShowingForm && theView.viewGrid.getSelectedRecords() && 
theView.viewGrid.getSelectedRecords().length === 1) {
       // Keep current selection that might be lost in autosave
       record = theView.viewGrid.getSelectedRecord();
       rowNum = theView.viewGrid.getRecordIndex(record);
diff -r cc537979b11b -r 39b8bbea9038 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-keyboard-manager.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-keyboard-manager.js
 Thu Oct 04 18:17:15 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-keyboard-manager.js
 Thu Oct 04 20:19:01 2012 +0200
@@ -347,25 +347,55 @@
   // Initialize KeyboardManager object
   keyboardMgr = O.KeyboardManager = new KeyboardManager();
 
+  // To fix issue https://issues.openbravo.com/view.php?id=21786
+  isc.ComboBoxItem.getPrototype()._originalKeyDown = 
isc.ComboBoxItem.getPrototype().keyDown;
+  isc.ComboBoxItem.getPrototype().keyDown = function () {
+    var actionObject = {
+      target: this,
+      method: this._originalKeyDown,
+      parameters: arguments
+    },
+        response = OB.Utilities.callAction(actionObject),
+        isEscape = isc.EH.getKey() === 'Escape' && !isc.EH.ctrlKeyDown() && 
!isc.EH.altKeyDown() && !isc.EH.shiftKeyDown();
+
+    if (isEscape && this.isPickListShown()) {
+      this.hidePicker();
+      response = false;
+    }
+    return response;
+  };
+
   /* isc.Page.setEvent('keyPress', 
'OB.KeyboardManager.Shortcuts.monitor('Canvas')'); // Discart due to Chrome 
event propagation problems http://forums.smartclient.com/showthread.php?p=65578 
*/
   isc.Canvas.getPrototype()._originalKeyDown = 
isc.Canvas.getPrototype().keyDown;
   isc.Canvas.getPrototype().keyDown = function () {
+    var actionObject = {
+      target: this,
+      method: this._originalKeyDown,
+      parameters: arguments
+    },
+        response;
+
     if (isc.Event.getKey() === 'Space') {
       OB.KeyboardManager.Shortcuts.isSpacePressed = true;
     }
-    var response = OB.KeyboardManager.Shortcuts.monitor('Canvas');
-    if (response) { // To ensure that if a previous keyDown was set in the 
Canvas it is executed if the action KeyboardManager.action should be propagated
-      response = this._originalKeyDown();
+    response = OB.KeyboardManager.Shortcuts.monitor('Canvas');
+    if (response !== false) { // To ensure that if a previous keyDown was set 
in the Canvas it is executed if the action KeyboardManager.action should be 
propagated
+      response = OB.Utilities.callAction(actionObject);
     }
     return response;
   };
 
   isc.Canvas.getPrototype()._originalKeyUp = isc.Canvas.getPrototype().keyUp;
   isc.Canvas.getPrototype().keyUp = function () {
+    var actionObject = {
+      target: this,
+      method: this._originalKeyUp,
+      parameters: arguments
+    };
     if (isc.Event.getKey() === 'Space') {
       OB.KeyboardManager.Shortcuts.isSpacePressed = false;
     }
-    return this._originalKeyUp();
+    return OB.Utilities.callAction(actionObject);
   };
 
 }(OB, isc));
\ No newline at end of file
diff -r cc537979b11b -r 39b8bbea9038 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
        Thu Oct 04 18:17:15 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
        Thu Oct 04 20:19:01 2012 +0200
@@ -237,6 +237,8 @@
 // If action is null/undefined then nothing is done and undefined is returned.
 // When the action is called the result of the action is returned.
 OB.Utilities.callAction = function (action) {
+  var response;
+
   function IEApplyHack(method, object, parameters) {
     if (!object) {
       object = window;
@@ -262,18 +264,19 @@
     return result;
   }
 
-  if (!action) {
+  if (!action || !action.method) {
     return;
   }
   if (action.callback) {
     action.callback();
   } else {
     if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1) {
-      IEApplyHack(action.method, action.target, action.parameters);
+      response = IEApplyHack(action.method, action.target, action.parameters);
     } else {
-      action.method.apply(action.target, action.parameters);
+      response = action.method.apply(action.target, action.parameters);
     }
   }
+  return response;
 };
 
 // ** {{{OB.Utilities.replaceNullStringValue}}} **
diff -r cc537979b11b -r 39b8bbea9038 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- 
a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Thu Oct 04 18:17:15 2012 +0200
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Thu Oct 04 20:19:01 2012 +0200
@@ -567,6 +567,20 @@
   }
 });
 
+// To fix issue https://issues.openbravo.com/view.php?id=21786
+isc.ComboBoxItem.addProperties({
+  isPickListShown: function () {
+    return (this.pickList ? (this.pickList.isDrawn() && 
this.pickList.isVisible()) : false);
+  },
+
+  hidePicker: function () {
+    if (this.pickList) {
+      this.pickList.hideClickMask();
+      this.pickList.hide();
+    }
+  }
+});
+
 // overridden to never show a prompt. A prompt can be created manually 
 // when overriding for example the DataSource (see the OBStandardView).
 isc.RPCManager.showPrompt = false;

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to