details: /erp/devel/pi/rev/710294c9bb0f
changeset: 10945:710294c9bb0f
user: Martin Taal <martin.taal <at> openbravo.com>
date: Tue Mar 01 14:16:00 2011 +0100
summary: Solve loose of focus too child tab
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 10 ++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
| 10 +++
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
| 29 +++++----
3 files changed, 35 insertions(+), 14 deletions(-)
diffs (143 lines):
diff -r 7990d87ea92e -r 710294c9bb0f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Tue Mar 01 13:58:07 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Tue Mar 01 14:16:00 2011 +0100
@@ -497,7 +497,7 @@
},
setViewFocus: function(){
-
+
var object, functionName;
// clear for a non-focusable item
@@ -697,6 +697,10 @@
this.statusBarFormLayout.show();
this.statusBarFormLayout.setHeight('100%');
// this member should be set after the form is shown
+ if (this.isActiveView()) {
+ this.viewForm.resetFocusItem();
+ this.setViewFocus();
+ }
this.isShowingForm = true;
} else {
this.statusBarFormLayout.hide();
@@ -704,7 +708,9 @@
this.viewForm.resetForm();
this.isShowingForm = false;
this.viewGrid.show();
- this.viewGrid.focusInFilterEditor();
+ if (this.isActiveView()) {
+ this.viewGrid.focusInFilterEditor();
+ }
this.viewGrid.setHeight('100%');
}
diff -r 7990d87ea92e -r 710294c9bb0f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
Tue Mar 01 13:58:07 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-tab.js
Tue Mar 01 14:16:00 2011 +0100
@@ -219,6 +219,16 @@
isc.ClassFactory.defineClass('OBTabBarButtonChild', isc.OBTabBarButton);
+isc.OBTabBarButtonChild.addProperties({
+ // when a tab is drawn the first time it steals the focus
+ // from the active view, prevent this
+ focus: function() {
+ if (this.pane.isActiveView && this.pane.isActiveView()) {
+ this.Super('focus', arguments);
+ }
+ }
+});
+
isc.ClassFactory.defineClass('OBTabSetChild', isc.OBTabSet);
isc.OBTabSetChild.addProperties({
diff -r 7990d87ea92e -r 710294c9bb0f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Tue Mar 01 13:58:07 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Tue Mar 01 14:16:00 2011 +0100
@@ -206,8 +206,10 @@
// is set for inline grid editing for example
if (this.getFocusItem() && this.getFocusItem().getCanFocus()) {
- this.getFocusItem().focusInItem();
- this.view.lastFocusedField = this.getFocusItem();
+ if (this.view.isActiveView()) {
+ this.getFocusItem().focusInItem();
+ }
+ this.view.lastFocusedItem = this.getFocusItem();
return;
}
@@ -222,9 +224,12 @@
}
},
- setFocusInItem: function(item) {
+ setFocusInItem: function(item, doFocus) {
this.setFocusItem(item);
- this.view.lastFocusedField = item;
+ this.view.lastFocusedItem = item;
+ if (doFocus && this.view.isActiveView()) {
+ item.focusInItem();
+ }
},
setFindNewFocusItem: function() {
@@ -234,8 +239,7 @@
if(this.firstFocusedField) {
item = this.getItem(this.firstFocusedField);
if(item && item.getCanFocus()) {
- item.focusInItem();
- this.view.lastFocusedField = item;
+ this.setFocusInItem(item, true);
return;
}
}
@@ -249,7 +253,7 @@
for (var i = 0; i < length; i++) {
item = items[i];
if (item.getCanFocus() && !item.isDisabled()) {
- item.focusInItem();
+ this.setFocusInItem(item, true);
return;
}
}
@@ -334,7 +338,7 @@
delete this.ignoreFirstFocusEvent;
return;
}
- if (me.getFocusItem()) {
+ if (me.getFocusItem() && me.view.isActiveView()) {
me.getFocusItem().focusInItem();
}
});
@@ -470,8 +474,9 @@
for (var i = 0; i < this.getFields().length; i++) {
delete this.getFields()[i].canFocus;
}
-
- this.getFocusItem().focusInItem();
+ if (this.view.isActiveView()) {
+ this.getFocusItem().focusInItem();
+ }
}
}
this.view.viewGrid.refreshEditRow();
@@ -662,7 +667,7 @@
// disable with a delay to allow the focus to be moved to a new field
// before disabling
- this.delayCall('setDisabled', [true], 100);
+ this.delayCall('setDisabled', [true], 10);
var editRow = this.view.viewGrid.getEditRow();
// collect the context information
@@ -878,7 +883,7 @@
// otherwise the focus results in infinite cycles
// with views getting activated all the time
this.setFocusItem(errorFld);
- } else {
+ } else if (this.view.isActiveView()){
errorFld.focusInItem();
}
return;
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits