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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Mar 15 16:14:23 GMT 2012


Author: whalley
Date: Thu Mar 15 16:14:23 2012
New Revision: 1521

Log:
redoing displays with expand/hie

Added:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayDatasetLocation.java
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 Mar 13 16:48:54 2012	(r1520)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Thu Mar 15 16:14:23 2012	(r1521)
@@ -52,8 +52,8 @@
                 int iend = ls;
                 int ihash = comment.indexOf("#");
                 if(ihash>0) { iend = ihash; }
-                writer.element("br"); writer.end();
-                writer.write(comment.substring(0,iend));
+//                writer.element("br"); writer.end();
+//                writer.write(comment.substring(0,iend));
                 if(iend<ls){ 
                      comment=comment.substring(ihash+1);
                      ls=comment.length();
@@ -288,7 +288,8 @@
           writer.end();
         writer.end();
 
-        if (getFormat().equals("full") && _dataset.getNumPoints() != 0) {
+//        if (getFormat().equals("full") && _dataset.getNumPoints() != 0) {
+        if ( _dataset.getNumPoints() != 0) {
 
             // Finally the numbers themselves
             int sumzero = 0;
@@ -600,7 +601,7 @@
         writer.end(); //table
 
         writer.element("input");
-        writer.attributes("type", "hidden");
+        if(!getFormat().equals("full")) { writer.attributes("type", "hidden");}
         writer.attributes("name", "string");
         writer.attributes("value", getSearchString());
         writer.end();

Added: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayDatasetLocation.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DisplayDatasetLocation.java	Thu Mar 15 16:14:23 2012	(r1521)
@@ -0,0 +1,66 @@
+package cedar.hepdata.webapp.components;
+
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.annotations.*;
+import org.apache.tapestry5.ioc.annotations.*;
+import cedar.hepdata.model.*;
+import java.util.*;
+
+public class DisplayDatasetLocation {
+
+    @BeginRender
+    void renderMessage(MarkupWriter writer) {
+
+        if (_dataset != null) {
+            List <String> comarray = new ArrayList();
+            StringBuffer b = new StringBuffer();
+//            writer.element("p class='datasetcomment'");
+            for (String comment : _dataset.getComments()){
+                if(comment.startsWith("Location")){
+                    comment = comment.replace("Location:", "");
+                    comment = comment.replace(">", ">");
+                    comment = comment.replace("<", "<");
+                    comment = comment.replace("& gt;", ">");
+                    comment = comment.replace("& lt;", "<");
+                    while (comment.length() > 1){
+                        int ip = comment.indexOf(". ");
+                        if(ip < 0) {ip = comment.length();}
+                        int printcom=1;
+                        for (int ii=0; ii<comarray.size(); ii++){
+                            if(comment.substring(0,ip).equals(comarray.get(ii))){ printcom=0; }
+                        }
+                        if(printcom == 1){ b.append(comment.substring(0,ip) + ". ");}
+                        comarray.add(comment.substring(0,ip));
+                        if(comment.length() != ip) {comment = comment.substring(ip+2);}
+                        else {comment = "";}
+                    }
+                }
+            }
+            String bs = b.toString();
+            int ls=bs.length();
+            System.out.println(bs + " " + ls);
+            while (ls>0){
+                int iend = ls;
+                int ihash = bs.indexOf("#");
+              System.out.println("ihash "+ihash+" iend " + ls);
+               
+                if(ihash>=0) { iend = ihash; }
+//                writer.element("br"); writer.end();
+                writer.write(bs.substring(0,iend));
+                if(iend<ls){ 
+                     bs=bs.substring(ihash+1);
+                     ls=bs.length();
+                } else {
+                    ls=0;
+                }
+            }
+         
+//            writer.end();
+            
+            
+            
+        }
+    }
+    @Parameter(name="ds")
+    private Dataset _dataset;
+}


More information about the HepData-svn mailing list