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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Nov 24 15:28:47 GMT 2011


Author: whalley
Date: Thu Nov 24 15:28:47 2011
New Revision: 1488

Log:
several small twesk for non displaying records

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	Tue Nov 15 14:11:24 2011	(r1487)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Thu Nov 24 15:28:47 2011	(r1488)
@@ -90,8 +90,10 @@
         int ncomm = 0;
         int nprop = 0;
         if (_dataset.getYAxes().size() > 0) {
-            ncomm = _dataset.getYAxes().first().getComments().size();
-            nprop = _dataset.getYAxes().first().getProperties().size();
+            for(YAxis y : _dataset.getYAxes()){
+                if(y.getComments().size() > ncomm) {ncomm = y.getComments().size();}
+                if(y.getProperties().size() > nprop) {nprop = y.getProperties().size();}
+            } 
         }
         // Begin the actual data table...
         writer.element("table");
@@ -111,15 +113,23 @@
             List <String> storelist = new ArrayList();
             // first add the comment elements (strings)
             for (String comment : y.getComments()){
-                if(!comment.startsWith("RE") && comment.indexOf(" IN ") > 0){
+                if(!comment.startsWith("RE") && comment.indexOf(" IN ") > 0 && comment.indexOf(" : ") > 0){
                     int len = comment.length();
                     int ip1 = comment.indexOf(" IN ");
                     int ip2 = comment.indexOf(" : ");
-                    String comment2 = comment.substring(0,ip1);
-                    comment2 += comment.substring(ip2,len);
-                    comment2 += comment.substring(ip1+3,ip2).replace("EV","eV");
-                    comment = comment2;
-                }
+                    if(ip2 > ip1) { 
+                        String comment2 = comment.substring(0,ip1);
+                        comment2 += comment.substring(ip2,len);
+                        comment2 += comment.substring(ip1+3,ip2).replace("EV","eV");
+                        comment = comment2;
+                    }
+                    else{
+                        String comment2 = comment.substring(0,ip2);
+                        comment2 += comment.substring(ip1,len);
+                        comment2 += comment.substring(ip2+3,ip1).replace("EV","eV");
+                        comment = comment2;
+                     }
+               }
                 storelist.add(comment);
             }
             for (Property property : y.getProperties()) {
@@ -139,7 +149,7 @@
                         tempstr = tempstr.concat(property.getHighValue().toString());
                         if(property.getFocus() != null) { tempstr = tempstr.concat(")"); }
                     }
-                    if (!property.getUnit().isDimensionless()) {
+                    if (property.getUnit().toString().equals("") || !property.getUnit().isDimensionless()) {
                         tempstr = tempstr.concat(" ");
                         tempstr = tempstr.concat(property.getUnit().toString());
                     }
@@ -466,8 +476,8 @@
                                 } else {
                                     vale = new SignificantFigures(e.getPlus());
                                     if(e.getPlus()<0.0){ writer.write("");}
-                                    else if(e.getPlus() > e.getMinus()) { writer.write("+"); }
-                                    else                           { writer.write("+"); }
+                                    else if(e.getPlus() > e.getMinus()) { writer.write(" +"); }
+                                    else                           { writer.write(" +"); }
                                     if (e.getNormType() == ErrorNorm.PCT) { lsd = vale.getLSD(); }
                                     msd = vale.getMSD();
                                     if (msd <= 0) msd = 1;


More information about the HepData-svn mailing list