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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Mar 13 16:33:03 GMT 2012


Author: whalley
Date: Tue Mar 13 16:33:03 2012
New Revision: 1519

Log:
adds expand/hide buttons

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:32:22 2012	(r1518)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Tue Mar 13 16:33:03 2012	(r1519)
@@ -3,8 +3,10 @@
 import org.apache.tapestry5.MarkupWriter;
 import org.apache.tapestry5.annotations.BeginRender;
 import org.apache.tapestry5.annotations.Parameter;
+import org.apache.tapestry5.annotations.Path;
 import org.apache.tapestry5.ioc.annotations.*;
 import org.apache.tapestry5.services.*;
+import org.apache.tapestry5.Asset;
 
 import cedar.hepdata.model.*;
 import cedar.hepdata.util.*;
@@ -22,15 +24,25 @@
     @Inject
     private RequestGlobals _reqGlobals;
 
+    @Inject
+    @Path("context:/button_expand.png")
+    private Asset button_expand;
+
+    @Inject
+    @Path("context:/button_hide.png")
+    private Asset button_hide;
+
     @Parameter
     private String _format;
     public String getFormat() { return _format; }
     public void getFormat(String f) { _format = f; }
 
 
+
     @BeginRender
     void renderMessage(MarkupWriter writer) {
 
+        String dsid = "datacell"+_dataset.getId().toString();
         // Output the table comment(CT) and location(TFP)
         writer.element("p");
         writer.attributes("class", "datasetcomments");
@@ -202,13 +214,13 @@
                 if(same) {
                     writer.element("th");
                     writer.attributes("colspan",ny);
-                    writer.attributes("class","multiple");
+                    writer.attributes("class","multiple qualifier_class");
                     writer.write(store[0][i]);
                     writer.end();
                 } else {
                     for (int nmy=0; nmy<ny; nmy++){
                         writer.element("th");
-                        writer.attributes("class","multiple");
+                        writer.attributes("class","multiple qualifier_class");
                         writer.write( store[nmy][i]);
                         writer.end();
                     }
@@ -224,7 +236,7 @@
         // X headers
         for (XAxis x : _dataset.getXAxes()) {
             writer.element("th");
-            writer.attributes("class", "xheader");
+            writer.attributes("class", "xheader qualifier_class");
             writer.write(x.getHeader());
             writer.end(); //th
         }
@@ -240,21 +252,21 @@
         }
         if (nmatch == ny) {
             writer.element("th");
-            writer.attributes("class", "yheader");
+            writer.attributes("class", "yheader observable_class");
             writer.attributes("colspan", ny);
             writer.write(yhead);
             writer.end(); //th
         } else {
             for (YAxis y : _dataset.getYAxes()) {
                 writer.element("th");
-                writer.attributes("class", "yheader");
+                writer.attributes("class", "yheader observable_class");
                 writer.write(y.getHeader());
                 writer.end(); //th
             }
         }
         writer.end(); //tr
 
-
+///////////////////////////////////////////////////////////////////////////////////////////
         if(_dataset.getNumPoints() == 0){
             writer.element("th");
             writer.attributes("colspan",ny+nx);
@@ -262,6 +274,20 @@
             writer.write("No data is encoded for this table");
             writer.end();
         }
+        writer.element("tr");
+          writer.element("td");
+            writer.attributes("colspan",nx+ny);
+          writer.end();
+            writer.element("img");
+//            writer.attributes("src","/assets/ctx/7c9b7bf73fa713d8/new.gif");
+            writer.attributes("src",button_hide.toClientURL());
+//            writer.attributes("onclick","ExpandClicked(this,'/assets/ctx/7c9b7bf73fa713d8/bullet.gif','/assets/ctx/7c9b7bf73fa713d8/bullet.gif');");
+            String hide = button_hide.toClientURL();
+            String expand = button_expand.toClientURL();
+            writer.attributes("onclick","ExpandClicked(this,'"+expand+"','"+hide+"');");
+          writer.end();
+        writer.end();
+
         if (getFormat().equals("full") && _dataset.getNumPoints() != 0) {
 
             // Finally the numbers themselves


More information about the HepData-svn mailing list