details:   /erp/devel/pi/rev/e87bcc4cd174
changeset: 9745:e87bcc4cd174
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Wed Jan 12 16:29:16 2011 +0100
summary:   [OBCQL] Fix columnname of RowsNumber parameter.

details:   /erp/devel/pi/rev/b13641344c05
changeset: 9746:b13641344c05
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Wed Jan 12 19:17:20 2011 +0100
summary:   [OBCQL] Visualization improvements to include the total number of 
rows.

diffstat:

 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MESSAGE.xml
                                                                               
|  11 +
 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
                                                                        |   2 +-
 
modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
                                                            |  77 +++++++++-
 
modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.css
 |   8 +
 
modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.js
  |  13 +
 5 files changed, 103 insertions(+), 8 deletions(-)

diffs (215 lines):

diff -r 77daf15b7209 -r b13641344c05 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MESSAGE.xml
--- 
a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MESSAGE.xml
  Wed Jan 12 19:18:06 2011 +0100
+++ 
b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MESSAGE.xml
  Wed Jan 12 19:17:20 2011 +0100
@@ -1,5 +1,16 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <data>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1--><AD_MESSAGE>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  
<AD_MESSAGE_ID><![CDATA[18EE399F2AF54EA3BEB5086D4BF6D4B1]]></AD_MESSAGE_ID>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  
<VALUE><![CDATA[OBCQL_RowsNumber]]></VALUE>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  <MSGTEXT><![CDATA[Showing %0 of %1 
rows.]]></MSGTEXT>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  
<AD_MODULE_ID><![CDATA[0A060B2AF1974E8EAA8DB61388E9AECC]]></AD_MODULE_ID>
+<!--18EE399F2AF54EA3BEB5086D4BF6D4B1--></AD_MESSAGE>
+
 <!--51E3AB93D32F488E896F1E03654B89F3--><AD_MESSAGE>
 <!--51E3AB93D32F488E896F1E03654B89F3-->  
<AD_MESSAGE_ID><![CDATA[51E3AB93D32F488E896F1E03654B89F3]]></AD_MESSAGE_ID>
 <!--51E3AB93D32F488E896F1E03654B89F3-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r 77daf15b7209 -r b13641344c05 
modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
--- 
a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
   Wed Jan 12 19:18:06 2011 +0100
+++ 
b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
   Wed Jan 12 19:17:20 2011 +0100
@@ -66,7 +66,7 @@
 <!--2961D075BBA04BC09FF763BA94B5D0C6-->  <NAME><![CDATA[Number of 
Rows]]></NAME>
 <!--2961D075BBA04BC09FF763BA94B5D0C6-->  <SEQNO><![CDATA[0]]></SEQNO>
 <!--2961D075BBA04BC09FF763BA94B5D0C6-->  
<AD_REFERENCE_ID><![CDATA[11]]></AD_REFERENCE_ID>
-<!--2961D075BBA04BC09FF763BA94B5D0C6-->  
<COLUMNNAME><![CDATA[rowsNumber]]></COLUMNNAME>
+<!--2961D075BBA04BC09FF763BA94B5D0C6-->  
<COLUMNNAME><![CDATA[RowsNumber]]></COLUMNNAME>
 <!--2961D075BBA04BC09FF763BA94B5D0C6-->  
<ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--2961D075BBA04BC09FF763BA94B5D0C6-->  
<FIELDLENGTH><![CDATA[10]]></FIELDLENGTH>
 <!--2961D075BBA04BC09FF763BA94B5D0C6-->  
<ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
diff -r 77daf15b7209 -r b13641344c05 
modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
--- 
a/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
       Wed Jan 12 19:18:06 2011 +0100
+++ 
b/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
       Wed Jan 12 19:17:20 2011 +0100
@@ -30,6 +30,8 @@
   grid: null,
   gridProperties: {},
   viewMode: 'widget',
+  totalRows: null,
+  widgetTitle: null,
 
   showAllLabel: null,
   OBQueryListShowAllLabelHeight: null,
@@ -38,9 +40,12 @@
     this.showAllLabel = isc.HLayout.create({
       height: this.OBQueryListShowAllLabelHeight,
       members: [
-        isc.HLayout.create({
-          width: '100%'
+        isc.OBQueryListRowsNumberLabel.create({
+          contents: ''
         }),
+//        isc.HLayout.create({
+//          width: '100%'
+//        }),
         isc.OBQueryListShowAllLabel.create({
           contents: OB.I18N.getLabel('OBCQL_ShowAll'),
           widget: this,
@@ -49,6 +54,7 @@
     ]
     });
     this.Super('initWidget', arguments);
+    this.widgetTitle = this.title;
     // refresh if the dbInstanceId is set
     if (this.dbInstanceId) {
       this.refresh();
@@ -69,7 +75,8 @@
                   this.grid.summaryRowHeight + 2;
     this.grid.setHeight(newGridHeight);
 
-    var newHeight = headerHeight + newGridHeight + 13 +  
this.showAllLabel.height;
+    var newHeight = headerHeight + newGridHeight + 13;
+    if (this.showAllLabel.isVisible()) { newHeight += 
this.showAllLabel.height; }
     this.setHeight(newHeight);
     if (this.parentElement) {
       var heightDiff = newHeight - currentHeight,
@@ -130,7 +137,7 @@
   
   maximize: function() {
     OB.Layout.ViewManager.openView('OBQueryListView',  {
-      tabTitle: this.title,
+      tabTitle: this.widgetTitle,
       widgetInstanceId: this.dbInstanceId,
       widgetId: this.widgetId,
       fields: this.maximizedFields,
@@ -139,8 +146,25 @@
       menuItems: this.menuItems,
       fieldDefinitions: this.fieldDefinitions
     });
+  },
+  
+  setTotalRows: function(totalRows) {
+    this.totalRows = totalRows;
+    if (this.viewMode === 'maximized') {
+      this.setTitle(this.widgetTitle + " (" + this.totalRows + ")");
+    }
+    this.showAllLabel.getMembers()[0].setContents(
+        OB.I18N.getLabel('OBCQL_RowsNumber', [this.parameters.RowsNumber, 
this.totalRows])
+      );
+    if (this.parameters.showAll || this.totalRows <= 
this.parameters.RowsNumber) {
+      this.showAllLabel.hide();
+    } else {
+      this.showAllLabel.show();
+    }
+    if (this.viewMode === 'widget') {
+      this.setWidgetHeight();
+    }
   }
-  
 });
 
 isc.ClassFactory.defineClass('OBQueryListGrid', isc.OBGrid);
@@ -177,7 +201,18 @@
     crit.rowsNumber = this.widget.parameters.RowsNumber;
     crit.viewMode = this.widget.viewMode;
     crit.showAll = this.widget.parameters.showAll;
-    return this.Super('filterData', [crit, callback, reqProperties]);
+
+    reqProperties.clientContext = {grid: this,
+        criteria: crit}; 
+
+    var newCallBack = function(dsResponse, data, dsRequest){
+      dsResponse.clientContext.grid.getWidgetTotalRows(dsResponse, data, 
dsRequest);
+      if (callback) {
+        callback();
+      }
+    };
+
+    return this.Super('filterData', [crit, newCallBack, reqProperties]);
   },
   
   fetchData: function(criteria, callback, requestProperties){
@@ -189,7 +224,18 @@
     crit.rowsNumber = this.widget.parameters.RowsNumber;
     crit.viewMode = this.widget.viewMode;
     crit.showAll = this.widget.parameters.showAll;
-    return this.Super('fetchData', [crit, callback, reqProperties]);
+
+    reqProperties.clientContext = {grid: this,
+                                   criteria: crit}; 
+
+    var newCallBack = function(dsResponse, data, dsRequest){
+      dsResponse.clientContext.grid.getWidgetTotalRows(dsResponse, data, 
dsRequest);
+      if (callback) {
+        callback();
+      }
+    };
+
+    return this.Super('fetchData', [crit, newCallBack, reqProperties]);
   },
 
   cellClick: function (record, rowNum, colNum) {
@@ -207,5 +253,22 @@
         });
       }
     }
+  },
+
+  getWidgetTotalRows: function(dsResponse, data, dsRequest){
+    if (this.widget.viewMode === 'widget' && !this.widget.parameters.showAll) {
+      var criteria = dsResponse.clientContext.criteria || {},
+          requestProperties = {};
+      requestProperties.showPrompt = false;
+      requestProperties.clientContext = {grid: this};
+
+      criteria.showAll = true;
+      this.dataSource.fetchData(criteria, function(dsResponse, data, 
dsRequest){
+          
dsResponse.clientContext.grid.widget.setTotalRows(dsResponse.totalRows);
+        }, requestProperties );
+
+    } else {
+      this.widget.setTotalRows(dsResponse.totalRows);
+    }
   }
 });
diff -r 77daf15b7209 -r b13641344c05 
modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.css
--- 
a/modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.css
    Wed Jan 12 19:18:06 2011 +0100
+++ 
b/modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.css
    Wed Jan 12 19:17:20 2011 +0100
@@ -46,4 +46,12 @@
 .OBQueryListShowAllLabelFocusedDown {
   color: #004E27;
   text-decoration: underline;
+}
+
+.OBQueryListRowsNumberLabel {
+  font-family: 'lucida sans', sans-serif;
+  vertical-align: middle;
+  background: transparent;
+  text-align: left;
+  color: #00A651;
 }
\ No newline at end of file
diff -r 77daf15b7209 -r b13641344c05 
modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.js
--- 
a/modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.js
     Wed Jan 12 19:18:06 2011 +0100
+++ 
b/modules/org.openbravo.client.querylist/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.querylist/ob-querylist-styles.js
     Wed Jan 12 19:17:20 2011 +0100
@@ -34,4 +34,17 @@
   height: 20,
   wrap: false,
   width: '*'
+});
+
+isc.ClassFactory.defineClass('OBQueryListRowsNumberLabel', isc.Label);
+
+isc.OBQueryListRowsNumberLabel.addProperties({
+  className: 'OBQueryListRowsNumberLabel',
+  showDown: false,
+  showFocused: false,
+  showFocusedAsOver: false,
+  showRollOver: false,
+  height: 20,
+  wrap: false,
+  width: '*'
 });
\ No newline at end of file

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