[HepData-svn] r1563 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Aug 7 14:12:06 BST 2012


Author: whalley
Date: Tue Aug  7 14:12:06 2012
New Revision: 1563

Log:
fix for none displaying records due to lost qualifiers in the older record, plus some small changes.

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Thu Jul 26 11:45:07 2012	(r1562)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Tue Aug  7 14:12:06 2012	(r1563)
@@ -43,32 +43,32 @@
     void renderMessage(MarkupWriter writer) {
 
         String dsid = "datacell"+_dataset.getId().toString();
-        // Output the table comment(CT) and location(TFP)
+        // Output the table comment(CT) omitting the location(TFP)
         writer.element("p");
         writer.attributes("class", "datasetcomments");
         boolean verbatim = false;
         for (String comment : _dataset.getComments()) {
-            if(comment.startsWith("VERBATIM")){verbatim = true;}
-            int ls=comment.length();
-            while (ls>0){
-                int iend = ls;
-                int ihash = comment.indexOf("#");
-                if(ihash>0) { iend = ihash; }
-//                writer.element("br"); writer.end();
-//                writer.write(comment.substring(0,iend));
-                if(iend<ls){ 
-                     comment=comment.substring(ihash+1);
-                     ls=comment.length();
-                } else {
-                    ls=0;
+            if(!comment.startsWith("Location")){
+                if(comment.startsWith("VERBATIM")){verbatim = true;}
+                int ls=comment.length();
+                while (ls>0){
+                    int iend = ls;
+                    int ihash = comment.indexOf("#");
+                    if(ihash>0) { iend = ihash; }
+//                    writer.element("br"); writer.end();
+//                    writer.write(comment.substring(0,iend));
+                    if(iend<ls){ 
+                        comment=comment.substring(ihash+1);
+                        ls=comment.length();
+                    } else {
+                        ls=0;
+                    }
                 }
             }
-
         }
 
        // now try to deal with additional dataset errors...
         for (DatasetError de : _dataset.getErrors()){
-            writer.element("br");writer.end();
             writer.write("Additional systematic error: ");
             if(de.getPlus() != 0.0 || de.getPlus() != 0.0) {
                 if(de.getPlus().equals(de.getMinus())){
@@ -80,6 +80,7 @@
                 writer.write(de.getNormType().toSymbol()+ " ");
             }
             writer.write("(" +de.getComment() + ")");
+            writer.element("br");writer.end();
         }
         String lasterror = "";
         int ycount = 0;
@@ -217,7 +218,7 @@
 // first check is same across row
                 Boolean same = true;
                 for (int nmy=0; nmy<ny-1; nmy++){ 
-             
+                  
                     if(store[nmy][i] != null && store[nmy+1][i] != null){                 
                         if(!store[nmy][i].equals(store[nmy+1][i])){ 
                             same = false; 
@@ -226,6 +227,7 @@
                         same = false;
                     }  
                 }
+                
                 if(same) {
                     writer.element("th");
                     writer.attributes("colspan",ny);
@@ -238,20 +240,21 @@
                     for (int nmy=0; nmy<ny; nmy++){
                         writer.element("th");
                         writer.attributes("class","multiple qualifier_class");
-                        if(nmy>0){ writer.write( store[nmy][i].substring(ii+1)); }
-                        else { writer.write( store[nmy][i]); }
-                        writer.end();
+                        if(store[nmy][i] != null) {
+                            if(nmy>0){ writer.write( store[nmy][i].substring(ii+1)); }
+                            else { writer.write( store[nmy][i]); }
+                        }
+                        `writer.end();
                     }
                 }
                 writer.end();  //tr    
             }
         }
-
         // Headers
         writer.element("tr");
         writer.attributes("class", "xyheaders");
 
-        // X headers
+      // X headers
         for (XAxis x : _dataset.getXAxes()) {
             writer.element("th");
             writer.attributes("class", "xheader qualifier_class");


More information about the HepData-svn mailing list