[HepData-svn] r1893 - in trunk/hepdata-webapp/src/main/java/cedar/hepdata: formats webapp/components

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Sep 28 20:00:29 BST 2015


Author: watt
Date: Mon Sep 28 20:00:29 2015
New Revision: 1893

Log:
Corrections to HTML, input and YAML formatters

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

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java	Mon Sep 28 12:58:08 2015	(r1892)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/InputFormatter.java	Mon Sep 28 20:00:29 2015	(r1893)
@@ -263,7 +263,11 @@
                             }
 			}
                     } catch(Exception e){
-			s.append(" " + ds.getXAxis(nx+1).getBin(i+1).getDescription());
+			if (ds.getXAxis(nx+1).getBin(i+1).getDescription() != null) {
+			    s.append(" " + ds.getXAxis(nx+1).getBin(i+1).getDescription());
+			} else {
+			    s.append(" -");
+			}
                     }
                     s.append(";");                   
                 }

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Mon Sep 28 12:58:08 2015	(r1892)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YamlFormatter.java	Mon Sep 28 20:00:29 2015	(r1893)
@@ -370,7 +370,7 @@
 			first=false; 
                     }
 		}
-		if(bin.getLowValue() != null && haswidth ) { 
+		if(bin.getLowValue() != null) {
                     if(!first) { s.append(", "); } 
 		    if(bin.getLowValueLength()!=null) { 
                         s.append("low: "+forms(bin.getLowValue(),bin.getLowValueLength())); 
@@ -379,7 +379,7 @@
                     }
                     first=false; 
                 }
-		if(bin.getHighValue() != null && haswidth ) { 
+		if(bin.getHighValue() != null) {
                     if(!first) {s.append(", "); } 
                     if(bin.getHighValueLength()!=null) { 
                         s.append("high: "+forms(bin.getHighValue(),bin.getHighValueLength())); 
@@ -390,7 +390,7 @@
                 }
                 if(bin.getRelation() != null && bin.getRelation() != Relation.EQUALS ) { 
                     if(!first) { s.append(", "); } 
-                    s.append("relation: "+bin.getRelation()); 
+                    s.append("relation: '"+bin.getRelation()+"'");
                     first=false; 
                 }
                 if(bin.getDescription() != null ) {  
@@ -398,6 +398,9 @@
                     s.append("value: '"+bin.getDescription()+"'");  
                     first=false;
                 }
+		if (bin.getDescription() == null && bin.getFocus() == null) {
+		    s.append("value: '-'");
+		}
                 if(bin.getId() < xax.getBins().size()) {
                     s.append("}");
                 }
@@ -516,14 +519,21 @@
 		    //    s.append(s4+s4+"value: ");
                     s.append(s4+sp+"value: ");
                     if(point.getRelation() != Relation.EQUALS){
-                        s.append(point.getRelation());
+			s.append("'"+point.getRelation());
                     }
 		    //                    s.append(point.getValue()+" "+point.getValueLength()+"\n");
 		    if (point.getDescription() != null) {
-			s.append("'"+point.getDescription()+"'\n");
+			if(point.getRelation() == Relation.EQUALS){
+			    s.append("'");
+			}
+			s.append(point.getDescription()+"'");
 		    } else {
-			s.append(point.getValue()+"\n");
+			s.append(point.getValue());
+		    }
+		    if (point.getRelation() != Relation.EQUALS) {
+			s.append("'");
 		    }
+		    s.append("\n");
 		    if(point.getErrors().size()>0){
                         s.append(s4+s4+"errors:\n");
                         for(Uncertainty error : point.getErrors()){

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	Mon Sep 28 12:58:08 2015	(r1892)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Mon Sep 28 20:00:29 2015	(r1893)
@@ -524,7 +524,8 @@
                                         writer.writeRaw(f_low + " – " + f_high);
                                     }
                                 } else {
-                                    writer.write(f_val);
+                                    if (f != null) { writer.write(f_val); }
+				    else { writer.writeRaw("–"); }
                                 }
                             } else {
                                 writer.write(b.getRelation().toString());


More information about the HepData-svn mailing list