details:   /erp/devel/pi/rev/87f409dd6784
changeset: 9827:87f409dd6784
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 15 00:38:57 2011 +0100
summary:   Solved issues with direct linking, solved max/restore button state

details:   /erp/devel/pi/rev/8be15ddc03c4
changeset: 9828:8be15ddc03c4
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 15 00:39:20 2011 +0100
summary:   Prevent scrollbar if picklist has only one entry

details:   /erp/devel/pi/rev/589b555e9f05
changeset: 9829:589b555e9f05
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 15 00:40:32 2011 +0100
summary:   Improved selection of record after new and save

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
                                                         |   2 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
                                                                |  80 ++++-----
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
                                                              |  10 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
                                                                    |  11 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
                                                                    |  35 ++-
 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-application-styles.js
 |  15 +-
 6 files changed, 86 insertions(+), 67 deletions(-)

diffs (truncated from 456 to 300 lines):

diff -r 4bbff8be6a4c -r 589b555e9f05 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
       Fri Jan 14 20:05:05 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
       Sat Jan 15 00:40:32 2011 +0100
@@ -130,7 +130,7 @@
   },
   
   doHandleDoubleClick: function(){
-    if (this.state === isc.OBStandardView.STATE_TOP_MAX) {
+    if (this.state === isc.OBStandardView.STATE_TOP_MAX || 
(this.getSelectedTab() && !this.getSelectedTab().pane.hasChildTabs)) {
       // we are maximized go back to the previous state
       if (this.previousState && this.previousState !== this.state) {
         if (this.previousState === isc.OBStandardView.STATE_IN_MID) {
diff -r 4bbff8be6a4c -r 589b555e9f05 
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
      Fri Jan 14 20:05:05 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Sat Jan 15 00:40:32 2011 +0100
@@ -220,12 +220,12 @@
         }
         
         if (editedRecord && editedRecord.editColumnLayout) {
-          if (this.view.viewGrid.isVisible()) {
+          if (!this.view.isShowingForm) {
             editedRecord.editColumnLayout.toggleProgressIcon(true);
           }
         }
         
-        if (this.view.viewForm.isVisible()) {
+        if (this.view.isShowingForm) {
           var btn = this.view.toolBar.getLeftMember(isc.OBToolbar.TYPE_SAVE);
           btn.customState = 'Progress';
           btn.resetBaseStyle();
@@ -301,7 +301,11 @@
         this.viewGrid.targetRecordId = this.targetRecordId;
       }
       this.viewGrid.setDataSource(this.dataSource, 
this.viewGrid.completeFields || this.viewGrid.fields);
-      if (this.isRootView) {
+      
+      // directTabInfo is set when we are in direct link mode, i.e. directly 
opening
+      // a specific tab with a record, the direct link logic will already take 
care
+      // of fetching data
+      if (this.isRootView && !this.standardWindow.directTabInfo) {
         this.viewGrid.fetchData();
         this.refreshContents = false;
       }
@@ -540,7 +544,7 @@
     if (this.lastFocusedItem) {
       object = this.lastFocusedItem;
       functionName = 'focusInItem';
-    } else if (this.viewGrid && this.viewGrid.isVisible()) {
+    } else if (this.viewGrid && !this.isShowingForm) {
       object = this.viewGrid;
       functionName = 'focusInFilterEditor';
     } else if (this.viewForm && this.viewForm.getFocusItem()) {
@@ -591,7 +595,7 @@
       // the grid and form can both be hidden when changing
       // to another tab, this handles the case that the grid
       // is shown but the underlying form has errors
-      if (!this.viewGrid.isVisible()) {
+      if (this.isShowingForm) {
         this.viewForm.autoSave();
       }
     }
@@ -609,11 +613,10 @@
     var me = this;
     this.viewForm.clearErrors();
     this.viewForm.clearValues();
-    // open default edit view if there is no parent view or if there is at 
least
-    // one parent record selected
+    
     if (this.shouldOpenDefaultEditMode()) {
       this.openDefaultEditView();
-    } else if (!this.viewGrid.isVisible()) {
+    } else if (this.isShowingForm) {
       this.switchFormGridVisibility();
     }
     this.viewGrid.refreshContents();
@@ -624,7 +627,7 @@
     // can open default edit mode if defaultEditMode is set
     // and this is the root view or a child view with a selected parent.
     var oneOrMoreSelected = this.viewGrid.data && 
this.viewGrid.data.lengthIsKnown && this.viewGrid.data.lengthIsKnown() &&
-        this.viewGrid.data.getLength() > 1; 
+    this.viewGrid.data.getLength() >= 1;
     return this.allowDefaultEditMode && oneOrMoreSelected && 
this.defaultEditMode && (this.isRootView || 
this.parentView.viewGrid.getSelectedRecords().length === 1);
   },
   
@@ -644,7 +647,7 @@
     // open form in edit mode
     if (record) {
       this.editRecord(record, preventFocus);
-    } else if (this.viewGrid.data && this.viewGrid.data.getLength() > 0) {
+    } else if (this.viewGrid.data && this.viewGrid.data.getLength() > 0 && 
this.viewGrid.data.lengthIsKnown && this.viewGrid.data.lengthIsKnown()) {
       // edit the first record
       this.editRecord(this.viewGrid.getRecord(0), preventFocus);
     }
@@ -654,7 +657,7 @@
   // ** {{{ switchFormGridVisibility }}} **
   // Switch from form to grid view or the other way around
   switchFormGridVisibility: function(){
-    if (this.viewGrid.isVisible()) {
+    if (!this.isShowingForm) {
       this.viewGrid.hide();
       this.statusBarFormLayout.show();
       this.statusBarFormLayout.setHeight('100%');
@@ -713,18 +716,16 @@
   
     this.messageBar.hide();
     
+    if (!this.isShowingForm) {
+      this.switchFormGridVisibility();
+    }
+    
     if (!record) { //  new case
       this.viewGrid.deselectAllRecords();
       this.viewForm.editNewRecord(preventFocus);
-      if (this.viewGrid.isVisible()) {
-        this.switchFormGridVisibility();
-      }
     } else {
+      this.viewGrid.doSelectSingleRecord(record);
       this.viewForm.editRecord(record, preventFocus);
-      if (this.viewGrid.isVisible()) {
-        this.switchFormGridVisibility();
-      }
-      this.viewGrid.doSelectSingleRecord(record);
     }
     
     isc.Page.setEvent(isc.EH.IDLE, this.viewForm, isc.Page.FIRE_ONCE, 'focus');
@@ -740,9 +741,16 @@
     if (this.parentTabSet) {
       theState = this.parentTabSet.state;
     }
+    
     if (theState === isc.OBStandardView.STATE_TOP_MAX) {
       this.statusBar.maximizeButton.hide();
       this.statusBar.restoreButton.show(true);
+    } else if (theState === isc.OBStandardView.STATE_IN_MID) {
+      this.statusBar.maximizeButton.show(true);
+      this.statusBar.restoreButton.hide();
+    } else if (!this.hasChildTabs) {
+      this.statusBar.maximizeButton.hide();
+      this.statusBar.restoreButton.show(true);
     } else {
       this.statusBar.maximizeButton.show(true);
       this.statusBar.restoreButton.hide();
@@ -805,12 +813,14 @@
     } else {
       this.doHandleClick();
     }
-    if (!this.viewForm.newRecordSavedEvent || !this.viewForm.isVisible()) {
+    this.setMaximizeRestoreButtonState();
+    
+    // show the form with the selected record
+    if (!this.isShowingForm) {
       var gridRecord = this.viewGrid.getSelectedRecord();
       if (gridRecord) {
         this.editRecord(gridRecord);
       }
-      this.viewForm.newRecordSavedEvent = false;
     }
     
     // remove this info
@@ -855,18 +865,11 @@
   // Is called when a record get's selected. Will refresh direct child views
   // which will again refresh their children.
   recordSelected: function(){
-    this.fireOnPause('recordSelected', {
-      target: this,
-      methodName: 'doRecordSelected',
-      args: []
-    }, this.fetchDelay);
-  },
-  
-  doRecordSelected: function(){
     // no change go away
     if (this.viewGrid.getSelectedRecords().length === 1 && 
this.viewGrid.getSelectedRecord() === this.lastRecordSelected) {
       return;
     }
+    this.lastRecordSelected = this.viewGrid.getSelectedRecord();
     
     var tabViewPane = null;
     
@@ -880,7 +883,6 @@
     // and recompute the count:
     this.updateChildCount();
     this.updateTabTitle();
-    this.lastRecordSelected = this.viewGrid.getSelectedRecord();
     
     this.toolBar.refreshToolbarButtons();
   },
@@ -909,12 +911,8 @@
       this.toolBar.setLeftMemberDisabled(isc.OBToolbar.TYPE_NEW, 
this.readOnly);
     }
     
-    // switch back to the grid or form
-    if (this.shouldOpenDefaultEditMode()) {
-      if (this.viewGrid.isVisible()) {
-        this.switchFormGridVisibility();
-      }
-    } else if (!this.viewGrid.isVisible()) {
+    // switch back to the grid
+    if (this.isShowingForm) {
       this.switchFormGridVisibility();
     }
     
@@ -1003,7 +1001,7 @@
     var prefix = '';
     var suffix = '';
     
-    if (this.viewForm.isVisible() && this.viewForm.isNew) {
+    if (this.isShowingForm && this.viewForm.isNew) {
       if (isc.Page.isRTL()) {
         suffix = ' *';
       } else {
@@ -1018,7 +1016,7 @@
     
     var identifier, tab;
     // showing the form
-    if (!this.viewGrid.isVisible() && this.viewGrid.getSelectedRecord() && 
this.viewGrid.getSelectedRecord()[OB.Constants.IDENTIFIER]) {
+    if (this.isShowingForm && this.viewGrid.getSelectedRecord() && 
this.viewGrid.getSelectedRecord()[OB.Constants.IDENTIFIER]) {
       identifier = this.viewGrid.getSelectedRecord()[OB.Constants.IDENTIFIER];
       if (!this.parentTabSet && this.viewTabId) {
         tab = OB.MainView.TabSet.getTab(this.viewTabId);
@@ -1056,7 +1054,7 @@
   // - recursive to children: refresh the children, put the children in grid 
mode and refresh
   
   refresh: function(refreshCallback){
-    if (this.viewGrid.isVisible()) {
+    if (!this.isShowingForm) {
       this.messageBar.hide();
       this.viewGrid.filterData(this.viewGrid.getCriteria(), refreshCallback);
     } else {
@@ -1093,7 +1091,7 @@
     var callback = function(ok){
       var i, data, error, removeCallBack = function(resp, data, req){
         if (resp.status === isc.RPCResponse.STATUS_SUCCESS) {
-          if (!view.viewGrid.isVisible()) {
+          if (view.isShowingForm) {
             view.switchFormGridVisibility();
             if (resp.clientContext && resp.clientContext.refreshGrid) {
               view.viewGrid.filterData();
@@ -1259,7 +1257,7 @@
     // different modes:
     // 1) showing grid with one record selected
     // 2) showing form with aux inputs
-    if (this.viewGrid.isVisible()) {
+    if (!this.isShowingForm) {
       record = this.viewGrid.getSelectedRecord();
       component = this.viewGrid;
     } else {
@@ -1292,7 +1290,7 @@
         }
       }
     }
-    if (this.viewForm.isVisible()) {
+    if (this.isShowingForm) {
       isc.addProperties(contextInfo, this.viewForm.auxInputs);
       isc.addProperties(contextInfo, this.viewForm.hiddenInputs);
     }
diff -r 4bbff8be6a4c -r 589b555e9f05 
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
    Fri Jan 14 20:05:05 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
    Sat Jan 15 00:40:32 2011 +0100
@@ -43,6 +43,12 @@
       overflow: 'visible'
     });
     
+    if (this.targetTabId) {
+      // is used as a flag so that we are in direct link mode
+      // prevents extra fetch data actions
+      this.directTabInfo = {};
+    }
+        
     this.addMember(this.toolBarLayout);
     
     this.viewProperties.standardWindow = this;
@@ -107,7 +113,7 @@
   tabDeselected: function(tabNum, tabPane, ID, tab, newTab){
     // note: explicitly checking for grid visibility as the form
     // may already be hidden
-    if (this.activeView && !this.activeView.viewGrid.isVisible()) {
+    if (this.activeView && this.activeView.isShowingForm) {
       this.activeView.viewForm.autoSave(null, true);
     }
     this.wasDeselected = true;
@@ -210,5 +216,5 @@
   // returns the view information for the help view.
   getHelpView: function(){
     return null;
-  }  
+  }
 });
diff -r 4bbff8be6a4c -r 589b555e9f05 
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
  Fri Jan 14 20:05:05 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Sat Jan 15 00:40:32 2011 +0100
@@ -447,13 +447,12 @@
         if (form.isNew) {
           view.viewGrid.updateRowCountDisplay();
           view.viewGrid.targetRecordId = data.id;
-          // this flag prevents the re-opening of the form
-          this.newRecordSavedEvent = true;
           view.viewGrid.filterData(view.viewGrid.getCriteria());
-        } else {

------------------------------------------------------------------------------
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

Reply via email to