details: /erp/devel/pi/rev/ff3eb1bd41b7
changeset: 11221:ff3eb1bd41b7
user: Iván Perdomo <ivan.perdomo <at> openbravo.com>
date: Mon Mar 14 11:49:14 2011 +0100
summary: Added ViewManager as OB member - removed empty spaces
details: /erp/devel/pi/rev/58ed3d69156d
changeset: 11222:58ed3d69156d
user: Iván Perdomo <ivan.perdomo <at> openbravo.com>
date: Mon Mar 14 13:58:06 2011 +0100
summary: Fixes issue 16265: Fixes cancel button
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
| 123 ++++-----
src/org/openbravo/erpCommon/ad_actionButton/ProjectSetType.html
| 3 +-
2 files changed, 62 insertions(+), 64 deletions(-)
diffs (truncated from 413 to 300 lines):
diff -r 091d7d7de1a9 -r 58ed3d69156d
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
Mon Mar 14 13:17:25 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
Mon Mar 14 13:58:06 2011 +0100
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
@@ -33,27 +33,26 @@
}
// cache object references locally
- var L = OB.Layout, M = OB.MainView, ISC = isc, vmgr; // Local reference to
- // ViewManager instance
- var tabSet = M.TabSet;
-
+ var L = OB.Layout, M = OB.MainView, ISC = isc, vmgr, // Local reference to
ViewManager instance
+ tabSet = M.TabSet;
+
function ViewManager(){
// keep the last 5 opened views
this.recentManager.recentNum = 5;
}
-
+
ViewManager.prototype = {
-
+
// if true then certain functions are disabled
inStateHandling: false,
-
+
recentManager: new OB.RecentUtilitiesClass(),
-
+
// ** {{ ViewManager.views }} **
// Collection of opened views
views: {
cache: [],
-
+
getViewTabID: function(vName, params){
var len = this.cache.length, i, item;
for (i = len; i > 0; i--) {
@@ -64,7 +63,7 @@
}
return null;
},
-
+
getTabNumberFromViewParam: function(param, value) {
var numberOfTabs = tabSet.tabs.length, viewParam = '', result = null;
for (var i = 0; i < numberOfTabs; i++) {
@@ -75,11 +74,11 @@
}
return result;
},
-
+
push: function(instanceDetails) {
this.cache.push(instanceDetails);
},
-
+
removeTab: function(viewTabId) {
var len = this.cache.length, i, item, removed;
for (i = len; i > 0; i--) {
@@ -104,7 +103,7 @@
}
return null;
},
-
+
fetchView: function(viewId, callback, clientContext, params,
useLoadingTab) {
if (useLoadingTab) {
// open a loading tab
@@ -116,7 +115,7 @@
params.loadingTabId = viewTabId;
this.createTab(viewId, viewTabId, layout, params);
}
-
+
var rpcMgr = ISC.RPCManager;
var reqObj = {
params: {
@@ -131,13 +130,13 @@
};
var request = rpcMgr.sendRequest(reqObj);
},
-
+
addRecentDocument: function(params) {
vmgr.recentManager.addRecent('OBUIAPP_RecentDocumentsList',
isc.addProperties({icon:
'[SKINIMG]../../org.openbravo.client.application/images/application-menu/iconWindow.png'},
params));
},
-
+
createTab: function(viewName, viewTabId, viewInstance, params) {
if (params.i18nTabTitle) {
// note call to I18N is done below after the tab
@@ -147,7 +146,7 @@
tabTitle = params.tabTitle || viewInstance.tabTitle || params.tabId ||
viewName;
}
-
+
var tabDef = {
ID: viewTabId,
title: tabTitle,
@@ -165,10 +164,10 @@
if (viewInstance.notClosable) {
tabDef.canClose = false;
}
-
+
// Adding to the MainView tabSet
tabSet.addTab(tabDef);
-
+
if (params.i18nTabTitle) {
tabTitle = '';
// note the callback calls the tabSet
@@ -179,7 +178,7 @@
}
}, 'setTitle');
}
-
+
// tell the viewinstance what tab it is on
// note do not use tabId on the viewInstance
// as tabId is used by the classic ob window
@@ -189,7 +188,7 @@
} else {
viewInstance.viewTabId = viewTabId;
}
-
+
// Adding a reference to opened views collection
vmgr.views.push({
viewName: viewName,
@@ -197,11 +196,11 @@
instance: viewInstance,
viewTabId: viewTabId
});
-
+
// the select tab event will update the history
tabSet.selectTab(viewTabId);
},
-
+
// ** {{{ ViewManager.openView(viewName, params) }}} **
//
// Shows a new tab in the {{{ Main Layout }}}
@@ -216,9 +215,9 @@
// to initialize an instance.
//
openView: function(viewName, params, state) {
-
+
params = params || {};
-
+
// only add closable views to the recent items, this prevents the
workspace
// view from being displayed, explicitly doing !== false to catch
// views which don't have this set at all
@@ -231,40 +230,40 @@
isc.addProperties({icon:
'[SKINIMG]../../org.openbravo.client.application/images/application-menu/iconWindow.png'},
params));
}
-
+
//
// Returns the function implementation of a View
//
function getView(viewName, params, state) {
-
+
if (!viewName) {
throw {
name: 'ParameterRequired',
message: 'View implementation name is required'
};
}
-
+
//
// Shows a view in a tab in the {{{ TabSet }}} or external
//
function showTab(viewName, params, state) {
-
+
var viewTabId, tabTitle, loadingTab = vmgr.findLoadingTab(params);
-
+
if (loadingTab) {
viewTabId = loadingTab.pane.viewTabId;
} else {
viewTabId = vmgr.views.getViewTabID(viewName, params);
}
-
+
// always create a new instance anyway as parameters
// may have changed
var viewInstance = ISC[viewName].create(params);
-
+
if (state && viewInstance.setViewState) {
viewInstance.setViewState(state);
}
-
+
// is not shown in a tab, let it show itself in a different way
// but first get rid of the loading tab
if (viewInstance && viewInstance.show && viewInstance.showsItself) {
@@ -283,7 +282,7 @@
tabSet.updateTab(viewTabId, viewInstance);
// and show it
tabSet.selectTab(viewTabId);
-
+
// tell the viewinstance what tab it is on
// note do not use tabId on the viewInstance
// as tabId is used by the classic ob window
@@ -325,7 +324,7 @@
vmgr.createTab(viewName, viewTabId, viewInstance, params);
}
}
-
+
//
// Function used by the {{ ISC.RPCManager }} after receiving the view
// implementation from the back-end
@@ -344,7 +343,7 @@
}
showTab(viewName, params);
}
-
+
if (isc[viewName]) {
showTab(viewName, params);
} else {
@@ -353,7 +352,7 @@
}
getView(viewName, params, state);
},
-
+
// ** {{{ ViewManager.restoreState(state, data) }}} **
//
// Restores the state of the main layout using the passed in state object.
@@ -361,17 +360,17 @@
// The data object contains extra (more complex) state information which
// can not be bookmarked.
//
-
+
restoreState: function(newState, data) {
-
+
var tabSet = M.TabSet, tabsLength, i, tabObject, hasChanged = false,
stateData;
-
+
if (vmgr.inStateHandling) {
return;
}
-
+
vmgr.inStateHandling = true;
-
+
// create an empty layout
if (!newState) {
tabSet.removeTabs(tabSet.tabs);
@@ -379,7 +378,7 @@
vmgr.inStateHandling = false;
return;
}
-
+
// do some comparison
tabsLength = newState.bm.length;
hasChanged = tabSet.tabs.length !== tabsLength;
@@ -397,9 +396,9 @@
}
}
}
-
+
isc.Log.logDebug('Changed ' + hasChanged, 'OB');
-
+
// changes occured, start from scratch again, recreating each view
if (hasChanged) {
// stop if tabSet removed failed because a tab has incorrect data
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits