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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Oct 20 10:28:59 BST 2010


Author: whalley
Date: Wed Oct 20 10:28:59 2010
New Revision: 1416

Log:
tweaking x value display

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 Oct 19 20:26:40 2010	(r1415)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Wed Oct 20 10:28:59 2010	(r1416)
@@ -236,24 +236,54 @@
                                     SignificantFigures valx = new SignificantFigures(f);
                                     lsd = valx.getLSD();
                                     msd = valx.getMSD();
-                                   if(msd == 0) msd = 1;
-                                }
-                                if(b.getFocus().toString().indexOf("9999999") > 0) {
-                                   int pos1 =  b.getFocus().toString().indexOf("999999");
-                                   int pos2 =  b.getFocus().toString().indexOf(".");
-                                   lsd = pos2-pos1+1;
-                                }
-                                else if(b.getFocus().toString().indexOf("0000000") > 0) {
-                                   int pos1 =  b.getFocus().toString().indexOf("0000000");
-                                   int pos2 =  b.getFocus().toString().indexOf(".");
-                                   lsd = pos2-pos1+1;
+                                    if(msd == 0) msd = 1;
+                                    if(f.toString().indexOf("9999999") > 0) {
+                                        int pos1 =  f.toString().indexOf("9999999");
+                                        int pos2 =  f.toString().indexOf(".");
+                                        lsd = pos2-pos1+1;
+                                    }
+                                    else if(f.toString().indexOf("0000000") > 0) {
+                                        int pos1 =  f.toString().indexOf("0000000");
+                                        int pos2 =  f.toString().indexOf(".");
+                                        lsd = pos2-pos1+1;
+                                    }
                                 }
-
-//                                String f_val = Formats.forms(f, fwidth);
                                 String f_val = Formats.forms(f,fwidth, msd,-lsd);
+
                                 if (low != null && high != null) {
-                                    String f_low = Formats.forms(low, lwidth);
-                                    String f_high = Formats.forms(high,hwidth);
+                                    SignificantFigures vall = new SignificantFigures(low);
+                                    lsd = vall.getLSD();
+                                    msd = vall.getMSD();
+                                    if(msd == 0) msd = 1;
+                                    if(low.toString().indexOf("9999999") > 0) {
+                                        int pos1 =  low.toString().indexOf("9999999");
+                                        int pos2 =  low.toString().indexOf(".");
+                                        lsd = pos2-pos1+1;
+                                    }
+                                    else if(low.toString().indexOf("0000000") > 0) {
+                                        int pos1 =  low.toString().indexOf("0000000");
+                                        int pos2 =  low.toString().indexOf(".");
+                                        lsd = pos2-pos1+1;
+                                    }    
+                                    String f_low = Formats.forms(low,lwidth,msd,-lsd);
+
+                                    SignificantFigures valh = new SignificantFigures(high);
+                                    lsd = valh.getLSD();
+                                    msd = valh.getMSD();
+                                    if(msd == 0) msd = 1;
+                                    if(high.toString().indexOf("9999999") > 0) {
+                                        int pos1 =  high.toString().indexOf("9999999");
+                                        int pos2 =  high.toString().indexOf(".");
+                                        lsd = pos2-pos1+1;
+                                    }
+                                    else if(high.toString().indexOf("0000000") > 0) {
+                                        int pos1 =  high.toString().indexOf("0000000");
+                                        int pos2 =  high.toString().indexOf(".");
+                                        lsd = pos2-pos1+1;
+                                    }    
+                                    String f_high = Formats.forms(high,hwidth,msd,-lsd);
+
+
                                     Double width = high - low;
                                     if (f != null && asymmfocus) {
                                         writer.writeRaw(f_val);


More information about the HepData-svn mailing list