|
[HepData-svn] r1515 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pagesblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Mar 13 10:29:40 GMT 2012
Author: whalley Date: Tue Mar 13 10:29:40 2012 New Revision: 1515 Log: tweaks to advanced combined plotting to allow access from url string Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java Thu Feb 23 10:29:17 2012 (r1514) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java Tue Mar 13 10:29:40 2012 (r1515) @@ -21,6 +21,7 @@ import java.io.BufferedWriter; import java.io.FileWriter; import java.util.List; +import java.util.regex.*; import java.awt.image.*; import java.awt.Graphics2D; @@ -48,6 +49,7 @@ import org.apache.tapestry5.ComponentResources; import org.apache.tapestry5.Link; import org.apache.tapestry5.MarkupWriter; +import org.apache.tapestry5.EventContext; import org.apache.tapestry5.StreamResponse; import org.apache.tapestry5.annotations.*; import org.apache.tapestry5.ioc.annotations.*; @@ -101,8 +103,60 @@ public void setSavedList(List saved){ this._saved=saved; } - public List <String> getSavedList(){ - return this._saved; + + private String ps = ""; + public void onActivate(EventContext context) { + if (context.getCount() > 0) { + ps = context.get(String.class, 0); + } + } + + public List <String> getSavedList(){ + if(!ps.equals("")){ + List<String> _savedtemp = new ArrayList(); + while(ps.contains("insp")){ + Matcher m = Pattern.compile("(.*)insp(\\d+)(ds\\d+ya\\d+.*)").matcher(ps); + while (m.find()){ + Query q=null; + q = _session.createQuery("select distinct p from Paper p where p._inspireId = " + m.group(2)); + Paper p = (Paper) q.uniqueResult(); + Long hepid = p.getHepdataId(); + ps=m.group(1)+"save"+hepid+m.group(3); + } + } + Matcher m = Pattern.compile("(save\\d+ds\\d+ya\\d+)").matcher(ps); + while (m.find()){_savedtemp.add(m.group(1));} + m = Pattern.compile("yscale:(lin|log)").matcher(ps); + while (m.find()){ yscale=m.group(1);} + this.setXId("1"); + this.setXmin(null); + this.setXmax(null); + this.setYmin(null); + this.setYmax(null); + this.setXscale("lin"); + if(yscale == null) { + this.setYscale("lin"); + } else { + this.setYscale(yscale); + } + this.setXsize("400"); + this.setYsize("400"); + this.setXkey("0.7"); + this.setYkey("0.9"); + this.setXtext("0.7"); + this.setYtext("0.9"); + this.setSystematics("yes"); + this.setPdfname(null); + for (int i=0; i<=10; i++){ + m = Pattern.compile("optionstring" + i + ":([=\\d\\w\\+\\-\\s\\.]+)").matcher(ps); + while (m.find()){ optionstring[i]=m.group(1);} + } + _saved=_savedtemp; + return _savedtemp; + } + else{ + return this._saved; + } } public List<String>getPlotContext(){ @@ -512,7 +566,6 @@ } public String addCount(){ count += 1; - System.out.println("added to count " + count); return ""; } Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java Thu Feb 23 10:29:17 2012 (r1514) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java Tue Mar 13 10:29:40 2012 (r1515) @@ -227,7 +227,18 @@ final XYIntervalSeriesCollection collection = new XYIntervalSeriesCollection(); if (context.getCount() > 0) { String ps = context.get(String.class, 0); - + while (ps.contains("insp")){ + System.out.println("ps: "+ps); + Matcher m = Pattern.compile("(.*)insp(\\d+)(ds\\d+ya\\d+.*)").matcher(ps); + while (m.find()){ + Query q=null; + q = _session.createQuery("select distinct p from Paper p where p._inspireId = " + m.group(2)); + Paper p = (Paper) q.uniqueResult(); + Long hepid = p.getHepdataId(); + ps=m.group(1)+"save"+hepid+m.group(3); + } + } + System.out.println("ps: "+ps); Matcher m = Pattern.compile("(save\\d+ds\\d+ya\\d+)").matcher(ps); _yaxislist.clear(); while (m.find()){_yaxislist.add(m.group(1));} @@ -288,7 +299,7 @@ } collection.addSeries(series); - titlestring += DataSeries.getTitleString(ya,count) + "\n"; +// titlestring += DataSeries.getTitleString(ya,count) + "\n"; xlabel = DataSeries.getXlabel(ya,xid); ylabel = DataSeries.getYlabel(ya);
More information about the HepData-svn mailing list |