Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

HTMLPaperWriter Class Reference

Inheritance diagram for HTMLPaperWriter:

Inheritance graph
[legend]
Collaboration diagram for HTMLPaperWriter:

Collaboration graph
[legend]
List of all members.

Detailed Description

A bundle of utilities for producing HTML output for JetWeb applications.

Author:
Jon Butterworth
Version:
Date
2006-02-28 21:12:05 +0000 (Tue, 28 Feb 2006)
Revision
1025

Definition at line 46 of file HTMLPaperWriter.java.


Public Member Functions

 HTMLPaperWriter (PrintWriter out, String newservletpath)
 HTMLPaperWriter (String fname, String newservletpath)
void writePaperForm (Paper paper, String message)
void writePlotsForm (Paper paper, String message) throws JetWebException
void display (Paper paper) throws JetWebException
void display (Paper paper, Fit fit) throws JetWebException
void display (Object object) throws JetWebException
void setNumberFormat (NumberFormat form)
void setDateFormat (SimpleDateFormat form)
BufferedWriter getWriter ()
void close ()
void setHidden (boolean hide)
void setModifiable (boolean mod)
void setVerbose (boolean verb)
void startControlForm ()
void startControlForm (String message)
void startForm ()
void endForm ()
void searchByXML ()
void makeActionButtons ()
void makeSubmitButtons ()
void makeRequestForm (ResultSearchPattern pattern) throws JetWebException
void makeControlForm ()
void writeOkCancel ()
void writeDirChoiceForm (String suggestion)
void listPendingJobs ()
void listHiddenPars (ResultSearchPattern pattern)
void forwardTo (String htmlPath)
void writeInputId (String text, String name, String hover, Integer id) throws JetWebException
void makeCommonForm (ResultSearchPattern pattern) throws JetWebException
synchronized void displayList (List<?> list) throws JetWebException
void write (String str) throws JetWebException
void endListPage (String resultKey)
void writeTopMessage (String message) throws JetWebException
void writeTitle (String title) throws JetWebException

Static Public Member Functions

void writePaperScreen (String paperIdString, PrintWriter out, String servletPath)
String getLink (Paper paper)
void writeGraphics (final Map< Integer, Paper > papers, Fit fit)
HTMLWriter makeWriter (PrintWriter out, String newServletPath, Object o) throws JetWebException

Protected Member Functions

void openForm (String method, String action) throws IOException
void openForm (String method, String action, String extra) throws IOException
void openForm () throws IOException
void closeForm () throws IOException

Protected Attributes

String servletPath
BufferedWriter ofile
SimpleDateFormat dateFormat
boolean modifiable = false
boolean hidden = false
boolean verbose = false
Integer forms_ = 0

Static Protected Attributes

final int LISTLENGTH = 10
NumberFormat dform

Private Member Functions

void writePlotEntry (Paper paper, DataPlot plot) throws IOException, JetWebException
void writeNewPlotEntry (Paper paper, String label) throws IOException, JetWebException
void writeSwitchForm (PlotSwitch ps, String label, Collision collision) throws IOException, JetWebException

Constructor & Destructor Documentation

HTMLPaperWriter PrintWriter  out,
String  newservletpath
 

Definition at line 48 of file HTMLPaperWriter.java.

Referenced by HTMLPaperWriter.writePaperScreen().

00048                                                                   {
00049     super(out,newservletpath);
00050     }

HTMLPaperWriter String  fname,
String  newservletpath
 

Definition at line 51 of file HTMLPaperWriter.java.

00051                                                                {
00052     super(fname,newservletpath);
00053     }


Member Function Documentation

void close  )  [inherited]
 

Method to close the buffered writer.

Definition at line 196 of file HTMLWriter.java.

Referenced by HTMLUtils.displayList(), HTMLUtils.displayListContinued(), Searcher.doGet(), Maintainer.doGet(), ServletUtils.editFit(), HTMLFitWriter.endFitPage(), HTMLUtils.listPendingJobs(), FileUploader.upload(), HTMLFitWriter.writeCompareFitsPage(), HTMLUtils.writeControlScreen(), HTMLFitWriter.writeFitPage(), HTMLUtils.writeJobRequestForm(), HTMLPaperWriter.writePaperScreen(), HTMLUtils.writeParameterScreen(), HTMLUtils.writeProcScreen(), HTMLUtils.writeQueryScreen(), and HTMLUtils.writeSelectPlotsPage().

00196                        {
00197 
00198     try {
00199         ofile.close();
00200     }    
00201     catch (IOException e) {
00202         System.out.println("Could not open file "+e);
00203     }
00204     System.out.println("Done");
00205     }

void closeForm  )  throws IOException [protected, inherited]
 

closes the form tag if: number of forms we tried to open - number we tried to close = 1

Definition at line 1029 of file HTMLWriter.java.

References HTMLWriter.write().

Referenced by HTMLProcessWriter.addNewProcess(), HTMLProcessWriter.display(), HTMLPlotWriter.display(), HTMLPaperWriter.display(), HTMLModelWriter.display(), HTMLFitWriter.display(), HTMLFitWriter.writeFitEditForm(), HTMLPaperWriter.writePaperForm(), and HTMLFitWriter.writeVerbose().

01030                        {
01031     if(forms_<=0) return;
01032     --forms_;
01033     if(forms_==0){
01034         ofile.write("</form>");
01035         formAction_ = "";
01036     }
01037 
01038     return;
01039     }

void display Object  object  )  throws JetWebException
 

Override Object display.

Reimplemented from HTMLWriter.

Definition at line 711 of file HTMLPaperWriter.java.

00711                                                               {
00712     try {
00713         display((Paper)object,null);
00714     } catch (ClassCastException e) {
00715         throw new JetWebException(e);
00716     }
00717     }

void display Paper  paper,
Fit  fit
throws JetWebException
 

Write a Paper to HTML.

Parameters:
paper - the Paper to write.
fit - the fit of this paper (may be null).

Definition at line 590 of file HTMLPaperWriter.java.

References HTMLWriter.closeForm(), HTMLPlotWriter.display(), HTMLWriter.openForm(), HTMLWriter.setVerbose(), and HTMLWriter.write().

00591                            {
00592 
00593     //System.out.println("Writing paper: "+paper.getReference());
00594 
00595     try {
00596 
00597         if (!verbose) {
00598 
00599         openForm("post",servletPath);
00600         ofile.write("JetWeb ID : "+paper.getId());
00601         ofile.write(" <b>"+paper.getTitle()+"</b> : "
00602                 +HTMLPaperWriter.getLink(paper)+" : ");
00603         ofile.write("<input type='hidden' name='PAPERID' value='"+paper.getId()+"'>");  
00604         if (fit!=null){
00605             ofile.write("<input type='hidden' name='FITID' value='"+fit.getId()+"'>");  
00606         }
00607         ofile.write(HTMLUtils.writeSubmitButton("PAPER",
00608                             "More details on this paper.",
00609                             "More"));       
00610         closeForm();
00611         return;
00612         }
00613 
00614         ofile.write("<div class='jetweb-paper'>");
00615         ofile.write("<table width='100%'><tr>");
00616         ofile.write("<td colspan='2'><p>ID:"+paper.getId()
00617             +" <b>"+paper.getTitle()+"</b></p></td>");
00618         ofile.write("<td><p>"+HTMLPaperWriter.getLink(paper)+"</p></td>");
00619         ofile.write("</tr>");
00620 
00621         ofile.newLine();
00622         ofile.write("<tr>");
00623 
00624         ofile.write("<td><p>Code author(s): "+paper.getCodeAuthor()+"</p></td>");
00625         ofile.write("<td><p>Contact: "+paper.getContact()+"</p>");
00626         ofile.write("</tr>");
00627     
00628         ofile.newLine();
00629         ofile.write("<tr>");
00630 
00631         /*      
00632         StringBuffer imagePath = new StringBuffer(JetWebConfig.plotCacheDirName);
00633         if (fit!=null) {
00634         imagePath.append("/"+fit.getId());
00635         }
00636         imagePath.append("/"+paper.getDirName());
00637         */
00638 
00639         HTMLPlotWriter plotWriter = new HTMLPlotWriter(ofile,servletPath);
00640         plotWriter.setVerbose(true);
00641         //plotWriter.setImagePath(imagePath.toString());
00642 
00643         Vector<Integer> fitPlots = null;
00644         
00645         if(fit!=null){
00646         fitPlots = fit.getPlotSelection().getPlotIds();
00647         }
00648         
00649         System.out.println("fitPlots = " + fitPlots);
00650 
00651         for (DataPlot plot : paper.getPlots()){
00652 
00653         // only write the plot if it is in the fit and the paper
00654         // (unless the fit is null)
00655         if(fit==null || fitPlots.contains(plot.getId())){
00656 
00657             System.out.println("displaying plot " + plot.getId());
00658 
00659             ofile.write("<tr><td colspan='3'>");
00660             plotWriter.display(plot,fit);
00661             ofile.write("</td></tr>");
00662             ofile.newLine();
00663             ofile.write
00664             ("<tr><td colspan='3'>"+
00665              "<hr noshade size='3'/></td></tr>");
00666         }
00667         }
00668 
00669         ofile.write("</table>");
00670 
00671     }
00672     catch (IOException e) {
00673         System.out.println("Could not open output stream for this paper."+e);
00674     }
00675     }

void display Paper  paper  )  throws JetWebException
 

Write a Fitted Paper to html.

Definition at line 581 of file HTMLPaperWriter.java.

Referenced by Searcher.doGet().

00581                                                             {
00582     display(paper,null);
00583     }

synchronized void displayList List<?>  list  )  throws JetWebException [inherited]
 

Write the first LISTLENGTH elements of a list of objects and remove them from List.

Parameters:
List to write out

Definition at line 843 of file HTMLWriter.java.

Referenced by HTMLUtils.displayList(), HTMLUtils.displayListContinued(), and Searcher.doGet().

00844                            {
00845 
00846     //needs to delete them too
00847     Iterator<? extends Object> iterator = list.iterator();
00848     int count=0;
00849     Vector<Object> deleteList = new Vector<Object>();
00850     while (iterator.hasNext() && count<LISTLENGTH){
00851         Object next = iterator.next(); 
00852         display(next);
00853         deleteList.add(next);
00854         count++;
00855 
00856     }
00857 
00858     //now remove the fits that have been listed
00859     Enumeration<? extends Object> del = deleteList.elements();
00860     while (del.hasMoreElements()){
00861         list.remove(del.nextElement());
00862     }
00863 
00864     }

void endForm  )  [inherited]
 

End form.

Definition at line 270 of file HTMLWriter.java.

Referenced by Maintainer.doGet(), HTMLUtils.listPendingJobs(), HTMLUtils.writeJobRequestForm(), HTMLUtils.writeParameterScreen(), HTMLUtils.writeProcScreen(), HTMLUtils.writeQueryScreen(), and HTMLUtils.writeSelectPlotsPage().

00270                          {
00271     try {
00272         closeForm();
00273         //ofile.write("</form>");
00274     } catch ( IOException e ) {
00275         System.out.println("problem writing form");
00276         return;
00277     }
00278     }

void endListPage String  resultKey  )  [inherited]
 

Write footer for a list of Fits with a forward link based on the fitKey

Definition at line 887 of file HTMLWriter.java.

References HTMLWriter.write().

Referenced by HTMLUtils.displayList(), and HTMLUtils.displayListContinued().

00887                                              {
00888         try {
00889         openForm();
00890         //ofile.write("<form>");
00891         ofile.write("<input type='SUBMIT' name='MORERESULTS' value='Next Results'>");
00892         ofile.write("<input type='HIDDEN' name='RESULTKEY' value='"+resultKey+"'>");
00893         ofile.write("<input type='HIDDEN' name='VERBOSE' value='"+verbose+"'>");
00894         ofile.write("<input type='HIDDEN' name='MODIFIABLE' value='"+modifiable+"'>");
00895         closeForm();
00896         //ofile.write("</form>");
00897     } catch ( IOException e ) {
00898         System.out.println("problem end of list page");
00899         return;
00900     }
00901     }

void forwardTo String  htmlPath  )  [inherited]
 

Write the necessary HTML to forward to use to the page at htmlPath.

Definition at line 698 of file HTMLWriter.java.

References HTMLWriter.write().

00698                                           {
00699 
00700     try {
00701         ofile.write("<head><meta http-equiv=\"refresh\" content=\"0;URL="+
00702             htmlPath+"\"></head>");
00703         ofile.newLine();
00704         close();
00705     } catch ( IOException e ) {
00706         System.out.println("problem writing form");
00707         return;
00708     }
00709     }

String getLink Paper  paper  )  [static]
 

return an http link to the paper on Spires.

Definition at line 84 of file HTMLPaperWriter.java.

References Paper.getIRN().

00084                                              {
00085 
00086     return "<A href='http://"+JetWebConfig.spiresURL
00087         +"/cgi-bin/spiface/hep/www?rawcmd=find+irn+"
00088         +paper.getIRN()+"'>SPIRES Reference</A>";
00089 
00090     }

BufferedWriter getWriter  )  [inherited]
 

Return the buffered writer.

Definition at line 190 of file HTMLWriter.java.

Referenced by HTMLFitWriter.comparePlots(), HTMLFitWriter.writeCompareFitsPage(), HTMLFitWriter.writeFitPage(), and HTMLUtils.writeQueryScreen().

00190                                      {
00191     return ofile;
00192     }

void listHiddenPars ResultSearchPattern  pattern  )  [inherited]
 

Add the generic parameters from the ResultSearchPattern to the HTML form as hidden inputs.

Parameters:
pattern 

Definition at line 674 of file HTMLWriter.java.

References ResultSearchPattern.getGenerator(), ResultSearchPattern.getPhotonPDF(), ResultSearchPattern.getProtonPDF(), and HTMLWriter.write().

00674                                                            {
00675 
00676     try {
00677         ofile.write("<input type='HIDDEN' name='GENERATOR' value='"+pattern.getGenerator().getName()+"-"+pattern.getGenerator().getVersion()+"'>");
00678         ofile.newLine();
00679         ofile.write("<input type='HIDDEN' name='PHOTONPDF' value='"+pattern.getPhotonPDF()+"'>");
00680         ofile.newLine();
00681         ofile.write("<input type='HIDDEN' name='PROTONPDF' value='"+pattern.getProtonPDF()+"'>");
00682 
00683     } catch ( IOException e ) {
00684         System.out.println("problem writing form");
00685         e.printStackTrace();
00686         return;
00687     } catch (JetWebException jwe){
00688         System.out.println("problem writing form");
00689         jwe.printStackTrace();
00690         return;
00691     }
00692     }

void listPendingJobs  )  [inherited]
 

Write list of pending jobs.

Definition at line 639 of file HTMLWriter.java.

References PendingJob.getDate(), PendingJob.getName(), PendingJob.getScriptName(), and HTMLWriter.write().

Referenced by HTMLUtils.listPendingJobs().

00639                                  {
00640     
00641     try {
00642         Enumeration pending = JobUtils.selectPendingJobs();
00643 
00644         closeForm();
00645 
00646         //ofile.write("</FORM>");
00647 
00648         int count = 0;
00649         while (pending.hasMoreElements()){
00650         
00651         PendingJob pj = (PendingJob)pending.nextElement();
00652 
00653         count++;
00654         ofile.write("<TR><TD COLSPAN=2>");
00655         ofile.newLine();
00656         ofile.write("<P><B>"+count+": "+pj.getName()+"</B> :");
00657         ofile.write(" Requested at "+pj.getDate()+". Run script is "
00658                 +pj.getScriptName()+"</P>");
00659         ofile.newLine();
00660         }
00661     } catch (JetWebException e){
00662         HTMLErrorWriter.write(ofile,e);
00663     } catch (Exception e) {
00664         System.out.println("error:"+e.getMessage());
00665     }
00666     }

void makeActionButtons  )  [inherited]
 

Write out the HTML search toolbar.

Definition at line 315 of file HTMLWriter.java.

Referenced by HTMLUtils.writeParameterScreen(), HTMLUtils.writeQueryScreen(), and HTMLUtils.writeSelectPlotsPage().

00315                                    {
00316     try {
00317         
00318         ofile.write("<div class='actionbuttons'>");
00319         ofile.newLine();
00320         ofile.write(HTMLUtils.writeSubmitButton("GETMODELS",
00321                             "Search for models matching the criteria specified",
00322                             "Get Models"));
00323         ofile.newLine();
00324         ofile.write(HTMLUtils.writeSubmitButton("GETFITS",
00325                             "Search for fits matching the specified criteria",
00326                             "Get Fits"));
00327         ofile.newLine();
00328         ofile.write(HTMLUtils.writeSubmitButton
00329             ("CLEARALL",
00330              "Clear all selections",
00331              "Reset"));
00332         ofile.newLine();
00333         ofile.write(HTMLUtils.writeSubmitButton
00334             ("DEFAULT",
00335              "Set all parameters to their default values",
00336              "Default"));
00337         ofile.newLine();
00338         ofile.write("<br>");
00339         ofile.write("</div>");
00340 
00341     } catch ( IOException e ) {
00342         System.out.println("problem writing form");
00343         return;
00344     }
00345     }

void makeCommonForm ResultSearchPattern  pattern  )  throws JetWebException [inherited]
 

Definition at line 743 of file HTMLWriter.java.

References HTMLWriter.write().

Referenced by HTMLUtils.writeParameterScreen().

00743                                                                                    {
00744 
00745     try { 
00746 
00747         ofile.write("<table cellpadding=\"4\" rules=\"cols\">");
00748         ofile.write("<tr><td colspan=\"8\"> <p><b>Common parameters</b></p>");
00749         ofile.write("<tr align=\"top\">");
00750         ofile.newLine();
00751         ofile.write("<td align=\"top\"><table align=\"top\"><tr align=\"top\"><td colspan=\"2\"><P>Generator</P>");
00752         ofile.newLine();
00753         boolean none = true;
00754         Generator gen = pattern.getGenerator();
00755         
00756         for (String name : Generator.allNames() ) {
00757         ofile.write("<tr><td align='right'>");
00758         ofile.write("<b>"+name+" </b>");
00759 
00760         TreeSet<String> allVersions = 
00761             new TreeSet(Generator.allVersions(name));
00762 
00763         for (String version : allVersions ) {
00764             ofile.write("<td>" + version + 
00765                 "<input type='checkbox' ");
00766             ofile.write("name='GENERATOR' value='"+name+"-"+version+"'");
00767             if (gen!=null && 
00768             gen.getName().equals(name) && 
00769             gen.getVersion().equals(version)){
00770             ofile.write(" checked ");
00771             }
00772             ofile.write("/></td>");
00773             ofile.newLine();
00774         }
00775         }
00776         ofile.write("</table>");
00777         
00778         ofile.newLine();
00779         ofile.write("<td align='top'><table><tr><td colspan='2'><P>Photon PDF</P>");
00780         ofile.newLine();
00781         none = true;
00782 
00783         Vector<PDF> knownPDFs = PDF.getKnownPDFs();
00784 
00785         Vector<PDF> knownProtonPDFs = new Vector<PDF>();
00786         Vector<PDF> knownPhotonPDFs = new Vector<PDF>();
00787 
00788         for(PDF pdf: knownPDFs){
00789         if(pdf.isPhoton()) knownPhotonPDFs.add(pdf);
00790         if(pdf.isProton()) knownProtonPDFs.add(pdf);
00791         }
00792 
00793         for(PDF pdf: knownPhotonPDFs){
00794         ofile.write("<tr><td align='right'>");
00795         ofile.write(pdf.getName()+"</td>");
00796                 ofile.write("<td><input type='checkbox' ");
00797         if(pattern.getPhotonPDFList().contains(pdf)&&none){
00798             ofile.write(" checked ");
00799             none = false;
00800         }
00801         ofile.write("name='PHOTONPDF' value='"+pdf.getName()+"'>");
00802         ofile.write("</td></tr>");
00803         ofile.newLine();        
00804         }
00805         ofile.write("</tr>");
00806         ofile.write("</table>");
00807         ofile.write
00808         ("<td align='top'> <table><tr><td colspan='2'><p>Proton PDF</p>");
00809         ofile.newLine();
00810         none = true;
00811 
00812         for(PDF pdf: knownProtonPDFs){
00813         ofile.write("<tr><td align='RIGHT'>");
00814         ofile.write(pdf.getName() + "</td>");
00815                 ofile.write("<td><input type='checkbox' ");
00816         if(pattern.getProtonPDFList().contains(pdf)&&none){
00817             ofile.write(" checked ");
00818             none = false;
00819         }
00820         ofile.write("name='PROTONPDF' value='"+pdf.getName()+"'>");
00821         ofile.write("</td></tr>");
00822         ofile.newLine();
00823         }
00824 
00825         ofile.write("</table>");
00826         
00827         ofile.write("<tr><td colspan='8'><hr noshade size='3'>");
00828         
00829         ofile.write("</table>");
00830     
00831     } catch (IOException ioe) {
00832         ioe.printStackTrace(System.out);
00833         throw new JetWebException(ioe);
00834     }
00835     }

void makeControlForm  )  [inherited]
 

Write out the top-level maintenance options form.

Definition at line 435 of file HTMLWriter.java.

References HTMLWriter.write().

Referenced by HTMLUtils.writeControlScreen().

00435                                  {
00436     
00437     try {
00438 
00439         ofile.write("<div class='jetweb-buttons'>");
00440 
00441         ofile.newLine();    
00442         openForm("POST", servletPath);
00443         //ofile.write("<form method='post' action='"+servletPath+"'>");
00444 
00445         ofile.write("<table><tbody>");
00446         ofile.newLine();        
00447         /*
00448         ofile.write("<tr>");
00449         ofile.write("<td valign='top'><p>Rewrite webpages</p></td>");
00450         ofile.write("<td align='middle' valign='middle'>");     
00451         ofile.write("<input type='submit' name='REDO' value='GO'></td></tr>");
00452         ofile.newLine();
00453         */
00454         ofile.write("<tr>");
00455         ofile.write("<td><p>Process any new data in the input directory</p></td>");
00456         ofile.write("<td align='right'>");
00457         ofile.write("<INPUT TYPE=SUBMIT NAME='PROCESSNEW' VALUE=\"GO\"></TD></TR>");
00458         ofile.newLine();
00459 
00460         ofile.write("<tr>");
00461         ofile.write("<td><p>Manage MCProcessTypes</p></td>");
00462         ofile.write("<td align='right'>");
00463         ofile.write("<input type='submit' name='PROCESSTYPE' value='GO'></td></tr>");
00464         ofile.newLine();
00465 
00466         /*
00467         ofile.write("<tr>");
00468         ofile.write("<td><p>Search or submit new job</P></TD>");
00469         ofile.write("<td align='right'>");
00470         ofile.write("<input type='submit' name='SEARCH' value='GO'></td></tr>");
00471         ofile.newLine();
00472         */
00473         ofile.write("<tr>");
00474         ofile.write("<td><p>List submitted jobs which have not yet returned.</p></td>");
00475         ofile.write("<td align='right'>");
00476         ofile.write("<input type='submit' name='PENDING' VALUE='GO'></td></tr>");
00477 
00478 
00479         ofile.write("<tr>");
00480         ofile.write("<td><p>Edit fit with ID</P></TD><TD align='left'>");
00481         ofile.write("<input type='text' name='FITID' width='5'></p></td>");
00482             ofile.write("<td align='right'>");
00483         ofile.write("<input type='submit' name='FITFIX' value='GO'></td></tr>");
00484 
00485             ofile.write("<tr>");
00486         ofile.write("<td><p>Modify a paper (give the ID)</p></td><td align='left'>");
00487         ofile.write("<input type='text' name='PAPERID' width='5'></p></td>");
00488             ofile.write("<td align='right'>");
00489         ofile.write("<input type='submit' name='PAPERMOD' value='GO'></td></tr>");
00490 
00491         ofile.write("<tr>");
00492         ofile.write("<td><p>Add a new paper</p></td>");
00493         ofile.write("<td align='right'>");
00494         ofile.write("<input type='submit' name='PAPERADD' value='GO'></td></tr>");
00495         ofile.write("<tr>");
00496 
00497         /*
00498         ofile.write("<td><p>Recalculate generated integrated luminosity</p></td>");
00499         ofile.write("<td align='right'>");
00500         ofile.write("<input type='submit' name='FIXLUMI' value='GO'></td></tr>");
00501         */
00502 
00503         ofile.write("</tbody></table>");
00504         closeForm();
00505         //ofile.write("</form>");
00506         openForm("POST", JetWebConfig.uploadServletPath, 
00507              "enctype='multipart/form-data'");
00508         //ofile.write
00509         //("<form enctype='multipart/form-data' method='post' action='"
00510         // + JetWebConfig.uploadServletPath + "'>");
00511 
00512         ofile.write("<table><tbody>");
00513         ofile.write("<tr>");
00514         ofile.write
00515         ("<td><p>Add a new generator default from an XML file</p></td>");
00516         ofile.write("<td align='right'>");
00517         ofile.write("<input type='hidden' name='DEFAULTSUPLOAD'>");
00518         ofile.write("<input type='hidden' name='DIRECTORY' value=" + 
00519             JetWebConfig.jobOutDirName+ "/>");
00520         ofile.write
00521         ("<input type='file' name='XMLDEFAULTS'></p></td>");
00522 
00523         ofile.write("<td align='right'>");
00524         ofile.write("<input type='submit' name='DEFAULTSMOD' value='GO'></TD></TR>");
00525         ofile.write("</tbody></table>");
00526 
00527         closeForm();
00528         //ofile.write("</form>");
00529         ofile.write("</div>");
00530 
00531         ofile.write("<div>");
00532         openForm("POST", servletPath);
00533         //ofile.write("<form method='post' action='"+servletPath+"'>");
00534         ofile.newLine();
00535         ofile.write("<table border='3'>");
00536 
00537         ofile.write("<tr><td colspan='6'>");
00538         ofile.write("<h3>New Configuration</h3>");
00539 
00540         ofile.newLine();
00541         ofile.write("<tr><td align='right'><p>Plot generation on:<td align=\"left\">");
00542         ofile.write("<input type='checkbox' name='PLOTS'");
00543         if (JetWebConfig.writePlots) { ofile.write(" checked ");}
00544         ofile.write(">");
00545         ofile.write("<tr>");
00546         ofile.write("<tr><td align='right'><p>Name of run subdirectory for jobs:<td align='left'>");
00547         String dname = JetWebConfig.jobOutDirName;
00548         ofile.write("<input type='text' name='RUNSUBDIR' width='24' value='"
00549             +dname+"'>");
00550 
00551         ofile.newLine();
00552         ofile.write("<tr><td><p>Batch facility:</p>");
00553 
00554         ofile.newLine();
00555         ofile.write("<td><table>"); // List of batch facilities. This is a bit clumsy!
00556         ofile.newLine();
00557         Iterator<Integer> iBatchNum = SubmitScriptHandler.batchNumbers.iterator();
00558         Iterator<String> iBatchName = SubmitScriptHandler.batchNames.iterator();
00559         while (iBatchNum.hasNext()&&iBatchName.hasNext()) {  // Should have same number of entries
00560         Integer batchNum = iBatchNum.next();
00561         String batchName = iBatchName.next();
00562         ofile.write("<TR><TD>"+batchName+"<TD><INPUT TYPE=RADIO NAME=BATCHFAC VALUE=\""
00563                 +batchNum+"\"");
00564         if (SubmitScriptHandler.BATCHFACILITY==batchNum.intValue()){
00565             ofile.write(" checked ");}
00566         ofile.write(">");
00567         ofile.newLine();
00568         }
00569         ofile.write("</table>");
00570 
00571         ofile.newLine();
00572         ofile.write("<tr>");
00573 
00574         ofile.write("<td align='right' colspan='6'>");
00575         ofile.write("<input type='submit' name='CONFIG' value='Update config'>");
00576 
00577         ofile.write("</table>");
00578         closeForm();
00579         //ofile.write("</form>");
00580         ofile.write("</div>");
00581 
00582         ofile.newLine();
00583     } catch ( IOException e ) {
00584         System.out.println("problem writing form");
00585         return;
00586     }
00587     }

void makeRequestForm ResultSearchPattern  pattern  )  throws JetWebException [inherited]
 

Construct an HTML request form containing the parameters of a ResultSearchPattern

Parameters:
pattern determines parameters for job request form.
See also:
cedar.jetweb.model.ResultSearchPattern

Definition at line 390 of file HTMLWriter.java.

References HTMLGeneratorWriter.display(), HTMLWriter.setModifiable(), HTMLWriter.setVerbose(), and HTMLWriter.write().

Referenced by HTMLUtils.writeJobRequestForm(), HTMLUtils.writeQueryScreen(), and HTMLUtils.writeSelectPlotsPage().

00390                                                                                     {
00391 
00392     try {   
00393         boolean oldModifiable = modifiable;
00394         modifiable = true;
00395         makeCommonForm(pattern);
00396         modifiable = oldModifiable;
00397         
00398         Generator gen = pattern.getGenerator();
00399         if (gen!=null) {
00400         ofile.write("<p>Model Description: ");
00401         ofile.write
00402             (HTMLUtils.writeInputBox
00403              ("DESCRIPTION", 
00404               "Write a description of the model", 
00405               pattern.getDescription()));
00406         ofile.write("</p>");
00407         
00408         ofile.write("<h4>Change the generator parameters</h4>");
00409         HTMLGeneratorWriter genOp 
00410             = new HTMLGeneratorWriter(ofile,servletPath);
00411         genOp.setModifiable(true);
00412         genOp.setVerbose(true);
00413         genOp.display(gen);
00414         ofile.newLine();
00415 
00416         } else {
00417         
00418         for (String gname: Generator.allNames()){
00419             ofile.write(HTMLUtils.writeSubmitButton("SETPARS",
00420                                 "Opens a form allowing "
00421                                 +gname+" parameters to be changed",
00422                                 gname));
00423         }
00424         }
00425     } catch ( IOException e ) {
00426         System.out.println("problem writing form");
00427         return;
00428     }       
00429     }

void makeSubmitButtons  )  [inherited]
 

Write out the HTML job submission toolbar.

Definition at line 351 of file HTMLWriter.java.

Referenced by HTMLUtils.writeJobRequestForm(), and HTMLUtils.writeParameterScreen().

00351                                    {
00352     try {
00353         
00354         ofile.write("<div class='actionbuttons'>");
00355         ofile.newLine();
00356 
00357         ofile.write("Minimum PT (GeV) for generated events ");
00358         ofile.write
00359         ("<input type='text' size='3'" + 
00360          " name='GENPTMIN' title='Enter the minimum PT to generate'>");
00361         
00362         ofile.write(HTMLUtils.writeSubmitButton("SUBMIT1",
00363                             "Submit the simulation job request",
00364                             "Submit the request"));
00365 
00366         ofile.newLine();
00367         ofile.write(HTMLUtils.writeSubmitButton("CLEARALL",
00368                             "Clear all selections",
00369                             "Reset"));
00370 
00371         ofile.newLine();
00372         ofile.write
00373         ("<input type='hidden' name='SUBMITTINGJOB' value='TRUE'>");
00374     
00375         ofile.write("</div>");
00376 
00377     } catch ( IOException e ) {
00378         System.out.println("problem writing form");
00379         return;
00380     }
00381     }

HTMLWriter makeWriter PrintWriter  out,
String  newServletPath,
Object  o
throws JetWebException [static, inherited]
 

Factory for making HTMLWriters.

Definition at line 96 of file HTMLWriter.java.

Referenced by HTMLUtils.displayList(), and HTMLUtils.displayListContinued().

00098                            {
00099 
00100     if (o instanceof DataPlot) {
00101         return new HTMLPlotWriter(out,newServletPath);
00102     } else if (o instanceof MCProcessType || o instanceof Collision) {
00103         return new HTMLProcessWriter(out,newServletPath);
00104     } else if (o instanceof Paper) {
00105         return new HTMLPaperWriter(out,newServletPath);
00106     } else if (o instanceof Fit) {
00107         return new HTMLFitWriter(out,newServletPath);
00108     } else if (o instanceof Model) {
00109         return new HTMLModelWriter(out,newServletPath);
00110     } else {
00111         return new HTMLWriter(out,newServletPath);
00112     }
00113 
00114     }

void openForm  )  throws IOException [protected, inherited]
 

open a form with no attributes

Definition at line 1006 of file HTMLWriter.java.

References HTMLWriter.write().

Referenced by HTMLProcessWriter.addNewProcess(), HTMLProcessWriter.display(), HTMLPlotWriter.display(), HTMLPaperWriter.display(), HTMLModelWriter.display(), HTMLFitWriter.display(), HTMLFitWriter.writeFitEditForm(), HTMLPaperWriter.writePaperForm(), and HTMLFitWriter.writeVerbose().

01007                        {
01008     if(!formAction_.equals("") && 
01009        !forms_.equals(0)){
01010         forms_=1;
01011         ofile.write("</form>");
01012     }else{
01013         ++forms_;
01014     }
01015 
01016     if(forms_==1){
01017         ofile.write("<form>");
01018         formAction_ = "";
01019     }
01020     
01021     return;
01022     }

void openForm String  method,
String  action,
String  extra
throws IOException [protected, inherited]
 

Opens a form element if one is not already open closes the current form if the requested attribute is not the same as the one used by the open form

Parameters:
method the method (get or post) to use
action the action to use
extra any extra attributes

Definition at line 979 of file HTMLWriter.java.

References HTMLWriter.write().

00980                         {
00981 
00982     if(!action.equals(formAction_) &&
00983        !forms_.equals(0)){
00984 
00985         forms_ = 1;
00986         ofile.write("</form>");
00987     }else{
00988         ++forms_;
00989     }
00990 
00991     if(forms_==1){
00992         ofile.write("<form method='" + 
00993             method + 
00994             "' action='" + 
00995             action + "' " + extra + ">");
00996         formAction_ = action;
00997     }
00998 
00999     return;
01000     }

void openForm String  method,
String  action
throws IOException [protected, inherited]
 

Opens a form element if one is not already open closes the current form if the requested attribute is not the same as the one used by the open form

Parameters:
method the method (get or post) to use
action the action to use

Definition at line 947 of file HTMLWriter.java.

References HTMLWriter.write().

00948                         {
00949 
00950     if(!action.equals(formAction_) &&
00951        !forms_.equals(0)){
00952         forms_ = 1;
00953         ofile.write("</form>");
00954     }else{
00955         ++forms_;
00956     }
00957 
00958     if(forms_==1){
00959         ofile.write("<form method='" + 
00960             method + 
00961             "' action='" + 
00962             action + "' >");
00963         formAction_ = action;
00964     }
00965 
00966     return;
00967     }

void searchByXML  )  [inherited]
 

write out the search using xml file field

Definition at line 284 of file HTMLWriter.java.

Referenced by HTMLUtils.writeQueryScreen().

00284                              {
00285     
00286     try{
00287         //  openForm
00288         //("POST", "..//mouse/JWUpload", "enctype='multipart/form-data");
00289         openForm("POST", 
00290              JetWebConfig.uploadServletPath, 
00291              "enctype='multipart/form-data'");
00292 
00293     ofile.write("<div class='jetweb-buttons'>");
00294     ofile.write("<input type='hidden' name='DIRECTORY' value='"+ 
00295             JetWebConfig.jobOutDirName
00296             +"'/>");
00297     ofile.write("<input type='hidden' name='MODELXML'/>");
00298     ofile.write(HTMLUtils.writeInputTag
00299             ("file", 
00300              "XMLFile", 
00301              "Search for models matching a Hepml file", ""));
00302     ofile.write("Search for models matching HepML file ");
00303     ofile.write("<input type='SUBMIT' name='SUBMITXML' value='Go'/>");
00304     ofile.write("</div>");
00305     }catch ( IOException e ) {
00306         System.out.println("problem writing form");
00307         return;
00308     }
00309     }

void setDateFormat SimpleDateFormat  form  )  [inherited]
 

Set the date format.

Definition at line 184 of file HTMLWriter.java.

00184                                                     {
00185     dateFormat = form;
00186     }

void setHidden boolean  hide  )  [inherited]
 

Write objects as hidden parameters or not.

Definition at line 210 of file HTMLWriter.java.

00210                                        {
00211     hidden = hide;
00212     if (hide) {modifiable = false;}
00213     }

void setModifiable boolean  mod  )  [inherited]
 

Write objects as modifiable parameters or not.

Definition at line 217 of file HTMLWriter.java.

Referenced by HTMLModelWriter.display(), HTMLUtils.displayList(), HTMLUtils.displayListContinued(), HTMLWriter.makeRequestForm(), HTMLUtils.writeParameterScreen(), HTMLUtils.writeQueryScreen(), and HTMLUtils.writeSelectPlotsPage().

00217                                           {
00218     modifiable = mod;
00219     if (mod) {hidden=false;}
00220     }

void setNumberFormat NumberFormat  form  )  [inherited]
 

Set the number format.

Definition at line 178 of file HTMLWriter.java.

00178                                                   {
00179     dform = form;
00180     }

void setVerbose boolean  verb  )  [inherited]
 

Write verbose versions of objects

Definition at line 224 of file HTMLWriter.java.

Referenced by HTMLPaperWriter.display(), HTMLModelWriter.display(), HTMLUtils.displayList(), HTMLUtils.displayListContinued(), Searcher.doGet(), ServletUtils.editFit(), HTMLWriter.makeRequestForm(), HTMLUtils.writeParameterScreen(), and HTMLUtils.writeSelectPlotsPage().

00224                                         {
00225     verbose = verb;
00226     }

void startControlForm String  message  )  [inherited]
 

Write out the HTML for the start of a control form with message.

Parameters:
message 

Definition at line 240 of file HTMLWriter.java.

00240                                                 {
00241     
00242     try {
00243         writeTopMessage(message);
00244 
00245     } catch ( JetWebException e ) {
00246         System.out.println("problem writing form");
00247         return;
00248     }
00249     }

void startControlForm  )  [inherited]
 

Write out the HTML for the start of a (no message) control form.

Definition at line 231 of file HTMLWriter.java.

Referenced by Maintainer.doGet(), and HTMLUtils.writeControlScreen().

00231                                   {
00232     this.startControlForm(" ");
00233     }

void startForm  )  [inherited]
 

Write out the HTML start tag for a form, with an (optional) message.

Parameters:
message to be displayed

Definition at line 256 of file HTMLWriter.java.

Referenced by HTMLUtils.listPendingJobs(), HTMLUtils.writeJobRequestForm(), HTMLUtils.writeParameterScreen(), HTMLUtils.writeProcScreen(), HTMLUtils.writeQueryScreen(), and HTMLUtils.writeSelectPlotsPage().

00256                            {
00257     
00258     try {
00259         openForm("POST", servletPath);
00260 
00261     } catch ( IOException e ) {
00262         System.out.println("problem writing form");
00263         return;
00264     }
00265     }

void write String  str  )  throws JetWebException [inherited]
 

Write a string to output.

Definition at line 869 of file HTMLWriter.java.

Referenced by HTMLWriter.closeForm(), HTMLWriter.display(), HTMLPlotWriter.display(), HTMLPaperWriter.display(), HTMLModelWriter.display(), HTMLUtils.displayList(), FileUploader.doPlotXMLUpload(), HTMLWriter.endListPage(), HTMLWriter.forwardTo(), HTMLWriter.listHiddenPars(), HTMLWriter.listPendingJobs(), HTMLWriter.makeCommonForm(), HTMLWriter.makeControlForm(), HTMLWriter.makeRequestForm(), HTMLWriter.openForm(), FileUploader.upload(), HTMLWriter.writeDirChoiceForm(), HTMLFitWriter.writeFitPage(), HTMLWriter.writeInputId(), HTMLUtils.writeJobRequestForm(), HTMLPaperWriter.writeNewPlotEntry(), HTMLWriter.writeOkCancel(), HTMLPaperWriter.writePaperScreen(), HTMLUtils.writeParameterScreen(), HTMLPaperWriter.writePlotEntry(), HTMLUtils.writeProcScreen(), HTMLUtils.writeQueryScreen(), HTMLUtils.writeSelectPlotsPage(), HTMLPaperWriter.writeSwitchForm(), HTMLWriter.writeTitle(), and HTMLWriter.writeTopMessage().

00869                                                          {
00870         
00871     try {
00872         ofile.write(str);
00873         
00874     } catch (IOException ioe) {
00875         ioe.printStackTrace(System.out);
00876         throw new JetWebException(ioe);
00877     }
00878 
00879 
00880     }

void writeDirChoiceForm String  suggestion  )  [inherited]
 

Write out run directory selection screen.

Parameters:
suggestion name for new JobFile

Definition at line 610 of file HTMLWriter.java.

References HTMLWriter.write().

00610                                                      {
00611 
00612     try {
00613         File dir = new File(suggestion);
00614         ofile.write("<tr><td colspan=4><hr noshade size=3>");
00615         if (dir.exists()){
00616         File[] list = dir.listFiles();
00617 
00618         ofile.write("<tr><td><P>Choosing one of these overrides the input box</P>");
00619         for (int i=0; i<list.length ; i++){
00620             if (list[i].isDirectory()){
00621             ofile.write("<TR><TD>");
00622             ofile.write(list[i]+" <INPUT TYPE=RADIO NAME=RUNDIR1 VALUE=\""+list[i].getPath()+"\">");
00623             ofile.newLine();
00624             }
00625         }
00626         }
00627         ofile.write("<INPUT TYPE=TEXT SIZE=40 NAME=RUNDIR VALUE="+suggestion+">");
00628 
00629     } catch ( IOException e ) {
00630         System.out.println("problem writing form");
00631         return;
00632     }
00633 
00634     }

void writeGraphics final Map< Integer, Paper papers,
Fit  fit
[static]
 

write the graphics files associated with all the papers

Definition at line 681 of file HTMLPaperWriter.java.

References Fit.getId().

00681                                                                               {
00682 
00683 
00684     if (JetWebConfig.writePlots){
00685 
00686         StringBuffer pathBuff = new StringBuffer(JetWebConfig.rootDirectory);
00687         pathBuff.append("/"+JetWebConfig.plotCacheDirName);
00688         if (fit!=null){
00689         pathBuff.append("/"+fit.getId());
00690         }   
00691         final String path = pathBuff.toString();
00692         Thread t = new Thread(new Runnable(){
00693             public void run(){ 
00694             System.out.println("Spawned writeGraphics thread");
00695             for (Paper mcPaper : papers.values()){
00696                 JetWebHist.writeGraphics(mcPaper,path);
00697             }
00698             System.out.println("Finished writeGraphics thread");
00699             } 
00700         });
00701         t.setPriority(Thread.MIN_PRIORITY);
00702         t.start();
00703         // Add to ThreadPool to avoid too many threads running at once.
00704         JetWebConfig.graphicsThreadPool.add(t); 
00705     }
00706     }

void writeInputId String  text,
String  name,
String  hover,
Integer  id
throws JetWebException [inherited]
 

Write a standard form to fetch an object with an input ID.

Parameters:
text : appears on the button
name : field name in form, has a "GET" appended to it.
hover : hover text for box and button
obj : the ID of the object to be fetched.

Definition at line 719 of file HTMLWriter.java.

References HTMLWriter.write().

Referenced by HTMLUtils.writeQueryScreen().

00720                            {
00721 
00722     try {
00723 
00724         ofile.write("<div class='idselector'>");
00725         openForm("POST", servletPath);
00726         //ofile.write("<form method='post' action='"+servletPath+"'>");
00727         ofile.write(HTMLUtils.writeSubmitButton(name+"GET",hover,text));
00728         ofile.write(HTMLUtils.writeInputBox(name,"Enter the ID",id));
00729         closeForm();
00730         //ofile.write("</form>");
00731         ofile.write("</div>");
00732 
00733         
00734     } catch (IOException ioe) {
00735         ioe.printStackTrace(System.out);
00736         throw new JetWebException(ioe);
00737     }
00738 
00739 
00740     }

void writeNewPlotEntry Paper  paper,
String  label
throws IOException, JetWebException [private]
 

Definition at line 409 of file HTMLPaperWriter.java.

References HTMLWriter.write(), and HTMLPaperWriter.writeSwitchForm().

Referenced by HTMLPaperWriter.writePlotsForm().

00409                                                                                                   {
00410 
00411     HTMLProcessWriter procWriter = new HTMLProcessWriter(ofile,servletPath);
00412     ofile.write("<tr><td colspan='3'><p>New plot </p></td></tr>");
00413     ofile.newLine();
00414     
00415     ofile.write("<tr><td><p>Title (Mandatory!):</p></td>");
00416     ofile.write("<td colspan='2'><input type='TEXT' size='70' name='TITLE-"
00417             +label+"'></p></td></tr>");
00418     ofile.newLine();
00419     
00420     ofile.write("<tr><td><p>Scale factor:</p></td>");
00421     ofile.write("<td colspan='1'><input type='TEXT' size='10' name='SCALE-"
00422             +label+"' value='1.0'></p></td></tr>");
00423     ofile.newLine();
00424     
00425     ofile.write("<tr><td><p>X label:</p></td>");
00426     ofile.write("<td colspan='1'><input type='TEXT' size='30' name='XLABEL-"
00427             +label+"'></p></td></tr>");
00428     ofile.newLine();
00429     
00430     ofile.write("<tr><td><p>Y label:</p></td>");
00431     ofile.write("<td colspan='1'><input type='TEXT' size='30' name='YLABEL-"
00432             +label+"'></p></td></tr>");
00433     ofile.newLine();
00434     
00435     ofile.write("<tr><td><p>In the default chi2?</p></td>");
00436     ofile.write("<td colspan='1'><select name='DEFSUM-"
00437             +label+"'>");
00438     ofile.write("<option value='false'>False</option>");
00439     ofile.write("<option value='true'>True</option></select></p></td></tr>");
00440     ofile.newLine();
00441     
00442     ofile.write("<tr><td><p>Is a normalised (shape) plot?</p></td>");
00443     ofile.write("<td colspan='1'><select name='ISSHAPE-"+label+"'>");
00444     ofile.write("<option value='false'>False</option>");
00445     ofile.write("<option value='true'>True</option></select></p></td></tr>");
00446     ofile.newLine();
00447     
00448     ofile.write("<tr><td><p>Use a logarithmic abscissa</p></td>");
00449     ofile.write("<td colspan='1'><select name='ISLOG-"
00450             +label+"'> <option value='false'>False</option><option value='true'>True</option></select></p></td></tr>");
00451     ofile.newLine();
00452     
00453     ofile.write("<tr><td><p>Colliding beams are:</p></td><td><p>");
00454     ofile.write("<select name='COLL-"+label+"'>");
00455     ofile.write("<option value='undefined'>Undefined</option>");
00456     Vector<Collision> cList = Collision.getAll();
00457     for (Collision c : cList){
00458         ofile.write("<option value='"+c.getId()+"'>");
00459         procWriter.write(c.toString());
00460         ofile.write("</option>"); 
00461         ofile.newLine();
00462     }
00463     ofile.write("</select></td></tr>");
00464 
00465     ofile.newLine();
00466     ofile.write("<tr><td><p>Process switches:</p></td>");
00467     ofile.write("<td colspan='2'><table>");
00468             
00469     writeSwitchForm(null,label+"-NEW",null);        
00470     ofile.newLine();
00471 
00472     ofile.write("</table></td></tr>");
00473     
00474     ofile.newLine();
00475     
00476     if(label.equals("NEW")){
00477         ofile.write("<tr><td><p>" + 
00478             "Upload new XML data file for this plot:</p></td> ");
00479 
00480         ofile.write("<td align='LEFT'>" + 
00481             "<p>Data plot number from HZTool routine: "+
00482             "<input type='TEXT' name='HZSTEERPLOTID' size='5'>" + 
00483             "</p><p>" + 
00484             "MC plot number from HZTool routine: "+
00485             "<input type='TEXT' name='HZMCPLOTID' size='5'>"+
00486             "</p></td>"+
00487             "<td align='LEFT'><p>"+
00488             "<input type='FILE' name='XMLPLOT-'" + label + ">"+ 
00489             "</p></td></tr>");
00490 
00491         //ofile.write("<td align='LEFT'><p><input type='FILE' name='XMLPLOT-"
00492         //  +label+
00493         //  "'></p></td><td align='LEFT'>" + 
00494         //  "<p>Plot number from HZTool routine: "+
00495         //  "<input type='TEXT' name='HZSTEERPLOTID' size='5'>"+
00496         //  "</p></td></tr>");
00497     }else{
00498         ofile.write
00499         ("<tr><td colspan='2'>" + 
00500          "<p>Upload new XML data file for this plot:</p></td> ");
00501         ofile.write("<td align='RIGHT'><p><input type='FILE' name='XMLPLOT-"
00502             +label+"'></p></td></tr>");
00503     }
00504     
00505     }

void writeOkCancel  )  [inherited]
 

Write the OK and CANCEL buttons to screens.

Definition at line 592 of file HTMLWriter.java.

References HTMLWriter.write().

00592                                {
00593     try {
00594         ofile.newLine();
00595         ofile.write("<TR><TD COLSPAN=3><INPUT TYPE=SUBMIT NAME=ADDTOTHESE VALUE=\"OK\">");
00596         ofile.newLine();
00597         ofile.write("<INPUT TYPE=SUBMIT NAME=CANCEL VALUE=\"CANCEL\">");
00598     } catch ( IOException e ) {
00599         System.out.println("problem writing form");
00600         return;
00601     }
00602     }

void writePaperForm Paper  paper,
String  message
 

Write a form to modify a Paper

Parameters:
paper The Paper to be modified.
out The BufferedWriter to be written to.
message A message to the user, printed below the file upload form.

Definition at line 97 of file HTMLPaperWriter.java.

References HTMLWriter.closeForm(), Paper.getAccelerator(), Paper.getCodeAuthor(), Paper.getCollaboration(), Paper.getContact(), Paper.getDirName(), Paper.getId(), Paper.getIRN(), Paper.getReference(), Paper.getTitle(), and HTMLWriter.openForm().

Referenced by FileUploader.upload(), and HTMLPaperWriter.writePaperScreen().

00097                                                            {
00098 
00099     try {
00100         ofile.newLine();
00101 
00102         ofile.write("<p>");
00103         openForm("POST",servletPath);
00104 
00105         ofile.write("<input type='hidden' name='PAPERID' value='"+paper.getId()+"'>");
00106 
00107         ofile.write("<table border='3' width='100'><tr>");
00108 
00109         ofile.write("<td><p>Title:</p></td>");
00110         ofile.write("<td colspan='1'><input type='text' size='70' name='TITLE' value='"
00111             +paper.getTitle()+"'></p></td></tr>");
00112 
00113         ofile.newLine();
00114         
00115         ofile.write("<tr><td><p>"+HTMLPaperWriter.getLink(paper)+"</td>");
00116         ofile.write("<td colspan='1'><input type='text' size='70' name='IRN' value='"
00117             +paper.getIRN()+"'></p></td></tr>");
00118         ofile.newLine();
00119 
00120         ofile.write("<tr><td><p>Journal Reference</p></td>");
00121         ofile.write("<td colspan='1'><input type='text' size='70' name='REFERENCE' value='"
00122             +paper.getReference()+"'></p></td></tr>");
00123         ofile.newLine();
00124 
00125         ofile.write("<tr><td><p>Collaboration:</p></td>");
00126         ofile.write("<td><input type='text' size='70' name='COLLABORATION' value='"
00127             +paper.getCollaboration()+"'></p></td></tr>");
00128 
00129         ofile.newLine();
00130 
00131         ofile.write("<tr><td><p>Accelerator:</p></td>");
00132         ofile.write("<td colspan='1'><input type='text' size='70' name='ACCELERATOR' value='"
00133             +paper.getAccelerator()+"'></p></td></tr>");
00134 
00135         ofile.newLine();
00136 
00137         ofile.write("<tr><td><p>Code Author(s):</p></td>");
00138         ofile.write("<td colspan='1'><input type='text' size='70' name='CODEAUTHOR' value='"
00139             +paper.getCodeAuthor()+"'></p></td></tr>");
00140 
00141         ofile.newLine();
00142 
00143         ofile.write("<tr><td><p>Contact:</p></td>");
00144         ofile.write("<td colspan='1'><input type='text' size='70' name='CONTACT' value='"
00145             +paper.getContact()+"'></p></td></tr>");
00146 
00147         ofile.newLine();
00148 
00149         ofile.write("<tr><td><p>Directory:</p></td>");
00150         ofile.write("<td colspan='1'><input type='text' size='70' name='DIRECTORY' value='"
00151             +paper.getDirName()+"'></p></td></tr>");
00152 
00153 
00154         ofile.write("<td align='left'><input type='submit' name='DELETEPAPER' value='Delete paper' title='Delete this paper and all plots associated with it from the database'></TD>");
00155 
00156         ofile.write("<td align='right'><input type='submit' name='CHANGEPAPER' value='Submit Changes'></TD></TR>");
00157 
00158         ofile.write("</table>");
00159         closeForm();
00160 
00161         ofile.write("</p>");
00162 
00163         ofile.newLine();
00164         
00165     } catch (IOException e) {
00166         System.out.println("Could not open output stream for this paper."+e);
00167     }
00168     }

void writePaperScreen String  paperIdString,
PrintWriter  out,
String  servletPath
[static]
 

Write out screen to modify a paper.

Definition at line 59 of file HTMLPaperWriter.java.

References HTMLWriter.close(), HTMLPaperWriter.HTMLPaperWriter(), HTMLWriter.write(), HTMLPaperWriter.writePaperForm(), and HTMLPaperWriter.writePlotsForm().

00060                                                         {
00061 
00062     int paperId=0;
00063     String title;
00064     BufferedWriter ofile = new BufferedWriter(out);
00065 
00066     try {
00067         paperId= Integer.parseInt(paperIdString);
00068         Paper paper = new Paper(paperId);
00069         HTMLPaperWriter pm = new HTMLPaperWriter(out,servletPath);
00070         pm.writePaperForm(paper," ");
00071         pm.writePlotsForm(paper," ");
00072         pm.close();
00073     } catch (JetWebException jwe){
00074         HTMLErrorWriter.write(out,jwe);
00075     } catch (NumberFormatException e){
00076         out.close();
00077     }
00078     }

void writePlotEntry Paper  paper,
DataPlot  plot
throws IOException, JetWebException [private]
 

Definition at line 236 of file HTMLPaperWriter.java.

References PlotSwitch.getId(), Collision.getId(), Collision.toString(), HTMLWriter.write(), and HTMLPaperWriter.writeSwitchForm().

Referenced by HTMLPaperWriter.writePlotsForm().

00237                                         {
00238 
00239     // Start table row & entry
00240     ofile.write("<tr><td colspan='3'><hr noshade='noshade' size='3'></td></tr>"); 
00241     ofile.write("<tr><td colspan='3'><p><b>Paper ID="+paper.getId()+", Plot number "
00242             +plot.getNumber()+", plot ID="+plot.getId()+"</b></p></td>");
00243 
00244     ofile.write("<input type='hidden' name='CURRENTPLOTNUM' value='" 
00245             +plot.getNumber()+"'>");
00246     
00247     ofile.newLine();
00248     
00249     ofile.write("<tr><td><p>Title (mandatory!):</p></td>");
00250     ofile.write("<td colspan='2';><input type='text' size='70' name='TITLE"
00251             +plot.getNumber()+"' value='"
00252             +plot.getTitle()+"'></p></td></tr>");
00253     
00254     ofile.newLine();
00255     
00256     ofile.write("<tr><td><p>Scale factor:</p></td>");
00257     ofile.write("<td colspan='1'><input type='text' size='10' name='SCALE"
00258             +plot.getNumber()+"' value='"
00259             +dform.format(plot.getSysScale())+"'></p></td>");
00260     ofile.newLine();
00261     
00262     ofile.write("<td rowspan='6' align='right'>");
00263     // Link to the Graphics file.
00264     ofile.write("<a href='"+JetWebConfig.getHTMLRoot()+"/"
00265             +JetWebConfig.plotCacheDirName+"/"
00266             +paper.getDirName()+
00267             "/plot"+Integer.toString(plot.getNumber())+"."+
00268             JetWebConfig.graphicsType+"'> <img src='"+
00269             JetWebConfig.getHTMLRoot()+"/"
00270             +JetWebConfig.plotCacheDirName+"/"+paper.getDirName()+
00271             "/plot"+Integer.toString(plot.getNumber())+"."
00272             +JetWebConfig.graphicsType+"' alt='plot"
00273             +Integer.toString(plot.getNumber())+"'></a></td></tr>");
00274     
00275     ofile.newLine();
00276     
00277     ofile.write("<tr><td><p>In the default chi2?</p></td>");
00278     ofile.write("<td colspan='1'><select name='DEFSUM"
00279             +plot.getNumber()+"'>");
00280     ofile.write("<option value='"+plot.isDefaultSum()+"'>"
00281             +plot.isDefaultSum()+"</option>");
00282     ofile.write("<option value='"+!plot.isDefaultSum()+"'>"
00283             +!plot.isDefaultSum()+"</option></select></p></td></tr>");
00284     ofile.newLine();
00285     
00286     ofile.write("<tr><td><p>Is a normalised (shape) plot?</p></td>");
00287     ofile.write("<td colspan='1'><select name='ISSHAPE"
00288             +plot.getNumber()+"'>");
00289     ofile.write("<option value='"+plot.isShape()+"'>"
00290             +plot.isShape()+"</option>");
00291     ofile.write("<option value='"+!plot.isShape()+"'>"
00292             +!plot.isShape()+"</option></select></p></td></tr>");
00293     ofile.newLine();
00294     
00295     ofile.write("<tr><td><p>Use a logarithmic abscissa</p></td>");
00296     ofile.write("<td colspan='1'><select name='ISLOG"
00297             +plot.getNumber()
00298             +"'> <option value='"+plot.isLogarithmic()+"'>"
00299             +plot.isLogarithmic()+"</option>");
00300     ofile.newLine();
00301     ofile.write("<option value='"+!plot.isLogarithmic()+"'>"
00302             +!plot.isLogarithmic()+"</option></select></p></td></tr>");
00303     ofile.newLine();
00304 
00305     ofile.write("<tr><td><p>X label:</p></td>");
00306     ofile.write("<td colspan='1'><input type='text' size='30' name='XLABEL"
00307             +plot.getNumber()+"' value='"
00308             +plot.getXLabel()+"'></p></td>");
00309     ofile.newLine();
00310     
00311     ofile.write("<tr><td><p>Y label:</p></td>");
00312     ofile.write("<td colspan='1'><input type='text' size='30' name='YLABEL"
00313             +plot.getNumber()+"' value='"
00314             +plot.getYLabel()+"'></p></td></tr>");
00315     ofile.newLine();
00316     
00317     
00318     HTMLProcessWriter procWriter = new HTMLProcessWriter(ofile,servletPath);
00319 
00320     try {
00321 
00322         ofile.write("<tr><td colspan='1'><p>Default process type:</p></td><td colspan='2'><p>");
00323         //System.out.println(plot+" "+plot.getMCProcessType().getId());
00324 
00325         procWriter.write(plot.getMCProcessType().toString());
00326         //System.out.println("here");
00327         ofile.write("</p></td></tr>");
00328         ofile.newLine();
00329         
00330         Collision collision = null;
00331         ofile.write("<tr><td colspan='1'><p>Colliding beams are:</p></td><td colspan='2'><p>");
00332         ofile.write("<select name='COLL"+plot.getNumber()+"'>");
00333         try {
00334         collision = new Collision(plot.getCollisionId());
00335         ofile.write("<option value="+collision.getId()+">");
00336         procWriter.write(collision.toString());
00337         ofile.write("</option>");
00338         } catch (JetWebException jwe) {
00339         ofile.write("<option value='undefined'>Undefined</option>");
00340         }
00341         Vector<Collision> cList = Collision.getAll();
00342         for (Collision c : cList){
00343         ofile.write("<option value='"+c.getId()+"'>");
00344         procWriter.write(c.toString());
00345         ofile.write("</option>"); 
00346         }
00347         ofile.write("</select>");
00348 
00349 
00350         ofile.write("</p></td></tr>");
00351         ofile.newLine();
00352         ofile.write("<tr>");
00353         ofile.write("<td><p>Limits of allowed kinematic cuts</p></td>");
00354         ofile.write("<td colspan='2'>");
00355         for(Cut cut: plot.getCutCollection().getCuts()){
00356         ofile.newLine();
00357         ofile.write("<p>");
00358         ofile.write
00359             (cut.getName() + " = " + cut.getValue());
00360         ofile.write("</p>");
00361         }
00362 
00363         ofile.newLine();
00364         ofile.write("<p>");
00365         
00366         ofile.write("Add a new cut:");
00367         ofile.write("</p><p>");
00368         ofile.write("Cut name ");
00369         ofile.write("<input type='text' name='CUTNAME" + 
00370             plot.getNumber() +
00371             "' size='7' value=''>");
00372         ofile.write(" value ");
00373         ofile.write("<input type='text' name='CUTVALUE" + 
00374             plot.getNumber() +
00375             "' size='7' value=''>");
00376         ofile.write("</p>");
00377 
00378         ofile.write("</p></td>");
00379         ofile.write("</tr>");
00380         ofile.write("<tr><td><p>Process switches:</p></td>");
00381         ofile.write("<td colspan='2'><table>");
00382         Iterator<PlotSwitch> switches = plot.getSwitches();
00383         
00384         while (switches.hasNext()){     
00385         PlotSwitch plotSwitch = switches.next();
00386         writeSwitchForm(plotSwitch,String.valueOf(plotSwitch.getId()),collision);
00387         ofile.newLine();
00388         }
00389         
00390         writeSwitchForm(null,plot.getNumber()+"-new",collision);        
00391         ofile.newLine();
00392         
00393         ofile.write("</table></td></tr>");
00394         ofile.newLine();
00395         
00396     } catch (JetWebException jwe){
00397         ofile.write(jwe.getMessage());
00398     }
00399         
00400     ofile.write("<tr><td><p>Upload new XML data file for this plot:</p></td> ");
00401     ofile.write("<td align='right'><p><input type='FILE' name='XMLPLOT-"
00402             +plot.getNumber()+"'></td>");
00403     ofile.newLine();
00404     ofile.write("<td><p>Delete this plot:");
00405     ofile.write("<input type='checkbox' name='DELETEPLOT"+plot.getNumber()
00406             +"'></p></td></tr>");
00407     }

void writePlotsForm Paper  paper,
String  message
throws JetWebException
 

Write out the form which allows plots for this paper to be changed.

Parameters:
paper The Paper to be modified.
out The BufferedWriter to be written to.
message A message to the user, printed at the top of the form.

Definition at line 176 of file HTMLPaperWriter.java.

References HTMLPaperWriter.writeNewPlotEntry(), and HTMLPaperWriter.writePlotEntry().

Referenced by FileUploader.upload(), and HTMLPaperWriter.writePaperScreen().

00176                                                                                    {
00177 
00178     try {
00179         ofile.write("<p><form enctype='multipart/form-data' method='post' action='"
00180             +JetWebConfig.uploadServletPath+"'>");
00181         ofile.write("<table border='3' width='100%'>");
00182         ofile.newLine();
00183 
00184         ofile.write("<input type='hidden' name='PLOTUPLOAD'>");
00185         ofile.write("<input type='hidden' name='PAPERID' value='"
00186             +paper.getId()+"'>");
00187         ofile.write("<input type='hidden' name='DIRECTORY' value='"
00188             +"/"+paper.getDirName()+"'>");
00189 
00190         ofile.write("<tr><td colspan='3'><p><font color='red'"
00191             +message+"</em></p></td><tr>");
00192         
00193         if (paper.getPlots()!=null){
00194         for (DataPlot plot : paper.getPlots()){    
00195             writePlotEntry(paper,plot);
00196         }
00197         }
00198 
00199         ofile.write("</table>");
00200         ofile.newLine();
00201 
00202         ofile.write("<table border='3' width='100%'>");
00203         ofile.newLine();
00204         
00205         // Finished existing plots. Allow a new one to be added
00206         writeNewPlotEntry(paper,"NEW");
00207 
00208         ofile.write("</table>");
00209 
00210         // End of all the plots!
00211 
00212         ofile.newLine();
00213         
00214         ofile.write("<input type='submit' value='Upload all plot information'>");
00215         ofile.newLine();
00216         //ofile.write("</table>");
00217 
00218         ofile.write("<hr noshade='noshade' size='3'>");
00219 
00220         ofile.write("</form>");
00221 
00222         ofile.write("<p><a href='/"+JetWebConfig.serverName+"'>Back to top</a></p>");
00223         
00224         DateFormat defaultDate = DateFormat.getDateInstance();
00225         DateFormat theTime = DateFormat.getTimeInstance();
00226         ofile.write("<hr noshade='noshade' size='3'><p>This page last updated "
00227             + defaultDate.format(new Date()) + " at "
00228             + theTime.format(new Date())+"</p>");       
00229         ofile.newLine();
00230     }
00231     catch (IOException e) {
00232         System.out.println("Could not open output stream for this paper."+e);
00233     }
00234     }

void writeSwitchForm PlotSwitch  ps,
String  label,
Collision  collision
throws IOException, JetWebException [private]
 

Definition at line 507 of file HTMLPaperWriter.java.

References HTMLWriter.write().

Referenced by HTMLPaperWriter.writeNewPlotEntry(), and HTMLPaperWriter.writePlotEntry().

00508                                         {
00509 
00510     HTMLProcessWriter procWriter = new HTMLProcessWriter(ofile,servletPath);
00511     ofile.write("<TR><TD COLSPAN=8><P>Use process ");
00512 
00513     ofile.write("<SELECT name='PROC"+label+"'>");
00514     try {
00515         ofile.write("<option value='"+ps.getMCProcessTypeId()+"'>");
00516         procWriter.write(ps.getMCProcessType().toString());
00517         ofile.write("</option>"); 
00518     } catch (NullPointerException n){
00519     }
00520     ofile.write("<option value='undefined'>Undefined</option>");
00521     ofile.write("<option value='-1'> Remove this switch </option>");
00522     Vector<MCProcessType> ptList = MCProcessType.getAll(collision,true);
00523     for (MCProcessType pt : ptList){
00524         ofile.write("<option value='"+pt.getId()+"'>");
00525         procWriter.write(pt.toString());
00526         ofile.write("</option>"); 
00527     }
00528     ofile.write("</select>");
00529         
00530     ofile.write(" if ");
00531 
00532     ofile.write("<select name='PARMNAME"+label+"'>");
00533     if (ps!=null && ps.getParameterName()!=null && !ps.getParameterName().equalsIgnoreCase("NULL")) {
00534         ofile.write("<option value='"+ps.getParameterName()+"'>"+ps.getParameterName()+"</option>"); 
00535     }
00536     ofile.write("<option value='undefined'>Undefined</option>");
00537     Iterator<String> parmList = PlotSwitch.getAllowedParameters();
00538     while (parmList.hasNext()){ 
00539         String parm = parmList.next();
00540         ofile.write("<option value='"+parm+"'>"+parm+"</option>");
00541     }
00542     ofile.write("</select>");
00543 
00544     ofile.write(" is between ");
00545     ofile.write("<input type='TEXT' size='10' name='PARMVALL"
00546             +label);
00547     if (ps!=null && ps.getParameterName()!=null && !ps.getParameterName().equalsIgnoreCase("NULL") ) { 
00548         ofile.write("' value='"+ps.getParameterValueLow()); }
00549     ofile.write("'>");
00550 
00551     ofile.write(" and ");
00552     ofile.write("<input type='text' size='10' name='PARMVALH"
00553             +label);
00554     if (ps!=null && ps.getParameterName()!=null && !ps.getParameterName().equalsIgnoreCase("NULL")) { 
00555         ofile.write("' value='"+ps.getParameterValueHigh()); }
00556 
00557     ofile.write("'> </p></td></tr>");
00558         
00559 
00560 
00561     ofile.write("<tr><td colspan='2'><p>for generator");
00562     ofile.write("<select name='GEN"+label+"'>");
00563     if (ps!=null && ps.getGeneratorName()!=null && !ps.getGeneratorName().equalsIgnoreCase("NULL") ) {
00564         ofile.write("<option value='"+ps.getGeneratorName()+"'>"
00565             +ps.getGeneratorName()+"</option>"); 
00566     }
00567     ofile.write("<option value='undefined'>Undefined/Any</option>");
00568     for (String name : Generator.allNames()){
00569         ofile.write("<option value='"+name+"'>"+name+"</option>");
00570     }
00571     ofile.write("</select></p></td>");
00572 
00573     ofile.write("<TR><TD COLSPAN=8><hr></TD></TR>");
00574 
00575     }

void writeTitle String  title  )  throws JetWebException [inherited]
 

Write an HTML title.

Definition at line 929 of file HTMLWriter.java.

References HTMLWriter.write().

Referenced by Searcher.doGet().

00929                                                                 {
00930     try {
00931         ofile.write("<h2>"+title+"</h2>");
00932     } catch (IOException ioe){
00933         throw new JetWebException(ioe);
00934     }
00935     }

void writeTopMessage String  message  )  throws JetWebException [inherited]
 

Write an HTML message from the server at the top of the screen.

Definition at line 917 of file HTMLWriter.java.

References HTMLWriter.write().

00917                                                                        {
00918     try {
00919         ofile.write("<div class=\"news\">"+message+"</div>");
00920     } catch (IOException ioe){
00921         throw new JetWebException(ioe);
00922     }
00923 
00924     }


Member Data Documentation

SimpleDateFormat dateFormat [protected, inherited]
 

Standard format for dates.

Definition at line 52 of file HTMLWriter.java.

NumberFormat dform [static, protected, inherited]
 

Standard format for decimals.

Definition at line 49 of file HTMLWriter.java.

Integer forms_ = 0 [protected, inherited]
 

Keep track of whether we are inside a form or not and how many forms we think we are inside (can only actually ever be one, but it might try to close more than 1 if we don't count!)

Definition at line 68 of file HTMLWriter.java.

boolean hidden = false [protected, inherited]
 

Write objects as hidden in HTML forms.

Definition at line 58 of file HTMLWriter.java.

final int LISTLENGTH = 10 [static, protected, inherited]
 

Definition at line 40 of file HTMLWriter.java.

boolean modifiable = false [protected, inherited]
 

Write objects modiable form fields.

Definition at line 55 of file HTMLWriter.java.

BufferedWriter ofile [protected, inherited]
 

Output destinatation.

Definition at line 46 of file HTMLWriter.java.

String servletPath [protected, inherited]
 

The path to be used for all links to servlets.

Definition at line 43 of file HTMLWriter.java.

boolean verbose = false [protected, inherited]
 

Write verbose verions of objects.

Definition at line 61 of file HTMLWriter.java.


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

Generated Wed Jan 17 09:14:27 GMT 2007