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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue May 4 15:48:42 BST 2010


Author: whalley
Date: Tue May  4 15:51:27 2010
New Revision: 1348

Log:
incorporating yaxis comments in with properties before sorting to get order correct

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	Sun May  2 11:24:34 2010	(r1347)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Tue May  4 15:51:27 2010	(r1348)
@@ -38,7 +38,7 @@
             writer.element("br"); writer.end();
             writer.write(comment);
         }
-        writer.end(); //p
+        writer.end(); //p 
 
         // Determine the number of axes and points in the dataset
         final int nx = _dataset.getXAxes().size(); // number of xaxes in the dataset
@@ -57,62 +57,21 @@
         writer.element("table");
         writer.attributes("class", "dataset");
 
-        // y-axis comments (i.e. non-numerical properties
+       // y-axis comments (i.e. non-numerical properties
+       // new version has these added in with the properties - below
         int nmatch = 0;
-        for (int i = 1; i < ncomm + 1; ++i) {
-            writer.element("tr");
-            writer.attributes("class", "axiscomments");
-
-            writer.element("th");
-            writer.attributes("colspan", nx);
-            writer.writeRaw("&nbsp;");
-            writer.end();
-
-            // Attempt to combine y-axis comments if they're all the same
-            String ycomm = "";
-            nmatch = 1;
-            for (YAxis y : _dataset.getYAxes()) {
-                int j = 0;
-                for (String comment : y.getComments()) {
-                    j++;
-                    if (j == i) {
-                        if (comment.equals(ycomm)) nmatch += 1;
-                        ycomm = comment;
-//                        System.out.println("setting ycomm " + ycomm);
-                    }
-                }
-            }
-            if (nmatch == ny) {
-                writer.element("th");
-                writer.attributes("class", "multiple");
-                writer.attributes("colspan", ny);
-                writer.write(ycomm);
-                writer.end();
-            } else {
-                for (YAxis y : _dataset.getYAxes()) {
-                    int j = 0;
-                    for (String comment : y.getComments()) {
-                        j++;
-                        if (j == i) {
-                            writer.element("th");
-                            writer.write(comment);
-                            writer.end();
-                        }
-                    }
-                }
-            }
-            writer.end(); //tr
-        }
 
         // Next the numerical properties new version
 
-        String[][] store = new String[ny][nprop];
+        String[][] store = new String[ny][nprop+ncomm];
         
         int numy = -1;
         for(YAxis y : _dataset.getYAxes()) {
             numy++;
             int j=-1;
             List <String> storelist = new ArrayList();
+            // first add the comment elements (strings)
+            for (String comment : y.getComments()){storelist.add(comment);}
             for (Property property : y.getProperties()) {
                 j++;
                 String tempstr = property.getName().toString();
@@ -145,7 +104,7 @@
             }
         }
 
-        for (int i=0; i<nprop; i++){
+        for (int i=0; i<nprop+ncomm; i++){
             if(store[0][i] != null){
                 writer.element("tr");
                 writer.element("td");
@@ -156,8 +115,7 @@
 // this is the actual output
 // first check is same across row
                 Boolean same = true;
-//                for (int nmy=0; nmy<ny-1; nmy++){ if(!store[nmy][i].equals(store[nmy+1][i])){ same = false; } }
-                same = false;
+                for (int nmy=0; nmy<ny-1; nmy++){ if(!store[nmy][i].equals(store[nmy+1][i])){ same = false; } }
                 if(same) {
                     writer.element("th");
                     writer.attributes("colspan",ny);
@@ -339,7 +297,6 @@
                         }
                         int msd = val.getMSD();
                         if (msd <= 0) msd = 1;
-                        System.out.println(pt2.getValue() + " " + msd + " " + lsd); 
                         writer.write(Formats.forms(pt2.getValue(), msd, -lsd));
                         if (pt2.getRelation() == Relation.EQUALS) {
                             for (PointError e : pt2.getErrors()) {


More information about the HepData-svn mailing list