details: /erp/devel/pi/rev/009c009a5e6b
changeset: 9880:009c009a5e6b
user: Martin Taal <martin.taal <at> openbravo.com>
date: Mon Jan 17 22:34:45 2011 +0100
summary: Disable new button as a default, solved several focus issues, open
new mode
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 24 +++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
| 23 ++++++---
2 files changed, 37 insertions(+), 10 deletions(-)
diffs (149 lines):
diff -r 03e8d1bbd98e -r 009c009a5e6b
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
Mon Jan 17 19:52:19 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Mon Jan 17 22:34:45 2011 +0100
@@ -187,6 +187,11 @@
leftMembers:
[isc.OBToolbarIconButton.create(isc.OBToolbar.NEW_BUTTON_PROPERTIES),
isc.OBToolbarIconButton.create(isc.OBToolbar.SAVE_BUTTON_PROPERTIES),
isc.OBToolbarIconButton.create(isc.OBToolbar.UNDO_BUTTON_PROPERTIES),
isc.OBToolbarIconButton.create(isc.OBToolbar.DELETE_BUTTON_PROPERTIES),
isc.OBToolbarIconButton.create(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES)],
rightMembers: rightMemberButtons
});
+
+ // disable new for the child views
+ if (!this.isRootView) {
+ this.toolBar.setLeftMemberDisabled(isc.OBToolbar.TYPE_NEW, true);
+ }
this.Super('initWidget', arguments);
},
@@ -321,7 +326,9 @@
}
}
if (this.viewForm) {
+ // note this call messes up the focus handling also
this.viewForm.setDataSource(this.dataSource, this.viewForm.fields);
+ this.dataSourceSet = true;
}
},
@@ -406,6 +413,7 @@
var me = this;
if (this.tabId && this.tabId.length > 0) {
this.formGridLayout = isc.HLayout.create({
+ canFocus: true,
width: '100%',
height: '*',
overflow: 'visible',
@@ -451,6 +459,7 @@
// in ob-view-form-linked-items is still called on the correct
// object
this.statusBarFormLayout = isc.VLayout.create({
+ canFocus: true,
width: '100%',
height: '*',
visibility: 'hidden',
@@ -459,6 +468,7 @@
// to make sure that the form gets the correct scrollbars
formContainerLayout = isc.VLayout.create({
+ canFocus: true,
width: '100%',
height: '*',
overflow: 'auto'
@@ -472,6 +482,7 @@
// wrap the messagebar and the formgridlayout in a VLayout
var gridFormMessageLayout = isc.VLayout.create({
+ canFocus: true,
height: '100%',
width: '100%',
overflow: 'auto'
@@ -481,6 +492,7 @@
// and place the active bar to the left of the form/grid/messagebar
var activeGridFormMessageLayout = isc.HLayout.create({
+ canFocus: true,
height: '100%',
width: '100%',
overflow: 'hidden'
@@ -757,6 +769,14 @@
// child views also
editRecord: function(record, preventFocus){
+ // wait till there is a datasource
+ // this also solves focus issues as the datasource
+ // set messes up focus
+ if (!this.dataSourceSet) {
+ this.delayCall('editRecord', arguments, 500);
+ return;
+ }
+
this.messageBar.hide();
if (!this.isShowingForm) {
@@ -1055,8 +1075,8 @@
isViewVisible: function(){
// note this.tab.isVisible is done as the tab is visible earlier than
// the pane
- return (!this.tab || this.tab.isVisible()) &&
this.parentTabSet.getSelectedTabNumber() ===
- this.parentTabSet.getTabNumber(this.tab);
+ return (!this.tab || this.tab.isVisible()) && (!this.parentTabSet ||
this.parentTabSet.getSelectedTabNumber() ===
+ this.parentTabSet.getTabNumber(this.tab));
},
// ++++++++++++++++++++ Button Actions ++++++++++++++++++++++++++
diff -r 03e8d1bbd98e -r 009c009a5e6b
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
Mon Jan 17 19:52:19 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
Mon Jan 17 22:34:45 2011 +0100
@@ -70,10 +70,13 @@
this.viewProperties.standardWindow = this;
this.viewProperties.isRootView = true;
+ if (this.command === 'NEW') {
+ this.viewProperties.allowDefaultEditMode = false;
+ }
this.view = isc.OBStandardView.create(this.viewProperties);
this.addView(this.view);
this.addMember(this.view);
-
+
this.Super('initWidget', arguments);
// is set later after creation
@@ -120,12 +123,6 @@
}
},
- show: function(){
- var ret = this.Super('show', arguments);
- this.setFocusInView();
- return ret;
- },
-
// is called from the main app tabset
tabDeselected: function(tabNum, tabPane, ID, tab, newTab){
// note: explicitly checking for grid visibility as the form
@@ -165,8 +162,14 @@
setFocusInView: function(){
var currentView = this.activeView || this.view;
+ currentView.setAsActiveView(true);
currentView.setViewFocus();
- currentView.setAsActiveView(true);
+ },
+
+ show: function() {
+ var ret = this.Super('show', arguments);
+ this.setFocusInView();
+ return ret;
},
draw: function(){
@@ -185,6 +188,10 @@
delete this.targetRecordId;
delete this.targetTabId;
delete this.targetEntity;
+ } else if (this.command === 'NEW') {
+ var currentView = this.activeView || this.view;
+ currentView.editRecord();
+ this.command = null;
}
this.setFocusInView();
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits