details: https://code.openbravo.com/erp/devel/pi/rev/b6eadf200426 changeset: 23004:b6eadf200426 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri May 09 10:08:25 2014 +0200 summary: fixed issue 24705: reaplying changeset after CI modifications
diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js | 194 ++++++++- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js | 14 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-tab.js | 26 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js | 121 +++-- 4 files changed, 273 insertions(+), 82 deletions(-) diffs (truncated from 537 to 300 lines): diff -r 81223f18c9c8 -r b6eadf200426 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 Fri May 09 12:52:50 2014 +0530 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Fri May 09 10:08:25 2014 +0200 @@ -199,11 +199,6 @@ leftMemberButtons = [], i, actionButton; - this.messageBar = isc.OBMessageBar.create({ - visibility: 'hidden', - view: this - }); - if (this.isRootView) { this.buildStructure(); } @@ -289,6 +284,18 @@ this.notesDataSource.destroy(); this.notesDataSource = null; } + + // destroy view form + if (this.viewForm) { + this.viewForm.destroy(); + this.viewForm = null; + } + + // destroy view grid + if (this.viewGrid) { + this.viewGrid.destroy(); + this.viewGrid = null; + } return this.Super('destroy', arguments); }, @@ -474,6 +481,11 @@ var me = this, completeFieldsWithoutImages, fieldsWithoutImages; if (this.tabId && this.tabId.length > 0) { + this.messageBar = isc.OBMessageBar.create({ + visibility: 'hidden', + view: this + }); + this.formGridLayout = isc.HLayout.create({ width: '100%', height: '*', @@ -658,14 +670,102 @@ // this // parent. addChildView: function (childView) { - var length, i, actionButton; - if ((childView.isTrlTab && OB.PropertyStore.get('ShowTrl', this.windowId) !== 'Y') || (childView.isAcctTab && OB.PropertyStore.get('ShowAcct', this.windowId) !== 'Y')) { return; } + childView.parentView = this; + childView.parentTabSet = this.childTabSet; + this.standardWindow.addView(childView); + if (this.childTabSet.tabs.length > 0) { + this.prepareBasicChildView(childView); + } else { + this.prepareFullChildView(childView); + } + + + childView.tab = this.childTabSet.getTab(this.childTabSet.tabs.length - 1); + childView.tab.setCustomState(isc.OBStandardView.MODE_INACTIVE); + + OB.TestRegistry.register('org.openbravo.client.application.ChildTab_' + this.tabId + '_' + childView.tabId, childView.tab); + }, + + prepareBasicChildView: function (childView) { + var me = this; + + childView.isRenderedChildView = false; + + var childTabDef = { + title: childView.tabTitle + }; + + childTabDef.pane = isc.VLayout.create({ + isRenderedChildView: false, + lastCalledSizeFunction: null, + updateSubtabVisibility: function () { + return null; + }, + doRefreshContents: function () { + return null; + }, + setTopMaximum: function () { + this.lastCalledSizeFunction = 'setTopMaximum'; + return null; + }, + setBottomMaximum: function () { + this.lastCalledSizeFunction = 'setBottomMaximum'; + return null; + }, + setHalfSplit: function () { + this.lastCalledSizeFunction = 'setHalfSplit'; + return null; + }, + toolBar: { + updateButtonState: function () { + return null; + } + }, + + members: [isc.VLayout.create({})] + }); + + if (childView.showTabIf) { + childTabDef.pane.showTabIf = childView.showTabIf; + if (childView.originalShowTabIf) { + childTabDef.pane.originalShowTabIf = childView.originalShowTabIf; + } + } + + childTabDef.pane.setAsActiveView = function () { + me.prepareFullChildView(childView, childTabDef); + }; + + childTabDef.pane.paneActionOnSelect = function () { + // If the initial load of the window makes that a child tab different from the first one be selected, + // the logic doesn't pass through the 'setAsActiveView' so the 'prepareFullChildView' should be done + // on the tab selection instead. + me.prepareFullChildView(childView, childTabDef); + childTabDef.pane.parentTabSet.doHandleClick(); + }; + + childTabDef.pane.destroy = function () { + if (childView.members.length === 0) { + // That means that there is nothing still loaded in the basic view + // so if the pane is destroyed, its childView can be destroyed too. + // In the other case, the full child view will handle the childView destruction. + childView.destroy(); + } + return this.Super('destroy', arguments); + }; + + this.childTabSet.addTab(childTabDef); + }, + + prepareFullChildView: function (childView, tab) { + var length, i, actionButton, lastCalledSizeFunction; + // Add buttons in parent to child. Note that currently it is only added one level. if (this.actionToolbarButtons && this.actionToolbarButtons.length > 0 && childView.showParentButtons) { length = this.actionToolbarButtons.length; @@ -701,9 +801,6 @@ } } - childView.parentView = this; - childView.parentTabSet = this.childTabSet; - // build the structure of the children childView.buildStructure(); @@ -711,14 +808,47 @@ title: childView.tabTitle, pane: childView }; - - this.childTabSet.addTab(childTabDef); - - childView.tab = this.childTabSet.getTab(this.childTabSet.tabs.length - 1); - // start inactive - childView.tab.setCustomState(isc.OBStandardView.MODE_INACTIVE); - - OB.TestRegistry.register('org.openbravo.client.application.ChildTab_' + this.tabId + '_' + childView.tabId, childView.tab); + if (!tab) { + this.childTabSet.addTab(childTabDef); + } else { + lastCalledSizeFunction = tab.pane.lastCalledSizeFunction; + delete tab.pane.lastCalledSizeFunction; + + // Destroy the old basic child view pane since it is not needed anymore + tab.pane.destroy(); + + this.childTabSet.setTabPane(tab, childTabDef.pane); + + if (this.state === isc.OBStandardView.STATE_IN_MID || this.state === isc.OBStandardView.STATE_MID || this.state === isc.OBStandardView.STATE_TOP_MAX) { + // If the view is in the middle or maximized, set the child view (if exists) minimized + childView.setHeight('100%'); + if (childView.members[1]) { + childView.members[1].setState(isc.OBStandardView.STATE_MIN); + } else { + childView.members[0].setHeight('100%'); + } + } else if (lastCalledSizeFunction) { + // If 'setTopMaximum' or 'setBottomMaximum' or 'setHalfSplit' has been called in an unrendered tab, + // call it again now that the tab has been rendered to set the proper child view status + if (lastCalledSizeFunction === 'setTopMaximum') { + childView.setTopMaximum(); + } else if (lastCalledSizeFunction === 'setBottomMaximum') { + childView.setBottomMaximum(); + } else if (lastCalledSizeFunction === 'setHalfSplit') { + childView.setHalfSplit(); + } + } + } + + childView.isRenderedChildView = true; + + if (childView.initialTabDefinition) { + // If there is an initial tab definition it means that there is a process that have set it there + // but since the window was not loaded yet, it has not been applied. Apply this tab definition now + // and delete the initialTabDefinition variable since it has been already applied. + OB.Personalization.applyViewDefinitionToView(childView, childView.initialTabDefinition); + delete childView.initialTabDefinition; + } }, setReadOnly: function (readOnly) { @@ -874,8 +1004,12 @@ setActiveViewProps: function (state) { if (state) { this.toolBar.show(); - this.statusBar.setActive(true); - this.activeBar.setActive(true); + if (this.statusBar) { + this.statusBar.setActive(true); + } + if (this.activeBar) { + this.activeBar.setActive(true); + } this.setViewFocus(); this.viewGrid.setActive(true); this.viewGrid.markForRedraw(); @@ -890,8 +1024,12 @@ this.viewGrid.closeAnyOpenEditor(); this.toolBar.hide(); - this.statusBar.setActive(false); - this.activeBar.setActive(false); + if (this.statusBar) { + this.statusBar.setActive(false); + } + if (this.activeBar) { + this.activeBar.setActive(false); + } this.viewGrid.setActive(false); this.viewGrid.markForRedraw(); // note we can not check on viewForm visibility as @@ -1032,8 +1170,10 @@ length = this.childTabSet.tabs.length; for (i = 0; i < length; i++) { tabViewPane = this.childTabSet.tabs[i].pane; - tabViewPane.viewGrid.setData([]); - tabViewPane.viewGrid.resetEmptyMessage(); + if (tabViewPane.viewGrid) { + tabViewPane.viewGrid.setData([]); + tabViewPane.viewGrid.resetEmptyMessage(); + } } } }, @@ -1063,7 +1203,9 @@ length = this.childTabSet.tabs.length; for (i = 0; i < length; i++) { tabViewPane = this.childTabSet.tabs[i].pane; - tabViewPane.refreshMeAndMyChildViewsWithEntity(entity, excludedTabIds); + if (typeof tabViewPane.refreshMeAndMyChildViewsWithEntity === 'function') { + tabViewPane.refreshMeAndMyChildViewsWithEntity(entity, excludedTabIds); + } } } } @@ -1240,7 +1382,7 @@ setMaximizeRestoreButtonState: function () { // single view, no maximize or restore - if (!this.hasChildTabs && this.isRootView) { + if ((!this.hasChildTabs && this.isRootView) || !this.statusBar) { return; } // different cases: diff -r 81223f18c9c8 -r b6eadf200426 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js Fri May 09 12:52:50 2014 +0530 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js Fri May 09 10:08:25 2014 +0200 @@ -347,7 +347,7 @@ // - They belong to the entity specified in the 'entity' parameter // - They are not included in the 'excludedTabIds' list refreshViewsWithEntity: function (entity, excludedTabIds) { - if (this.view) { + if (this.view && typeof this.view.refreshMeAndMyChildViewsWithEntity === 'function') { this.view.refreshMeAndMyChildViewsWithEntity(entity, excludedTabIds); } }, @@ -948,6 +948,12 @@ return false; } + activeTabPane = activeTabSet.getTabPane(previousTabIndex); + if (activeTabPane.isRenderedChildView === false && activeTabPane.setAsActiveView) { + // If it is a basic child view, set as active first in order to load the full child view + activeTabPane.setAsActiveView(); ------------------------------------------------------------------------------ Is your legacy SCM system holding you back? Join Perforce May 7 to find out: • 3 signs your SCM is hindering your productivity • Requirements for releasing software faster • Expert tips and advice for migrating your SCM now http://p.sf.net/sfu/perforce _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits