Mouse cursor only changes for mid tabset, solved layout issue for grand-child tab when minimized
authorMartin Taal <martin.taal@openbravo.com>
Tue, 25 Jan 2011 23:52:34 +0100
changeset 10132 4569470336c6
parent 10131 8007b8d1d5ba
child 10133 e67983e0ed86
Mouse cursor only changes for mid tabset, solved layout issue for grand-child tab when minimized
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js
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-tabset.js	Tue Jan 25 23:51:27 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-tabset.js	Tue Jan 25 23:52:34 2011 +0100
@@ -38,7 +38,7 @@
       isc.Timer.setTimeout(function(){
         // if no double click happened then do the single click
         if (me.dblClickWaiting) {
-          me.dblClickWaiting = false;          
+          me.dblClickWaiting = false;
           me.tabSet.doHandleClick();
         }
       }, OB.Constants.DBL_CLICK_DELAY);
@@ -59,26 +59,37 @@
     },
     
     mouseDown: function() {
-      this.setCursor(isc.Canvas.MOVE);
+      if (this.state === isc.OBStandardView.STATE_IN_MID) {
+        this.setCursor(isc.Canvas.MOVE);
+      }
     },
     
     mouseUp: function() {
-      this.setCursor(isc.Canvas.ROW_RESIZE);
+      if (this.state === isc.OBStandardView.STATE_IN_MID) {
+        this.setCursor(isc.Canvas.ROW_RESIZE);
+      }
     },
     
     mouseOut: function() {
-      this.setCursor(isc.Canvas.ROW_RESIZE);
+      if (this.state === isc.OBStandardView.STATE_IN_MID) {
+        this.setCursor(isc.Canvas.ROW_RESIZE);
+      }
     },
     
     mouseOver: function() {
-      this.setCursor(isc.Canvas.ROW_RESIZE);
+      if (this.state === isc.OBStandardView.STATE_IN_MID) {
+        this.setCursor(isc.Canvas.ROW_RESIZE);
+      }
     },
 
     getCurrentCursor: function() {
-      if (isc.EventHandler.leftButtonDown()) {
-        return isc.Canvas.MOVE;
+      if (this.state === isc.OBStandardView.STATE_IN_MID) {
+        if (isc.EventHandler.leftButtonDown()) {
+          return isc.Canvas.MOVE;
+        }
+        return isc.Canvas.ROW_RESIZE;
       }
-      return isc.Canvas.ROW_RESIZE;
+      return this.Super('getCurrentCursor', arguments);
     },
     
     dragStart: function(){
@@ -208,12 +219,14 @@
       }
       
     } else if (newState === isc.OBStandardView.STATE_MIN) {
-      // the height is set to the height of the tabbar
-      this.setHeight(this.tabBar.getHeight());
       for (i = 0; i < this.tabs.length; i++) {
         tab = this.tabs[i];
         this.getTabPane(tab).hide();
       }
+
+      // the height is set to the height of the tabbar
+      this.setHeight(this.tabBar.getHeight());
+
       this.state = newState;
     } else if (newState === isc.OBStandardView.STATE_BOTTOM_MAX) {
       // the top part in each layout is set to 0%, and the bottom to max
@@ -236,10 +249,12 @@
       for (i = 0; i < this.tabs.length; i++) {
         tab = this.tabs[i];
         pane = this.getTabPane(tab);
+        pane.setHeight('100%');
         this.makeTabVisible(tab);
-        pane.members[0].setHeight('*');
         if (pane.members[1]) {
           pane.members[1].setState(isc.OBStandardView.STATE_MIN);
+        } else {
+          pane.members[0].setHeight('100%');
         }
       }
     } else if (newState === isc.OBStandardView.STATE_MID) {
@@ -253,8 +268,8 @@
       for (i = 0; i < this.tabs.length; i++) {
         tab = this.tabs[i];
         pane = this.getTabPane(tab);
+        this.makeTabVisible(tab);
         pane.setHalfSplit();
-        this.makeTabVisible(tab);
       }
     }
     
@@ -269,23 +284,23 @@
   makeTabVisible: function(tab){
     if (tab === this.getSelectedTab()) {
       pane = this.getTabPane(tab);
-      pane.show();
-      if (pane.doRefreshContents) {
+      if (pane.refreshContents) {
         pane.doRefreshContents();
       }
+      pane.show();
       if (pane.members[0]) {
         pane.members[0].show();
       }
       if (pane.members[1]) {
         pane.members[1].show();
       }
-      this.selectTab(tab);
+//      this.selectTab(tab);
     }
   },
   
   tabSelected: function(tabNum, tabPane, ID, tab){
     if (tabPane.refreshContents) {
-      tabPane.doRefreshContents();
+      tabPane.doRefreshContents(true);
     }
   },
   
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Tue Jan 25 23:51:27 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Tue Jan 25 23:52:34 2011 +0100
@@ -128,7 +128,7 @@
   // The id of the record to initially show.
   targetRecordId: null,
   
-  // ** {{{ targetEntity }}} **
+  // ** {{{ entity }}} **
   // The entity to show.
   entity: null,
   
@@ -233,14 +233,9 @@
     
     if (this.isRootView) {
       if (this.childTabSet) {
-        this.members[0].setHeight('50%');
-        this.members[1].setHeight('50%');
         this.childTabSet.setState(isc.OBStandardView.STATE_IN_MID);
-        this.childTabSet.selectTab(this.childTabSet.tabs[0]);
-        
+        this.childTabSet.selectTab(this.childTabSet.tabs[0]);        
         OB.TestRegistry.register('org.openbravo.client.application.ChildTabSet_' + this.tabId, this.viewForm);
-      } else {
-        this.members[0].setHeight('100%');
       }
     }
   },
@@ -442,7 +437,6 @@
   // ** {{{ createMainParts }}} **
   // Creates the main layout components of this view.
   createMainParts: function(){
-    var formContainerLayout;
     var me = this;
     if (this.tabId && this.tabId.length > 0) {
       this.formGridLayout = isc.HLayout.create({
@@ -500,44 +494,45 @@
       });
       
       // to make sure that the form gets the correct scrollbars
-      formContainerLayout = isc.VLayout.create({
+      this.formContainerLayout = isc.VLayout.create({
         canFocus: true,
         width: '100%',
         height: '*',
         overflow: 'auto'
       });
-      formContainerLayout.addMember(this.viewForm);
+      this.formContainerLayout.addMember(this.viewForm);
       
       this.statusBarFormLayout.addMember(this.statusBar);
-      this.statusBarFormLayout.addMember(formContainerLayout);
+      this.statusBarFormLayout.addMember(this.formContainerLayout);
       
       this.formGridLayout.addMember(this.statusBarFormLayout);
       
       // wrap the messagebar and the formgridlayout in a VLayout
-      var gridFormMessageLayout = isc.VLayout.create({
+      this.gridFormMessageLayout = isc.VLayout.create({
         canFocus: true,
         height: '100%',
         width: '100%',
         overflow: 'auto'
       });
-      gridFormMessageLayout.addMember(this.messageBar);
-      gridFormMessageLayout.addMember(this.formGridLayout);
+      this.gridFormMessageLayout.addMember(this.messageBar);
+      this.gridFormMessageLayout.addMember(this.formGridLayout);
       
       // and place the active bar to the left of the form/grid/messagebar
-      var activeGridFormMessageLayout = isc.HLayout.create({
+      this.activeGridFormMessageLayout = isc.HLayout.create({
         canFocus: true,
-        height: '100%',
+        height: (this.hasChildTabs ? '50%' : '100%'),
         width: '100%',
         overflow: 'hidden'
       });
       
-      activeGridFormMessageLayout.addMember(this.activeBar);
-      activeGridFormMessageLayout.addMember(gridFormMessageLayout);
+      this.activeGridFormMessageLayout.addMember(this.activeBar);
+      this.activeGridFormMessageLayout.addMember(this.gridFormMessageLayout);
       
-      this.addMember(activeGridFormMessageLayout);
+      this.addMember(this.activeGridFormMessageLayout);
     }
     if (this.hasChildTabs) {
       this.childTabSet = isc.OBStandardViewTabSet.create({
+        height: '*',
         parentContainer: this,
         parentTabSet: this.parentTabSet
       });
@@ -682,9 +677,10 @@
     if (!this.refreshContents && !doRefreshWhenVisible) {
       return;
     }
+    
     // can be used by others to see that we are refreshing content
     this.refreshContents = true;
-
+    
     // clear all our selections..
     this.viewGrid.deselectAllRecords();
     
@@ -1313,29 +1309,20 @@
   setTopMaximum: function(){
     this.setHeight('100%');
     if (this.members[1]) {
-      this.members[0].setHeight('*');
       this.members[1].setState(isc.OBStandardView.STATE_MIN);
-      this.members[1].show();
-      this.members[0].show();
       this.convertToPercentageHeights();
     } else {
       this.members[0].setHeight('100%');
-      this.members[0].show();
     }
+    this.members[0].show();
     this.state = isc.OBStandardView.STATE_TOP_MAX;
     this.setMaximizeRestoreButtonState();
   },
   
   setBottomMaximum: function(){
-    this.setHeight('100%');
     if (this.members[1]) {
       this.members[0].hide();
-      this.members[0].setHeight(0);
       this.members[1].setHeight('100%');
-      this.members[1].show();
-    } else {
-      this.members[0].setHeight('100%');
-      this.members[0].show();
     }
     this.state = isc.OBStandardView.STATE_BOTTOM_MAX;
     this.setMaximizeRestoreButtonState();
@@ -1347,27 +1334,20 @@
     if (this.members[1]) {
       // divide the space between the first and second level
       if (this.members[1].draggedHeight) {
-        this.members[0].setHeight('*');
         this.members[1].setHeight(this.members[1].draggedHeight);
-        this.members[0].show();
-        this.members[1].show();
         this.convertToPercentageHeights();
-        this.members[1].setState(isc.OBStandardView.STATE_IN_MID);
       } else {
         // NOTE: noticed that when resizing multiple members in a layout, that it 
         // makes a difference what the order of resizing is, first resize the 
         // one which will be larger, then the one which will be smaller.
-        // also do the STATE_IN_MID before resizing
         this.members[1].setHeight('50%');
         this.members[0].setHeight('50%');
-        this.members[1].show();
-        this.members[0].show();
-        this.members[1].setState(isc.OBStandardView.STATE_IN_MID);
       }
+      this.members[1].setState(isc.OBStandardView.STATE_IN_MID);
     } else {
       this.members[0].setHeight('100%');
-      this.members[0].show();
     }
+    this.members[0].show();
     this.state = isc.OBStandardView.STATE_MID;
     this.setMaximizeRestoreButtonState();
   },