|
[HepData-svn] r1301 - in trunk/hepdata-webapp/src/main: java/cedar/hepdata/webapp/pages resources/cedar/hepdata/webapp/pagesblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Oct 29 15:47:00 GMT 2009
Author: whalley Date: Thu Oct 29 15:47:00 2009 New Revision: 1301 Log: more small tweaks Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/CombinedPlot.tml Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java Thu Oct 29 12:40:08 2009 (r1300) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java Thu Oct 29 15:47:00 2009 (r1301) @@ -151,119 +151,44 @@ private String optionstring; public String getOptionstring(){ return optionstring; } public void setOptionstring(String optionstring) {this.optionstring=optionstring;} - private String OptionHasYheader(){ - String rtn = null; - if(optionstring != null){ - if(optionstring.indexOf("yheader") > -1){ - String yh = optionstring.substring(optionstring.indexOf("yheader")); - int len = yh.length(); - if(yh.indexOf(";") > -1) len = yh.indexOf(";"); - rtn = yh.substring(8,len); - } - } - return rtn; - } - private String OptionHasXheader(){ + + private String OptionHasString(String name){ String rtn = null; if(optionstring != null){ - if(optionstring.indexOf("xheader") > -1){ - String xh = optionstring.substring(optionstring.indexOf("xheader")); + if(optionstring.indexOf(name) > -1){ + String xh = optionstring.substring(optionstring.indexOf(name)); int len = xh.length(); - if(xh.indexOf(";") > -1) len = xh.indexOf(";"); - rtn = xh.substring(8,len); + if(xh.indexOf(",") > -1) len = xh.indexOf(","); + rtn = xh.substring(name.length()+1,len); } } return rtn; } - private String OptionHasPdf(){ - String rtn = null; - if(optionstring != null){ - if(optionstring.indexOf("pdf") > -1){ - String ph = optionstring.substring(optionstring.indexOf("pdf")); - int len = ph.length(); - if(ph.indexOf(";") > -1) len = ph.indexOf(";"); - rtn = ph.substring(4,len); - } - - } - return rtn; - } - - private String OptionHasSys(){ - String rtn = null; + private Double OptionHasDouble(String name){ + Double rtn = null; if(optionstring != null){ - if(optionstring.indexOf("sys") > -1){ - String sh = optionstring.substring(optionstring.indexOf("sys")); - int len = sh.length(); - if(sh.indexOf(";") > -1) len = sh.indexOf(";"); - rtn = sh.substring(4,len); + if(optionstring.indexOf(name) > -1){ + String dh = optionstring.substring(optionstring.indexOf(name)); + int len = dh.length(); + if(dh.indexOf(",") > -1) len = dh.indexOf(","); + if( len > name.length()+1) rtn = Double.valueOf(dh.substring(name.length()+1,len)); } - } return rtn; } - private Double OptionHasScale(int n){ Double rtn = null; if(optionstring != null){ if(optionstring.indexOf("scale(" + n + ")") > -1){ String sh = optionstring.substring(optionstring.indexOf("scale(" + n + ")")); int len = sh.length(); - if(sh.indexOf(";") > -1) len = sh.indexOf(";"); + if(sh.indexOf(",") > -1) len = sh.indexOf(","); if( len > 9) rtn = Double.valueOf(sh.substring(9,len)); } } return rtn; } - private Double OptionHasYmax(){ - Double rtn = null; - if(optionstring != null){ - if(optionstring.indexOf("ymax") > -1){ - String yh = optionstring.substring(optionstring.indexOf("ymax")); - int len = yh.length(); - if(yh.indexOf(";") > -1) len = yh.indexOf(";"); - if( len > 5) rtn = Double.valueOf(yh.substring(5,len)); - } - } - return rtn; - } - private Double OptionHasYmin(){ - Double rtn = null; - if(optionstring != null){ - if(optionstring.indexOf("ymin") > -1){ - String yh = optionstring.substring(optionstring.indexOf("ymin")); - int len = yh.length(); - if(yh.indexOf(";") > -1) len = yh.indexOf(";"); - if( len > 5) rtn = Double.valueOf(yh.substring(5,len)); - } - } - return rtn; - } - private Double OptionHasXmax(){ - Double rtn = null; - if(optionstring != null){ - if(optionstring.indexOf("xmax") > -1){ - String xh = optionstring.substring(optionstring.indexOf("xmax")); - int len = xh.length(); - if(xh.indexOf(";") > -1) len = xh.indexOf(";"); - if( len > 5) rtn = Double.valueOf(xh.substring(5,len)); - } - } - return rtn; - } - private Double OptionHasXmin(){ - Double rtn = null; - if(optionstring != null){ - if(optionstring.indexOf("xmin") > -1){ - String xh = optionstring.substring(optionstring.indexOf("xmin")); - int len = xh.length(); - if(xh.indexOf(";") > -1) len = xh.indexOf(";"); - if( len > 5) rtn = Double.valueOf(xh.substring(5,len)); - } - } - return rtn; - } @Persist private int count; @@ -315,20 +240,20 @@ } Boolean syst = true; if(optionstring != null){ - if(OptionHasSys() != null){ - if(OptionHasSys().equals("no")){ System.out.println("setting system to false"); syst = false; } + if(OptionHasString("sys") != null){ + if(OptionHasString("sys").equals("no")){ System.out.println("setting system to false"); syst = false; } } } series1 = getDataSeries(ya,Integer.parseInt(getXId()),getXscale(),getYscale(),_sf,syst); seriesMap.put(numberRun,series1); String xh = ya.getDataset().getXAxis(1).getHeader(); - if(OptionHasXheader() != null){ xh = OptionHasXheader(); } + if(OptionHasString("xheader") != null){ xh = OptionHasString("xheader"); } if(xh.endsWith("IN MEV")){ xh = xh.replace("IN MEV","IN GEV"); } xLabelMap.put(numberRun,xh); String yh = ya.getHeader(); - if(OptionHasYheader() != null){ yh = OptionHasYheader(); } + if(OptionHasString("yheader") != null){ yh = OptionHasString("yheader"); } yLabelMap.put(numberRun,yh); } int number = numberRun-numberRunStart; @@ -469,10 +394,10 @@ xlow = 0.90*xlow; xhigh = 1.10*xhigh; } - if(OptionHasXmax() != null){xhigh = OptionHasXmax();} - if(OptionHasXmin() != null){xlow = OptionHasXmin();} - if(OptionHasYmax() != null){yhigh = OptionHasYmax();} - if(OptionHasYmin() != null){ylow = OptionHasYmin();} + if(OptionHasDouble("xmax") != null){xhigh = OptionHasDouble("xmax");} + if(OptionHasDouble("xmin") != null){xlow = OptionHasDouble("xmin");} + if(OptionHasDouble("ymax") != null){yhigh = OptionHasDouble("ymax");} + if(OptionHasDouble("ymin") != null){ylow = OptionHasDouble("ymin");} IntervalXYDataset data1 = collection; @@ -488,7 +413,7 @@ } else{ LogarithmicAxis logaxistemp = new LogarithmicAxis("header"); rangeAxisX = logaxistemp; - if(OptionHasXmin() != null && OptionHasXmax() != null) {rangeAxisX.setRange(rangex);} + if(OptionHasDouble("xmin") != null && OptionHasDouble("xmax") != null) {rangeAxisX.setRange(rangex);} } try { String xlabel = (String) xLabelMap.get(numberRunStart+1); @@ -505,7 +430,7 @@ } else{ LogarithmicAxis logaxistemp = new LogarithmicAxis(_yaxis.getHeader()); rangeAxisY = logaxistemp; - if(OptionHasYmin() != null && OptionHasYmax() != null) {rangeAxisY.setRange(rangey);} + if(OptionHasDouble("ymin") != null && OptionHasDouble("ymax") != null) {rangeAxisY.setRange(rangey);} } try{ String ylabel = (String) yLabelMap.get(numberRunStart+1); @@ -521,8 +446,8 @@ final JFreeChart chart = new JFreeChart("", new Font("Serif", Font.PLAIN, 12), subplot1, showLegend); chart.setBackgroundPaint(new Color(255,255,255,0)); if(optionstring != null){ - if(OptionHasPdf() != null){ - File filename = new File(OptionHasPdf()); + if(OptionHasString("pdf") != null){ + File filename = new File(OptionHasString("pdf")); try { saveChartAsPDF(filename, chart, 500, 500); } catch (IOException ie) {} Modified: trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/CombinedPlot.tml ============================================================================== --- trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/CombinedPlot.tml Thu Oct 29 12:40:08 2009 (r1300) +++ trunk/hepdata-webapp/src/main/resources/cedar/hepdata/webapp/pages/CombinedPlot.tml Thu Oct 29 15:47:00 2009 (r1301) @@ -7,9 +7,12 @@ <h3> Composite Plots </h3> <p> This page displays the combined data plot with options to 'Replot' the data - changing the X and Y axis types (log/lin). Other options (yheader,xheaader,scale(),sys) can be entered as ';' + changing the X and Y axis types (log/lin). Other options can be entered as comma separated name=value pairs. </p> + Available options are: + ymax, ymin, xmax, xmin, xheader, yheader, scale(n), sys=(yes or no)<br/><br/> + <t:form t:id="CombinedPlot"> <input type="submit" t:type="submit" t:id="submit1Button" value="RePlot"/>
More information about the HepData-svn mailing list |