details:   /erp/devel/pi/rev/5ce9216c6cb9
changeset: 12089:5ce9216c6cb9
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed May 11 09:29:11 2011 +0200
summary:   fixed bug 17092: Sections that are collapsed disappear when you 
maximize the child tab

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
 |   9 ++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
              |  30 ++++++---
 2 files changed, 26 insertions(+), 13 deletions(-)

diffs (91 lines):

diff -r ed330c170908 -r 5ce9216c6cb9 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
     Tue May 10 22:51:56 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFormComponent.java
     Wed May 11 09:29:11 2011 +0200
@@ -59,8 +59,8 @@
   private static final long ONE_COLUMN_MAX_LENGTH = 60;
   private static final String TEXT_AD_REFERENCE_ID = "14";
 
-  // Audit fields
   private static final String AUDIT_GROUP_ID = "1000100001";
+  private static final String MORE_INFO_GROUP_ID = 
"402880E72F1C15A5012F1C7AA98B00E8";
 
   private Tab tab;
   private List<String> statusBarFields = null;
@@ -232,7 +232,6 @@
     // Add audit info
     if (!auditFields.isEmpty()) {
       final OBViewFieldGroup viewFieldGroup = new OBViewFieldGroup();
-      viewFieldGroup.setExpanded(false);
       viewFieldGroup.setType("OBAuditSectionItem");
       fields.add(viewFieldGroup);
       viewFieldGroup.setFieldGroup(OBDal.getInstance().get(FieldGroup.class, 
AUDIT_GROUP_ID));
@@ -735,6 +734,7 @@
   }
 
   public class OBViewFieldGroup extends DefaultVirtualField {
+
     private boolean expanded = true;
     private String type;
     private FieldGroup fieldGroup;
@@ -762,6 +762,11 @@
     }
 
     public void setFieldGroup(FieldGroup fieldGroup) {
+      if (AUDIT_GROUP_ID.equals(fieldGroup.getId())
+          || MORE_INFO_GROUP_ID.equals(fieldGroup.getId())) {
+        expanded = false;
+      }
+
       this.fieldGroup = fieldGroup;
     }
 
diff -r ed330c170908 -r 5ce9216c6cb9 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Tue May 10 22:51:56 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Wed May 11 09:29:11 2011 +0200
@@ -612,7 +612,16 @@
     for(i = 0; i < this.getItems().length; i++) {
       item = this.getItem(i);
       if(item && item.getClassName() === 'OBSectionItem') {
+             
         section = item;
+        
+        // Keep whether it was expanded and expand in case it was not. 
Collapsed
+        // sections keep all its fields as not visible, so they were hidden.
+        var wasExpanded = section.isExpanded();
+        if (!wasExpanded) {
+          section.expandSection();
+        }   
+        
         section.visible = false;
         for(j = 0; j < section.itemIds.length; j++) {
           item = this.getItem(section.itemIds[j]);
@@ -622,19 +631,18 @@
           }
         }
 
-        if(section.visible) {
-          // 'More Information' is collapsed by default
-          if (section.name === '402880E72F1C15A5012F1C7AA98B00E8') {
-            section.collapseSection();
+        if(!section.visible) {
+          for(j = 0; j < section.itemIds.length; j++) {
+            item = this.getItem(section.itemIds[j]);
+            if(item) {
+              item.alwaysTakeSpace = false;
+            }
           }
-          continue;
         }
-
-        for(j = 0; j < section.itemIds.length; j++) {
-          item = this.getItem(section.itemIds[j]);
-          if(item) {
-            item.alwaysTakeSpace = false;
-          }
+        
+        // Restore previous expand mode
+        if (!wasExpanded) {
+          section.collapseSection();
         }
       }
     }

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to