details:   /erp/devel/pi/rev/98255560b9a9
changeset: 10372:98255560b9a9
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Feb 04 06:58:27 2011 +0100
summary:   Streamlined setting of styling of dialog buttons

details:   /erp/devel/pi/rev/644c6fdd4719
changeset: 10373:644c6fdd4719
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Feb 04 06:59:13 2011 +0100
summary:   Linked item implementation

diffstat:

 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
                                                                                
  |   33 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
                                                             |    4 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
                                                                         |   20 
+-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
                                                       |  256 +++++-
 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-application-styles.js
 |   23 +-
 src/org/openbravo/erpCommon/utility/UsedByLink.java                            
                                                                                
     |  399 ++++++++-
 src/org/openbravo/erpCommon/utility/UsedByLink_data.xsql                       
                                                                                
     |   25 +-
 7 files changed, 629 insertions(+), 131 deletions(-)

diffs (truncated from 974 to 300 lines):

diff -r b00f7e6cd5e2 -r 644c6fdd4719 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
--- 
a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
        Fri Feb 04 06:08:11 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
        Fri Feb 04 06:59:13 2011 +0100
@@ -33,6 +33,39 @@
 <!--07272FCDEEA64054AF2F983D9814EE00-->  
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--07272FCDEEA64054AF2F983D9814EE00--></AD_MESSAGE>
 
+<!--090A37D22DDB1C89012DDB22CE910012--><AD_MESSAGE>
+<!--090A37D22DDB1C89012DDB22CE910012-->  
<AD_MESSAGE_ID><![CDATA[090A37D22DDB1C89012DDB22CE910012]]></AD_MESSAGE_ID>
+<!--090A37D22DDB1C89012DDB22CE910012-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--090A37D22DDB1C89012DDB22CE910012-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--090A37D22DDB1C89012DDB22CE910012-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--090A37D22DDB1C89012DDB22CE910012-->  
<VALUE><![CDATA[OBUIAPP_LinkedItemsListGridHeader]]></VALUE>
+<!--090A37D22DDB1C89012DDB22CE910012-->  <MSGTEXT><![CDATA[Linked Item 
Categories]]></MSGTEXT>
+<!--090A37D22DDB1C89012DDB22CE910012-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--090A37D22DDB1C89012DDB22CE910012-->  
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--090A37D22DDB1C89012DDB22CE910012--></AD_MESSAGE>
+
+<!--090A37D22DDB1C89012DDB23CDB80019--><AD_MESSAGE>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  
<AD_MESSAGE_ID><![CDATA[090A37D22DDB1C89012DDB23CDB80019]]></AD_MESSAGE_ID>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  
<VALUE><![CDATA[OBUIAPP_LinkedItemsEmptyMessage]]></VALUE>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  <MSGTEXT><![CDATA[No linked items, 
click on a category on the left to show the linked items for that 
category]]></MSGTEXT>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--090A37D22DDB1C89012DDB23CDB80019-->  
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--090A37D22DDB1C89012DDB23CDB80019--></AD_MESSAGE>
+
+<!--090A37D22DDB1C89012DDB2430980020--><AD_MESSAGE>
+<!--090A37D22DDB1C89012DDB2430980020-->  
<AD_MESSAGE_ID><![CDATA[090A37D22DDB1C89012DDB2430980020]]></AD_MESSAGE_ID>
+<!--090A37D22DDB1C89012DDB2430980020-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--090A37D22DDB1C89012DDB2430980020-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--090A37D22DDB1C89012DDB2430980020-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--090A37D22DDB1C89012DDB2430980020-->  
<VALUE><![CDATA[OBUIAPP_LinkedItemsCategoryListGridHeader]]></VALUE>
+<!--090A37D22DDB1C89012DDB2430980020-->  <MSGTEXT><![CDATA[Linked 
Items]]></MSGTEXT>
+<!--090A37D22DDB1C89012DDB2430980020-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--090A37D22DDB1C89012DDB2430980020-->  
<AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--090A37D22DDB1C89012DDB2430980020--></AD_MESSAGE>
+
 <!--0EAD499E981341CABE550FE951B274F7--><AD_MESSAGE>
 <!--0EAD499E981341CABE550FE951B274F7-->  
<AD_MESSAGE_ID><![CDATA[0EAD499E981341CABE550FE951B274F7]]></AD_MESSAGE_ID>
 <!--0EAD499E981341CABE550FE951B274F7-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r b00f7e6cd5e2 -r 644c6fdd4719 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Fri Feb 04 06:08:11 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Fri Feb 04 06:59:13 2011 +0100
@@ -297,7 +297,9 @@
 isc.ClassFactory.defineClass('OBFormButton', Button);
 
 isc.OBFormButton.addProperties({
-  autoFit: true
+  autoFit: true,
+  baseStyle: 'OBFormButton',
+  titleStyle: 'OBFormButtonTitle'
 });
 
 // == OBTextItem ==
diff -r b00f7e6cd5e2 -r 644c6fdd4719 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
       Fri Feb 04 06:08:11 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
       Fri Feb 04 06:59:13 2011 +0100
@@ -77,16 +77,18 @@
     var i, thisGrid = this, field, formatCellValueFunction = function(value, 
record, rowNum, colNum, grid){
       return '';
     };
-    
-    for (i = 0; i < this.fields.length; i++) {
-      field = this.fields[i];
-      if (field.isLink) {
-        // store the originalFormatCellValue if not already set
-        if (field.formatCellValue && !field.formatCellValueFunctionReplaced) {
-          field.originalFormatCellValue = field.formatCellValue;
+
+    if (this.fields) {
+      for (i = 0; i < this.fields.length; i++) {
+        field = this.fields[i];
+        if (field.isLink) {
+          // store the originalFormatCellValue if not already set
+          if (field.formatCellValue && !field.formatCellValueFunctionReplaced) 
{
+            field.originalFormatCellValue = field.formatCellValue;
+          }
+          field.formatCellValueFunctionReplaced = true;
+          field.formatCellValue = formatCellValueFunction;
         }
-        field.formatCellValueFunctionReplaced = true;
-        field.formatCellValue = formatCellValueFunction;
       }
     }
     
diff -r b00f7e6cd5e2 -r 644c6fdd4719 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
     Fri Feb 04 06:08:11 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
     Fri Feb 04 06:59:13 2011 +0100
@@ -24,13 +24,13 @@
 isc.ClassFactory.defineClass('OBLinkedItemSectionItem', isc.OBSectionItem);
 
 isc.OBLinkedItemSectionItem.addProperties({
-  // as the name is always the same there should be at most 
+  // as the name is always the same there should be at most
   // one linked item section per form
   name: '_linkedItems_',
   
   // note: setting these apparently completely hides the section
-  //width: '100%',
-  //height: '100%',
+  // width: '100%',
+  // height: '100%',
   
   overflow: 'hidden',
   
@@ -80,7 +80,7 @@
     this.getLinkedItemPart().setExpanded(true);
     return ret;
   },
-    
+  
   hide: function(){
     this.collapseSection();
     return this.Super('hide', arguments);
@@ -94,29 +94,227 @@
   // set to true when the content has been created at first expand
   isInitialized: false,
   
+  layoutMargin: 5,
+  
   // setting width/height makes the canvasitem to be hidden after a few
   // clicks on the section item, so don't do that for now
-//  width: '100%',
-//  height: '100%',
+  // width: '100%',
+  // height: '100%',
   
+  
+  /** 
+   * Loads categories to the categories grid
+   **/
+  loadCategories: function(){
+    var windowId = this.getForm().view.standardWindow.windowId;
+    var entityName = this.getForm().view.entity;
+    var actionURL = OB.Application.contextUrl + 'utility/UsedByLink.html';
+    
+    var that = this;
+    
+    var callback = function(response, data, request){
+      var msg = data.msg;
+      var usedByLinkData = data.usedByLinkData;
+      if (msg !== null) {
+        that.messageLabel.setContents(msg);
+      }
+      
+      if (usedByLinkData === null) {
+        usedByLinkData = [];
+      }
+      
+      that.linkedItemCategoryDS.setCacheData(usedByLinkData, true);
+      that.linkedItemCategoryListGrid.invalidateCache();
+      that.linkedItemCategoryListGrid.filterData();
+    };
+    
+    var reqObj = {
+      params: {
+        Command: 'JSONCategory',
+        windowId: windowId,
+        entityName: entityName
+      },
+      callback: callback,
+      evalResult: true,
+      httpMethod: 'POST',
+      useSimpleHttp: true,
+      actionURL: actionURL
+    };
+    
+    isc.RPCManager.sendRequest(reqObj);
+  },
+  
+  /** 
+   * Loads linked items of a chosen category to linkedItemListGrid
+   * */
+  loadLinkedItems: function(record){
+  
+    var windowId = this.getForm().view.standardWindow.windowId;
+    var entityName = this.getForm().view.entity;
+    var actionURL = OB.Application.contextUrl + 'utility/UsedByLink.html';
+    
+    var that = this;
+    /* loads linked items to the child grid */
+    var callback = function(response, data, request){
+      var msg = data.msg;
+      var usedByLinkData = data.usedByLinkData;
+      if (msg !== null) {
+        that.messageLabel.setContents(msg);
+      }
+      
+      if (usedByLinkData === null) {
+        usedByLinkData = [];
+      }
+      that.linkedItemListGrid.invalidateCache();
+      that.linkedItemDS.setCacheData(usedByLinkData, true);
+      that.linkedItemListGrid.filterData();
+    };
+    var reqObj = {
+      params: {
+        Command: 'JSONLinkedItem',
+        windowId: windowId,
+        entityName: entityName,
+        adTabId: record.adTabId,
+        tableName: record.tableName,
+        columnName: record.columnName
+      },
+      callback: callback,
+      evalResult: true,
+      httpMethod: 'POST',
+      useSimpleHttp: true,
+      actionURL: actionURL
+    };
+    isc.RPCManager.sendRequest(reqObj);
+    
+  },
+  
+  /**
+   * Opens linked item in a new window
+   */
+  openLinkedItemInNewWindow: function(record){
+  
+    var windowId = record.adWindowId;
+    var entityName = record.tableName;
+    var recordId = record.id;
+    var tabId = record.adTabId;
+    var tabTitle = record.adMenuName;
+    
+    var openObject = {
+      viewId: '_' + windowId,
+      targetEntity: entityName,
+      targetRecordId: recordId,
+      targetTabId: tabId,
+      tabTitle: tabTitle,
+      windowId: windowId
+    };
+    
+    OB.Layout.ViewManager.openView(openObject.viewId, openObject);
+  },
+  
+  /**
+   * Cleans linked items grid when the filter is used.
+   **/
+  cleanLinkedItemsListGrid: function(){
+    this.linkedItemListGrid.invalidateCache();
+    this.linkedItemDS.setCacheData([], true);
+    this.linkedItemListGrid.filterData();
+    this.linkedItemCategoryListGrid.deselectAllRecords();
+  },
+  
+  /** 
+   * Initializes the widget
+   **/
   initWidget: function(){
     var ret = this.Super('initWidget', arguments);
     
-    // just for demo purposes have some content
-    // Valery: instead of the label the grid component showing linked 
-    // items should be created, note that the linked items should not 
-    // be read until the expand actually takes place (see below)
-    this.label = isc.Label.create({
-      canFocus: true,
+    // the list of linked items
+    this.linkedItemDS = isc.DataSource.create({
+      fields: [{
+        name: "name",
+        title: OB.I18N.getLabel('OBUIAPP_LinkedItemsListGridHeader'),
+        type: 'text',
+        filterEditorType: 'OBTextItem'
+      }],
+      clientOnly: true
+    });
+    this.linkedItemListGrid = isc.OBGrid.create({
+      width: '50%',
+      height: 300,
+      dataSource: this.linkedItemDS,
+      autoFetchData: true,
+      showFilterEditor: true,
+      selectionType: 'single',
+      filterOnKeypress: true,
+      emptyMessage: OB.I18N.getLabel('OBUIAPP_LinkedItemsEmptyMessage'),
+      layout: this,
+      recordClick: 'this.layout.openLinkedItemInNewWindow(record)',
+      fetchData: function(criteria, callback, requestProperties){
+        this.checkShowFilterFunnelIcon(criteria);
+        return this.Super('fetchData', arguments);
+      },
+      filterData: function(criteria, callback, requestProperties){
+        this.checkShowFilterFunnelIcon(criteria);
+        return this.Super('filterData', arguments);
+      }
+    });
+    
+    
+    // the list of linked item categories
+    this.linkedItemCategoryDS = isc.DataSource.create({
+      fields: [{
+        name: 'fullElementName',
+        title: OB.I18N.getLabel('OBUIAPP_LinkedItemsCategoryListGridHeader'),
+        type: 'text',

------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to