ReactionPlot Class Reference

Collaboration diagram for ReactionPlot:

Collaboration graph
[legend]

List of all members.


Public Member Functions

String getQueryParam (String param)
String setHepId ()
String getHepId ()
String getDsId ()
String getXId ()
String getYId ()
Long getSpiresId ()
String getQueryString ()
String getXscale ()
String getNotXscale ()
String getYscale ()
String getNotYscale ()
String getSys ()
String getNotSys ()
String getPdfName ()
String setPdfName ()
String getPdfSelect ()
String setPdfSelect ()
String getSelect ()
void setSelect (String select)
List< String > getSelects ()
List< YAxis > getSelectedYAxes ()
String getFirstAuthorName ()
String getFirstPublished ()
String getFirstPreprint ()
String getFirstExperimentName ()
String getFirstInformalName ()
String getTitle ()
String getFirstDatasetComment ()
YAxis getYAxis ()
void setYAxis (YAxis yaxis)
List< YAxis > getYAxes ()
String setTitleStringBlank ()
Link getChart3 ()
XYIntervalSeries getDataSeries (YAxis yaxis, int xid, String xscale, String yscale, Boolean systematics)
StreamResponse onChart (final int width, final int height, final int numberRunStart, int number, String _xscale, String _yscale)

Static Public Member Functions

static void saveChartAsPDF (File file, JFreeChart chart, int width, int height) throws IOException
static void writeChartAsPDF (OutputStream out, JFreeChart chart, int width, int height) throws IOException

Package Functions

Object onSubmitFromSavePlot ()
void onsubmitFromSavePage ()

Detailed Description

Definition at line 73 of file ReactionPlot.java.


Member Function Documentation

String getQueryParam ( String  param  ) 

Definition at line 89 of file ReactionPlot.java.

00089                                              {
00090        return _reqGlobals.getRequest().getParameter(param);
00091     }

String setHepId (  ) 

Definition at line 95 of file ReactionPlot.java.

00095                             {
00096         hepid = _reqGlobals.getRequest().getParameter("hepid");
00097         return "";
00098     }

String getHepId (  ) 

Definition at line 99 of file ReactionPlot.java.

Referenced by ReactionPlot.getYAxes(), and ReactionPlot.onsubmitFromSavePage().

00099                             {
00100        return _reqGlobals.getRequest().getParameter("hepid");
00101     }

String getDsId (  ) 

Definition at line 102 of file ReactionPlot.java.

Referenced by ReactionPlot.getFirstDatasetComment(), ReactionPlot.getYAxes(), and ReactionPlot.onsubmitFromSavePage().

00102                            {
00103        return _reqGlobals.getRequest().getParameter("dsid");
00104     }

String getXId (  ) 

Definition at line 105 of file ReactionPlot.java.

Referenced by ReactionPlot.getChart3(), and ReactionPlot.onsubmitFromSavePage().

00105                           {
00106        return _reqGlobals.getRequest().getParameter("xid");
00107     }

String getYId (  ) 

Definition at line 108 of file ReactionPlot.java.

Referenced by ReactionPlot.getChart3(), ReactionPlot.getYAxes(), and ReactionPlot.onsubmitFromSavePage().

00108                           {
00109        return _reqGlobals.getRequest().getParameter("yid");
00110     }

Long getSpiresId (  ) 

Definition at line 124 of file ReactionPlot.java.

00124                              {
00125        return _paper.getSpiresId();
00126     }

String getQueryString (  ) 

Definition at line 128 of file ReactionPlot.java.

Referenced by ReactionPlot.onsubmitFromSavePage().

00128                                   {
00129        return _reqGlobals.getRequest().getParameter("string");
00130     }

String getXscale (  ) 

Definition at line 132 of file ReactionPlot.java.

Referenced by ReactionPlot.getChart3(), and ReactionPlot.onsubmitFromSavePage().

00132                              {
00133        return _reqGlobals.getRequest().getParameter("xscale");
00134     }

String getNotXscale (  ) 

Definition at line 135 of file ReactionPlot.java.

00135                                 {
00136        if(_reqGlobals.getRequest().getParameter("xscale").equals("lin")){ return "log";}
00137        else { return "lin";}
00138     }

String getYscale (  ) 

Definition at line 140 of file ReactionPlot.java.

Referenced by ReactionPlot.getChart3(), and ReactionPlot.onsubmitFromSavePage().

00140                              {
00141        return _reqGlobals.getRequest().getParameter("yscale");
00142     }

String getNotYscale (  ) 

Definition at line 143 of file ReactionPlot.java.

00143                                 {
00144        if(_reqGlobals.getRequest().getParameter("yscale").equals("lin")){ return "log";}
00145        else { return "lin";}
00146     }

String getSys (  ) 

Definition at line 148 of file ReactionPlot.java.

Referenced by ReactionPlot.getChart3(), and ReactionPlot.onsubmitFromSavePage().

00148                           {
00149        return _reqGlobals.getRequest().getParameter("sys");
00150     }

String getNotSys (  ) 

Definition at line 151 of file ReactionPlot.java.

00151                              {
00152        if(_reqGlobals.getRequest().getParameter("sys").equals("yes")){ return "no";}
00153        else { return "yes";}
00154     }

String getPdfName (  ) 

Definition at line 158 of file ReactionPlot.java.

Referenced by ReactionPlot.setPdfName().

00158                               {
00159        _pdfname = _reqGlobals.getRequest().getParameter("pdfname");
00160 //       if(_pdfname == null || _pdfname.equals("") ){
00161 //            _pdfname = System.getProperty("user.home") + "/";
00162 //       }
00163 //       else if( !_pdfname.startsWith("/") ) { 
00164 //           _pdfname = System.getProperty("user.home") + "/" + _pdfname;
00165 //       }
00166        return _pdfname;
00167     }

String setPdfName (  ) 

Definition at line 168 of file ReactionPlot.java.

References ReactionPlot.getPdfName().

00168                               {
00169       _pdfname = getPdfName();
00170       return ""; 
00171     }

String getPdfSelect (  ) 

Definition at line 173 of file ReactionPlot.java.

Referenced by ReactionPlot.setPdfSelect().

00173                                 {
00174        return _reqGlobals.getRequest().getParameter("pdfselect");
00175     }

String setPdfSelect (  ) 

Definition at line 176 of file ReactionPlot.java.

References ReactionPlot.getPdfSelect().

00176                                 {
00177       _pdfselect = getPdfSelect();
00178       return ""; 
00179     }

String getSelect (  ) 

Definition at line 182 of file ReactionPlot.java.

00182 { return _select; }

void setSelect ( String  select  ) 

Definition at line 183 of file ReactionPlot.java.

00183 { _select = select; }

List<String> getSelects (  ) 

Definition at line 184 of file ReactionPlot.java.

00184                                      {
00185         List <String> _selected= new ArrayList();
00186         List <String> _names = _reqGlobals.getRequest().getParameterNames();
00187         int size= _names.size();
00188         for (int i=0; i<size; i++){
00189             if(_names.get(i).startsWith("plot")){
00190                 _selected.add(_names.get(i));
00191             }
00192         }
00193         return _selected;
00194     }

List<YAxis> getSelectedYAxes (  ) 

Definition at line 241 of file ReactionPlot.java.

References ReactionPlot.getYAxis().

Referenced by ReactionPlot.getChart3().

00241                                           {
00242         List <YAxis> _selected = new ArrayList();
00243         List <String> _names = _reqGlobals.getRequest().getParameterNames();
00244         System.out.println(_names);
00245         int size= _names.size();
00246         for (int i=0; i<size; i++){
00247             if(_names.get(i).startsWith("plot")){
00248                 int i1 = _names.get(i).indexOf("d");
00249                 int i2 = _names.get(i).indexOf("y");
00250                 String ds = _names.get(i).substring(i1+2,i2);
00251                 String ya = _names.get(i).substring(i2+2);
00252                 _selected.add(_paper.getDataset(Integer.parseInt(ds)).getYAxis(Integer.parseInt(ya)));
00253             }
00254         }
00255         return _selected;
00256     }

String getFirstAuthorName (  ) 

Definition at line 258 of file ReactionPlot.java.

00258                                      {
00259        int n = 0;
00260        String _firstauthor = "";
00261        for (String author : _paper.getAuthors()){
00262          n += 1;
00263          if(n == 1) {_firstauthor = author;}
00264        }
00265        String _refdate = "xx";
00266        for (Reference reference : _paper.getReferences()){
00267           _refdate = reference.getDate();
00268        }
00269         int _lref = _refdate.length();
00270        _firstauthor = _firstauthor + " " + _refdate.substring(_lref-2,_lref);
00271        return _firstauthor;
00272    }

String getFirstPublished (  ) 

Definition at line 274 of file ReactionPlot.java.

00274                                     {
00275        int n = 0;
00276        String _firstpublished = "Not Published";
00277        for (Reference ref : _paper.getReferences()){
00278            String refdesc = ref.getDescription();
00279            if(refdesc.startsWith("PL")  ||
00280               refdesc.startsWith("PR")  ||
00281               refdesc.startsWith("ZP")  ||
00282               refdesc.startsWith("EPJ") ||
00283               refdesc.startsWith("NC")  ||
00284               refdesc.startsWith("JPG") ||
00285               refdesc.startsWith("JHEP") ){
00286                  n += 1;
00287                  if(n == 1) { _firstpublished = refdesc;}
00288            }
00289        }
00290        return _firstpublished;
00291    }

String getFirstPreprint (  ) 

Definition at line 292 of file ReactionPlot.java.

00292                                    {
00293        int n = 0;
00294        String _firstpreprint= "Not Known";
00295        for (Reference reference : _paper.getReferences()){
00296            String ref = reference.getDescription();
00297            if(ref.startsWith("PL")  ||
00298               ref.startsWith("PR")  ||
00299               ref.startsWith("ZP")  ||
00300               ref.startsWith("EPJ") ||
00301               ref.startsWith("NC")  ||
00302               ref.startsWith("JPG") ||
00303               ref.startsWith("JHEP") ){
00304             }
00305            else{
00306                  n += 1;
00307                  if(n == 1) { _firstpreprint = ref;}
00308              
00309            }
00310        }
00311        return _firstpreprint;
00312    }

String getFirstExperimentName (  ) 

Definition at line 313 of file ReactionPlot.java.

00313                                          {
00314        int n = 0;
00315        String _firstexperiment = "";
00316        for (Experiment experiment : _paper.getExperiments()){
00317            n += 1;
00318            if(n == 1) { _firstexperiment = experiment.getName();}
00319        }
00320        return _firstexperiment;
00321    }

String getFirstInformalName (  ) 

Definition at line 322 of file ReactionPlot.java.

00322                                       {
00323        int n = 0;
00324        String _firstinformal = "";
00325        for (Experiment experiment : _paper.getExperiments()){
00326            n += 1;
00327            if(n == 1) { _firstinformal = experiment.getInformalName();}
00328        }
00329        return _firstinformal;
00330    }

String getTitle (  ) 

Definition at line 331 of file ReactionPlot.java.

00331                            {
00332        return _paper.getTitle();
00333     }

String getFirstDatasetComment (  ) 

Definition at line 335 of file ReactionPlot.java.

References ReactionPlot.getDsId().

00335                                          {
00336        int n = 0;
00337        String _firstcomment = "";
00338        for ( String comment : _paper.getDataset(Integer.parseInt(getDsId())).getComments() ){
00339           n += 1;
00340           if(n == 1) { _firstcomment = comment;}
00341        }
00342        return _firstcomment;
00343    }

YAxis getYAxis (  ) 

Definition at line 347 of file ReactionPlot.java.

Referenced by ReactionPlot.getSelectedYAxes(), and ReactionPlot.getYAxes().

00347 {  return _yaxis; }

void setYAxis ( YAxis  yaxis  ) 

Definition at line 348 of file ReactionPlot.java.

00348 {  _yaxis = yaxis; }

List<YAxis> getYAxes (  ) 

Definition at line 353 of file ReactionPlot.java.

References ReactionPlot.getDsId(), ReactionPlot.getHepId(), ReactionPlot.getYAxis(), and ReactionPlot.getYId().

00353                                   {
00354        List <YAxis> _ylist = new ArrayList();
00355        Query q=null;
00356        StringBuffer b = new StringBuffer();
00357 //       b.append("select distinct p from Paper p where p._hepdataId = ");
00358        b.append("select distinct p from Paper p where p._id = ");
00359        b.append(getHepId());
00360        q = _session.createQuery(b.toString());
00361        _paper = (Paper) q.uniqueResult();
00362        String yid=getYId();
00363        if(yid.equals("0")){yid = "1";} 
00364        _ylist.add(_paper.getDataset(Integer.parseInt(getDsId())).getYAxis(Integer.parseInt(yid)));
00365        return _ylist;
00366     }

String setTitleStringBlank (  ) 

Definition at line 372 of file ReactionPlot.java.

00372                                        {
00373        titlestring="";
00374 //       return "zeroed titlrestring";
00375        return "";
00376     }  

Link getChart3 (  ) 

Definition at line 387 of file ReactionPlot.java.

References ReactionPlot.getDataSeries(), ReactionPlot.getSelectedYAxes(), ReactionPlot.getSys(), ReactionPlot.getXId(), ReactionPlot.getXscale(), ReactionPlot.getYId(), and ReactionPlot.getYscale().

00387                            {          
00388         if (numberRun > 10000) {
00389             numberRun=0;
00390         }
00391         int numberRunStart  = numberRun;
00392         XYIntervalSeries series1 = null;
00393         if(!getSelectedYAxes().isEmpty()){
00394             System.out.println("there are selected plots");
00395             for (YAxis ya : getSelectedYAxes()){
00396                 numberRun +=1;
00397                 series1 = getDataSeries(ya,Integer.parseInt(getXId()),getXscale(),getYscale(),true);
00398                 seriesMap.put(numberRun,series1);
00399                 xLabelMap.put(numberRun,ya.getDataset().getXAxis(1).getHeader());
00400                 yLabelMap.put(numberRun,ya.getHeader());
00401             }
00402            
00403         }
00404         else if(getYId().equals("0")){
00405             for (YAxis ya : _yaxis.getDataset().getYAxes()){
00406                 numberRun +=1;
00407                 if(getSys().equals("yes")){
00408                    series1 = getDataSeries(ya,Integer.parseInt(getXId()),getXscale(),getYscale(),true);
00409                 }
00410                 else{
00411                    series1 = getDataSeries(ya,Integer.parseInt(getXId()),getXscale(),getYscale(),false);
00412                 }     
00413             seriesMap.put(numberRun,series1);
00414             xLabelMap.put(numberRun,ya.getDataset().getXAxis(1).getHeader());
00415             yLabelMap.put(numberRun,ya.getHeader());
00416             }
00417         }
00418         else{
00419             numberRun +=1;
00420             if(getSys().equals("yes")){
00421                  series1 = getDataSeries(_yaxis,Integer.parseInt(getXId()),getXscale(),getYscale(),true);
00422             }
00423             else{
00424                  series1 = getDataSeries(_yaxis,Integer.parseInt(getXId()),getXscale(),getYscale(),false);
00425             }     
00426             seriesMap.put(numberRun,series1);
00427             xLabelMap.put(numberRun,_yaxis.getDataset().getXAxis(1).getHeader());
00428             yLabelMap.put(numberRun,_yaxis.getHeader());
00429         }
00430        int number = numberRun-numberRunStart;
00431        String xsize = "500";
00432        String ysize = "500";
00433 //      String ysize = Integer.toString(400+number*100);
00434        return _resources.createActionLink("chart", false, new Object[]{xsize,ysize,numberRunStart,number,getXscale(),getYscale()});
00435     }

XYIntervalSeries getDataSeries ( YAxis  yaxis,
int  xid,
String  xscale,
String  yscale,
Boolean  systematics 
)

Definition at line 438 of file ReactionPlot.java.

Referenced by ReactionPlot.getChart3().

00438                                                                                                                {
00439         XAxis _xaxis =  yaxis.getDataset().getXAxis(xid);
00440         titlestring=titlestring.concat("\n" + yaxis.getDataset().getId().toString() + "/" + yaxis.getId().toString());
00441         for (String comment : yaxis.getDataset().getComments()){
00442              if(comment.startsWith("Location:")){
00443                  titlestring=titlestring.concat(" - " + comment);
00444              }
00445              else{
00446                  caption=comment;
00447              }
00448         }
00449         XYIntervalSeries series = new  XYIntervalSeries(" ");
00450 //      if(!systematics){series.setKey(caption);}
00451 //       series.setKey(caption);
00452        series.setKey(yaxis.getDataset().getId().toString() + "/" + yaxis.getId().toString());
00453        for (int ip=1; ip<=yaxis.getPoints().size(); ip++){
00454             try{
00455             double y = yaxis.getPoint(ip).getValue();
00456             double eplus = 0.0;
00457             double eminus = 0.0;
00458             for (Uncertainty e : yaxis.getPoint(ip).getErrors()){
00459                Boolean use = true;
00460                if(e.getSourceType().toString().equals("systematic") && !systematics) { use = false; }
00461                if(use) {
00462                    if(e.getNormType() == ErrorNorm.PCT){
00463                      eplus = eplus + (y*e.getPlus()/100.0)*(y*e.getPlus()/100.0);
00464                      eminus = eminus + (y*e.getMinus()/100.0)*(y*e.getMinus()/100.0);
00465                    } 
00466                    else{
00467                      eplus = eplus + e.getPlus()*e.getPlus(); 
00468                      eminus = eminus - e.getMinus()*e.getMinus();
00469                    }
00470                }
00471             }
00472             eplus = Math.sqrt(eplus);
00473             eminus = Math.sqrt(eminus);
00474             double yhigh = y + eplus;
00475             double ylow = y - eplus;
00476             double x;
00477             double xhigh;
00478             double xlow;
00479             if(_xaxis.getBin(ip).getLowValue() != null  && _xaxis.getBin(ip).getHighValue() != null){
00480                 x = (_xaxis.getBin(ip).getLowValue()+_xaxis.getBin(ip).getHighValue())/2;
00481                 xlow =  _xaxis.getBin(ip).getLowValue();
00482                 xhigh =  _xaxis.getBin(ip).getHighValue();
00483             }
00484             else{
00485                 x = _xaxis.getBin(ip).getFocus();
00486                 xhigh = _xaxis.getBin(ip).getFocus();
00487                 xlow = _xaxis.getBin(ip).getFocus();
00488             }
00489             if(xscale.equals("lin") && yscale.equals("lin") )                             {series.add(x,xlow,xhigh,y,ylow,yhigh);}
00490             if(xscale.equals("log") && yscale.equals("lin") &&  xlow > 0.0 )              {series.add(x,xlow,xhigh,y,ylow,yhigh);}
00491             if(xscale.equals("lin") && yscale.equals("log") &&  ylow > 0.0 )              {series.add(x,xlow,xhigh,y,ylow,yhigh);}
00492             if(xscale.equals("log") && yscale.equals("log") &&  ylow > 0.0 && xlow > 0.0) {series.add(x,xlow,xhigh,y,ylow,yhigh);}
00493            } catch(Exception e){}
00494         }
00495         return series;
00496     }

StreamResponse onChart ( final int  width,
final int  height,
final int  numberRunStart,
int  number,
String  _xscale,
String  _yscale 
)

Definition at line 499 of file ReactionPlot.java.

References ReactionPlot.saveChartAsPDF().

00499                                                                                                                                            {
00500  
00501 //        String _yscale=_yscalein;
00502         final XYIntervalSeriesCollection collection = new XYIntervalSeriesCollection();
00503         double xlow = 1000000.0;
00504         double xhigh = -1000000.0;
00505         double ylow = 1000000.0;
00506         double yhigh = -1000000.0;
00507         for (int n=1; n<=number; n++){
00508             
00509             XYIntervalSeries series = (XYIntervalSeries) seriesMap.get(numberRunStart+n);
00510             int nitems = series.getItemCount();
00511             for (int nn=0; nn<nitems; nn++){
00512               if(series.getXLowValue(nn) < xlow){ xlow = series.getXLowValue(nn);};     
00513               if(series.getXHighValue(nn) > xhigh){ xhigh = series.getXHighValue(nn);};     
00514               if(series.getYLowValue(nn) < ylow){ ylow = series.getYLowValue(nn);};     
00515               if(series.getYHighValue(nn) > yhigh){ yhigh = series.getYHighValue(nn);};     
00516             }
00517 //          double ratio=yhigh/ylow;
00518 //          if(_yscalein.equals("auto") && ratio > 100) { _yscale="log";} else {_yscale="lin";}
00519             seriesMap.remove(numberRunStart+n);
00520             collection.addSeries(series);
00521         }
00522         xlow = xlow - 0.05*(xhigh-xlow);
00523         xhigh = xhigh + 0.05*(xhigh-xlow);
00524         ylow = ylow - 0.05*(yhigh-ylow);
00525         yhigh = yhigh + 0.05*(yhigh-ylow);
00526         if(xlow == xhigh){
00527               xlow = 0.90*xlow;
00528               xhigh= 1.10*xhigh;
00529         }
00530         IntervalXYDataset data1 = collection;
00531  
00532 //        final XYItemRenderer renderer1 = new XYErrorRenderer();
00533         final XYErrorRenderer renderer1 = new XYErrorRenderer();
00534         renderer1.setCapLength(3); 
00535         final Range rangex = new Range(xlow,xhigh);
00536         final Range rangey = new Range(ylow,yhigh);
00537 
00538         NumberAxis rangeAxisX = null;
00539         if(_xscale.equals("lin")){
00540             rangeAxisX = new NumberAxis();
00541             rangeAxisX.setRange(rangex);
00542         } else{
00543             LogarithmicAxis logaxistemp = new LogarithmicAxis("header");
00544             rangeAxisX = logaxistemp;
00545         }
00546         try {
00547             String xlabel = (String) xLabelMap.get(numberRunStart+1);
00548             rangeAxisX.setLabel(xlabel);
00549         } 
00550         catch(Exception e){          
00551             rangeAxisX.setLabel("xaxis label ?");
00552         }
00553 //        rangeAxisX.setAutoRangeIncludesZero(false);
00554 
00555         NumberAxis rangeAxisY = null;        
00556         if(_yscale.equals("lin")) {
00557            rangeAxisY = new NumberAxis();
00558            rangeAxisY.setRange(rangey);
00559         } else{
00560            LogarithmicAxis logaxistemp = new LogarithmicAxis(_yaxis.getHeader());
00561 //           LogarithmicAxis logaxistemp = new LogarithmicAxis("abc");
00562 //           logaxistemp.setAllowNegativesFlag(true);
00563 //           logaxistemp.setStrictValuesFlag(false);
00564 //           logaxistemp.setAutoRangeNextLogFlag(true);
00565            rangeAxisY = logaxistemp;
00566         }       
00567         try{
00568             String ylabel = (String) yLabelMap.get(numberRunStart+1);
00569             rangeAxisY.setLabel(ylabel);
00570         }
00571         catch (Exception e){
00572              rangeAxisY.setLabel("yaxis label ?");
00573         }
00574         final XYPlot subplot1 = new XYPlot(data1, rangeAxisX, rangeAxisY, renderer1);
00575         final TextTitle title = new TextTitle(titlestring);
00576         title.setTextAlignment(HorizontalAlignment.LEFT);
00577         final JFreeChart chart = new JFreeChart(subplot1);
00578         chart.addSubtitle(title);
00579         System.out.println("pdfselect: " + _pdfselect + " pdfname: " + _pdfname);
00580         if(_pdfselect != null && _pdfselect.equals("yes")){
00581             if(_pdfname != null && !_pdfname.equals("")){
00582                 File filename = new File(_pdfname);
00583                 try {
00584                    saveChartAsPDF(filename, chart, 500, 500);
00585 //                   saveChartAsPDF( filename, chart, Integer.parseInt(_pdfwidth), Integer.parseInt(_pdfheight) );
00586                 } catch (IOException ie) { 
00587                   //
00588                 }
00589             }
00590         }
00591         return new StreamResponse(){
00592             public String getContentType(){
00593                 return "image/png";
00594             }
00595             public InputStream getStream() throws IOException {
00596                 BufferedImage image  = chart.createBufferedImage(width, height);
00597                 ByteArrayOutputStream byteArray = new ByteArrayOutputStream() ;
00598                 ChartUtilities.writeBufferedImageAsJPEG(byteArray, image) ;
00599                 return new ByteArrayInputStream(byteArray.toByteArray());
00600             }
00601             public void prepareResponse(Response response){}
00602         };
00603     }

static void saveChartAsPDF ( File  file,
JFreeChart  chart,
int  width,
int  height 
) throws IOException [static]

Definition at line 604 of file ReactionPlot.java.

References ReactionPlot.writeChartAsPDF().

Referenced by ReactionPlot.onChart().

00607                                                                     {
00608        OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
00609        writeChartAsPDF(out, chart, width, height);
00610        out.close();
00611     }

static void writeChartAsPDF ( OutputStream  out,
JFreeChart  chart,
int  width,
int  height 
) throws IOException [static]

Definition at line 612 of file ReactionPlot.java.

Referenced by ReactionPlot.saveChartAsPDF().

00614                                                                                 {
00615        Rectangle pagesize = new Rectangle(width,height);
00616        Document document = new Document(pagesize, 50, 50, 50, 50);
00617        try {
00618            PdfWriter writer = PdfWriter.getInstance(document, out);
00619            document.addAuthor("JFreeChart");
00620            document.open();
00621            PdfContentByte cb = writer.getDirectContent();
00622            Graphics2D g2 = cb.createGraphics(width, height);
00623            Rectangle2D r2D = new Rectangle2D.Double(0, 0, width, height);
00624            chart.draw(g2, r2D, null);
00625            g2.dispose();
00626        }
00627        catch(DocumentException de){
00628           System.err.println(de.getMessage());
00629        }
00630        document.close();
00631     }

Object onSubmitFromSavePlot (  )  [package]

Definition at line 636 of file ReactionPlot.java.

00637     {
00638         return nextPage;
00639     }

void onsubmitFromSavePage (  )  [package]

Definition at line 641 of file ReactionPlot.java.

References ReactionPlot.getDsId(), ReactionPlot.getHepId(), ReactionPlot.getQueryString(), ReactionPlot.getSys(), ReactionPlot.getXId(), ReactionPlot.getXscale(), ReactionPlot.getYId(), and ReactionPlot.getYscale().

00642     {
00643         this.setHepId(); 
00644         saveplot.setHepId(getHepId());
00645         saveplot.setDsId(getDsId());
00646         saveplot.setYId(getYId());
00647         saveplot.setXId(getXId());
00648         saveplot.setYscale(getYscale());
00649         saveplot.setXscale(getXscale());
00650         saveplot.setSys(getSys());
00651         saveplot.setQueryString(getQueryString());
00652         nextPage=SavePlot.class;
00653     }


The documentation for this class was generated from the following file:


Generated on Tue Apr 21 15:55:05 2009 for HepData Web servlets by  doxygen 1.5.5