details: /erp/devel/pi/rev/2463349571b0
changeset: 9832:2463349571b0
user: Martin Taal <martin.taal <at> openbravo.com>
date: Sat Jan 15 09:15:54 2011 +0100
summary: Added description of directlink opening, moved method a bit down
diffstat:
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
| 19 ++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
| 15 +-
3 files changed, 76 insertions(+), 38 deletions(-)
diffs (186 lines):
diff -r 8f802cc2e06e -r 2463349571b0
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
Sat Jan 15 09:00:19 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Sat Jan 15 09:15:54 2011 +0100
@@ -20,11 +20,14 @@
//
// An OBStandardView represents a single Openbravo tab. An OBStandardView
consists
// of three parts:
-// 1) a grid an instance of an OBViewGrid
-// 2) a form an instance of an OBViewForm
-// 3) a tab set with child OBStandardView instances
+// 1) a grid an instance of an OBViewGrid (property: viewGrid)
+// 2) a form an instance of an OBViewForm (property: viewForm)
+// 3) a tab set with child OBStandardView instances (property: childTabSet)
//
// In addition an OBStandardView has components for a message bar and other
visualization.
+//
+// A standard view can be opened as a result of a direct link from another
window/tab. See
+// the description in ob-standard-window for the flow in that case.
//
isc.ClassFactory.defineClass('OBStandardView', isc.VLayout);
@@ -149,6 +152,8 @@
// initially set to true, is set to false after the
// first time default edit mode is opened or a new parent
// is selected.
+ // note that opening the edit view is done in the viewGrid.dataArrived
+ // method
allowDefaultEditMode: true,
readOnly: false,
@@ -798,38 +803,9 @@
this.editRecord(newRecord);
},
- // check if a child tab should be opened directly
- openDirectChildTab: function(){
- if (this.childTabSet) {
- var i, tabs = this.childTabSet.tabs;
- for (i = 0; i < tabs.length; i++) {
- if (tabs[i].pane.openDirectTab()) {
- return;
- }
- }
- }
-
- // no child tabs to open anymore, show ourselves as the default view
- // open this view
- if (this.parentTabSet) {
- this.parentTabSet.setState(isc.OBStandardView.STATE_MID);
- } else {
- this.doHandleClick();
- }
- this.setMaximizeRestoreButtonState();
-
- // show the form with the selected record
- if (!this.isShowingForm) {
- var gridRecord = this.viewGrid.getSelectedRecord();
- if (gridRecord) {
- this.editRecord(gridRecord);
- }
- }
-
- // remove this info
- delete this.standardWindow.directTabInfo;
- },
-
+ // is part of the flow to open all correct tabs when a user goes directly
+ // to a specific tab and record, for example by clicking a link in another
+ // window, see the description in ob-standard-window.js
openDirectTab: function(){
if (!this.dataSource) {
// wait for the datasource to arrive
@@ -864,6 +840,40 @@
return false;
},
+ // is part of the flow to open all correct tabs when a user goes directly
+ // to a specific tab and record, for example by clicking a link in another
+ // window, see the description in ob-standard-window.js
+ openDirectChildTab: function(){
+ if (this.childTabSet) {
+ var i, tabs = this.childTabSet.tabs;
+ for (i = 0; i < tabs.length; i++) {
+ if (tabs[i].pane.openDirectTab()) {
+ return;
+ }
+ }
+ }
+
+ // no child tabs to open anymore, show ourselves as the default view
+ // open this view
+ if (this.parentTabSet) {
+ this.parentTabSet.setState(isc.OBStandardView.STATE_MID);
+ } else {
+ this.doHandleClick();
+ }
+ this.setMaximizeRestoreButtonState();
+
+ // show the form with the selected record
+ if (!this.isShowingForm) {
+ var gridRecord = this.viewGrid.getSelectedRecord();
+ if (gridRecord) {
+ this.editRecord(gridRecord);
+ }
+ }
+
+ // remove this info
+ delete this.standardWindow.directTabInfo;
+ },
+
// ** {{{ recordSelected }}} **
// Is called when a record get's selected. Will refresh direct child views
// which will again refresh their children.
diff -r 8f802cc2e06e -r 2463349571b0
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
Sat Jan 15 09:00:19 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
Sat Jan 15 09:15:54 2011 +0100
@@ -22,8 +22,25 @@
//
// Represents the root container for an Openbravo window consisting of a
// hierarchy of tabs. Each tab is represented with an instance of the
-// OBStandardView.
+// OBStandardView.
//
+// The standard window can be opened as a result of a click on a link
+// in another tab. In this case the window should open all tabs from the
+// root to the target record, i.e. the target record can be in a grand-child
+// tab. The flow goes through the following steps:
+// 1- compute which tabs should be opened and on each tab which record (the
tabInfo list),
+// this is done in the draw method with a call to the
org.openbravo.client.application.window.ComputeSelectedRecordActionHandler
+// actionHandler
+// 2- this actionhandler returns a list of tab and record id's which should be
opened in sequence.
+// 3- the first tab is opened by calling view.openDirectTab()
+// 4- this loads the data in the grid, in the viewGrid.dataArrived method the
+// method delayedHandleTargetRecord is called to open a child tab or the
direct requested record.
+// 5- opening a child tab is done by calling openDirectChildTab on the view,
which again calls openDirectTab
+// for the tab in the tabInfo list (computed in step 1)
+//
+// Note that some parts of the flow are done asynchronously to give the system
time to
+// draw all the components.
+//
isc.OBStandardWindow.addProperties({
toolBarLayout: null,
view: null,
diff -r 8f802cc2e06e -r 2463349571b0
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Sat Jan 15 09:00:19 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Sat Jan 15 09:15:54 2011 +0100
@@ -280,17 +280,28 @@
this.filterData(this.getCriteria(), callback, context);
},
+ // the dataarrived method is where different actions are done after
+ // data has arrived in the grid:
+ // - open the edit view if default edit mode is enabled
+ // - if the user goes directly to a tab (from a link in another window) then
+ // opening the relevant record is done here or if no record is passed grid
+ // mode is opened
+ // - if there is only one record then select it directly
dataArrived: function(startRow, endRow){
var record, ret = this.Super('dataArrived', arguments);
this.updateRowCountDisplay();
this.updateSelectedCountDisplay();
if (this.targetOpenGrid) {
+ // direct link from other window but without a record id
+ // so just show grid mode
// don't need to do anything here
delete this.targetOpenGrid;
} else if (this.targetRecordId) {
+ // direct link from other tab to a specific record
this.delayedHandleTargetRecord(startRow, endRow);
} else if (this.view.shouldOpenDefaultEditMode()) {
+ // ui-pattern: single record/edit mode
this.view.openDefaultEditView(this.getRecord(startRow));
} else if (this.data && this.data.getLength() === 1) {
// one record select it directly
@@ -340,8 +351,8 @@
target: this.view
});
} else {
- // wait a bit longer
- this.delayCall('delayedHandleTargetRecord', [startRow, endRow], 500,
this);
+ // wait a bit longer til the body is drawn
+ this.delayCall('delayedHandleTargetRecord', [startRow, endRow], 200,
this);
}
},
------------------------------------------------------------------------------
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