details:   /erp/devel/pi/rev/08ac8573c622
changeset: 9962:08ac8573c622
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Jan 20 07:26:35 2011 +0100
summary:   Compute parent property in the correct way, business partner window 
now shows up correctly

details:   /erp/devel/pi/rev/d5ef43d872f4
changeset: 9963:d5ef43d872f4
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu Jan 20 07:26:50 2011 +0100
summary:   Added some comments

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
  |  26 +++++++--
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
 |   2 +
 2 files changed, 22 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 1d4b64743d14 -r d5ef43d872f4 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
       Thu Jan 20 07:09:52 2011 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
       Thu Jan 20 07:26:50 2011 +0100
@@ -57,6 +57,7 @@
   private String tabTitle;
   private List<OBViewTab> childTabs = new ArrayList<OBViewTab>();
   private OBViewTab parentTabComponent;
+  private String parentProperty = null;
   private List<ButtonField> buttonFields = null;
 
   protected Template getComponentTemplate() {
@@ -94,18 +95,31 @@
     if (parentTabComponent == null) {
       return "";
     }
+    if (parentProperty != null) {
+      return parentProperty;
+    }
+    parentProperty = "";
     final Entity thisEntity = 
ModelProvider.getInstance().getEntity(tab.getTable().getName());
     final Entity parentEntity = ModelProvider.getInstance().getEntity(
         parentTabComponent.getTab().getTable().getName());
-    for (Property property : thisEntity.getProperties()) {
-      if (property.isPrimitive() || property.isOneToMany()) {
-        continue;
+    if (tab.getColumn() != null) {
+      final String columnId = (String) DalUtil.getId(tab.getColumn());
+      for (Property property : thisEntity.getProperties()) {
+        if (property.getColumnId() != null && 
property.getColumnId().equals(columnId)) {
+          parentProperty = property.getName();
+        }
       }
-      if (property.getTargetEntity() == parentEntity) {
-        return property.getName();
+    } else {
+      for (Property property : thisEntity.getProperties()) {
+        if (property.isPrimitive() || property.isOneToMany()) {
+          continue;
+        }
+        if (property.getTargetEntity() == parentEntity) {
+          parentProperty = property.getName();
+        }
       }
     }
-    return "";
+    return parentProperty;
   }
 
   public String getViewForm() {
diff -r 1d4b64743d14 -r d5ef43d872f4 
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
      Thu Jan 20 07:09:52 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Thu Jan 20 07:26:50 2011 +0100
@@ -225,6 +225,8 @@
     // - to set/reset the progress icons
     // - to handle error cases in the response
     // - to add info to the request
+    // wrapping is done by creating a new datasource class
+    // which is instantiated
     var obDsClassname = 'OBDataSource' + this.tabId;
     isc.defineClass(obDsClassname, ds.getClass());
     

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