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

HTMLUtils Class Reference

List of all members.

Detailed Description

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

This should as far as possible just invoke various HTMLWriter classes, or have methods which just return strings.

Author:
Jon Butterworth
Version:
Date
2006-10-18 20:35:11 +0100 (Wed, 18 Oct 2006)
Revision
1299

Definition at line 32 of file HTMLUtils.java.


Static Public Member Functions

void writeProcScreen (String modelIdString, PrintWriter out, String servletPath) throws JetWebException
void writeQueryScreen (String message, ResultSearchPattern pattern, PlotSelection whichpapers, PrintWriter out, String servletPath) throws JetWebException
void writeControlScreen (String message, ResultSearchPattern pattern, PlotSelection whichpapers, PrintWriter out, String servletPath)
void writeJobRequestForm (String message, ResultSearchPattern pattern, PlotSelection whichpapers, PrintWriter out, String servletPath) throws JetWebException
void listPendingJobs (PrintWriter out, String servletPath)
void writeParameterScreen (ResultSearchPattern pattern, PrintWriter out, String servletPath, boolean submitting) throws JetWebException
void writeSelectPlotsPage (ResultSearchPattern pattern, PlotSelection whichPlots, PrintWriter out, String servletPath) throws JetWebException
String writeInputBox (String name, String hover, Object obj)
String writeInputBox (String name, Object obj)
String writeSubmitButton (String name, String hover, String text)
String writeInputTag (String type, String name, String hover, Object obj)
void displayListContinued (PrintWriter out, String servletPath, boolean verbose, String listKey) throws JetWebException
void displayListContinued (PrintWriter out, String servletPath, boolean verbose, boolean modifiable, String listKey) throws JetWebException
void displayList (PrintWriter out, String servletPath, boolean verbose, List<?> list) throws JetWebException
void displayList (PrintWriter out, String servletPath, boolean verbose, boolean modifiable, List<?> list) throws JetWebException

Static Public Attributes

final String PTHAT = "pthat"
final String DATE = "date"
final String CHI2ALL = "Fit (All data)"
final String CHI2HIGH = "Fit (High ET)"
final String CHI2LOW = "Fit (Low ET)"
final String CHI2SHAPE = "Fit (Jet Shapes)"
final String CHI2CHARM = "Fit (Charm)"
final String CHI2ALLEP = "ep Fit (All data)"
final String CHI2HIGHEP = "ep Fit (High ET)"
final String CHI2LOWEP = "ep Fit (Low ET)"
final String CHI2SHAPEEP = "ep Fit (Jet Shapes)"
final String CHI2CHARMEP = "ep Fit (Charm)"
final String CHI2ALLEE = "ee Fit (All data)"
final String CHI2HIGHEE = "ee Fit (High ET)"
final String CHI2LOWEE = "ee Fit (Low ET)"
final String CHI2SHAPEEE = "ee Fit (Jet Shapes)"
final String CHI2CHARMEE = "ee Fit (Charm)"
final String CHI2ALLPP = "pp Fit (All data)"
final String CHI2HIGHPP = "pp Fit (High ET)"
final String CHI2LOWPP = "pp Fit (Low ET)"
final String CHI2SHAPEPP = "pp Fit (Jet Shapes)"
final String CHI2CHARMPP = "pp Fit (Charm)"
final String DONTCARE = "Don't care"
final String LATEST = "All Latest"
final String LATESTEP = "Latest ep Data"
final String LATESTEE = "Latest e+e- Data"
final String LATESTPP = "Latest pp(bar) Data"

Member Function Documentation

void displayList PrintWriter  out,
String  servletPath,
boolean  verbose,
boolean  modifiable,
List<?>  list
throws JetWebException [static]
 

Send html output of a search to the printwriter specified. This also handles caching of next elements in List when List is longer than HTMLwriter.LISTLENGTH.

Parameters:
list the list of object to write.
verbose long output of elements?
modifiable elements as forms to allow changes?
Exceptions:
JetWebException 

Definition at line 416 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLWriter.displayList(), HTMLWriter.endListPage(), HTMLWriter.makeWriter(), HTMLWriter.setModifiable(), HTMLWriter.setVerbose(), and HTMLWriter.write().

00419                            {
00420     
00421     HTMLWriter writer;
00422     if (list.size()>0){
00423 
00424         writer = HTMLWriter.makeWriter(out,servletPath,list.get(0));
00425 
00426         if (list.size()==1) { 
00427         writer.setVerbose(true); 
00428         } else {
00429         writer.setVerbose(verbose); 
00430         }
00431 
00432         int start = list.size();
00433         int stop = 0;
00434 
00435         writer.setModifiable(modifiable);
00436 
00437         writer.displayList(list);
00438 
00439         if (list.size()>0){
00440         
00441         stop = list.size();
00442         String listKey = JetWebConfig.cacheList(list);
00443 
00444         // Terminate file.
00445         writer.endListPage(listKey);
00446 
00447         }
00448     } else {
00449         writer = new HTMLWriter(out,servletPath);
00450         writer.write("No results found");
00451     }
00452 
00453     writer.close();
00454 
00455     }

void displayList PrintWriter  out,
String  servletPath,
boolean  verbose,
List<?>  list
throws JetWebException [static]
 

Send html output of a search to the printwriter specified. This also handles caching of next elements in List when List is longer than HTMLwriter.LISTLENGTH.

Parameters:
list the list of object to write.
verbose long output of elements?
Exceptions:
JetWebException 

Definition at line 399 of file HTMLUtils.java.

00402                            {
00403     displayList(out,servletPath,verbose,false,list);
00404     }

void displayListContinued PrintWriter  out,
String  servletPath,
boolean  verbose,
boolean  modifiable,
String  listKey
throws JetWebException [static]
 

Continuation of output of a long list.

Definition at line 360 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLWriter.displayList(), HTMLWriter.endListPage(), HTMLWriter.makeWriter(), HTMLWriter.setModifiable(), and HTMLWriter.setVerbose().

00364                            {
00365 
00366     List<? extends Object> list = JetWebConfig.getResultList(listKey);
00367     if (list==null){
00368         throw new JetWebException("Sorry, this Search has timed out, you will have to go back and repeat",null);
00369     }
00370 
00371     HTMLWriter writer;
00372     if (list.size()>0) {
00373         writer = HTMLWriter.makeWriter(out,servletPath,list.get(0));
00374     } else {
00375         writer = new HTMLWriter(out,servletPath);
00376     }
00377     writer.setVerbose(verbose);
00378     writer.setModifiable(modifiable);
00379     writer.displayList(list);
00380     if (list.size()>0){
00381         
00382         // Terminate file.
00383         writer.endListPage(listKey);
00384 
00385     }
00386 
00387     writer.close();
00388     }

void displayListContinued PrintWriter  out,
String  servletPath,
boolean  verbose,
String  listKey
throws JetWebException [static]
 

Continuation of output of a long list.

Definition at line 349 of file HTMLUtils.java.

00353                            {
00354     displayListContinued(out,servletPath,verbose,false,listKey);
00355 
00356     }

void listPendingJobs PrintWriter  out,
String  servletPath
[static]
 

Definition at line 226 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLWriter.endForm(), HTMLWriter.listPendingJobs(), and HTMLWriter.startForm().

00228                         {
00229 
00230     // Start new page.
00231     HTMLWriter op = new HTMLWriter(out,servletPath);
00232     op.startForm();
00233     op.listPendingJobs();
00234     op.endForm();
00235     //op.writeTrailer();
00236     op.close();
00237     }

void writeControlScreen String  message,
ResultSearchPattern  pattern,
PlotSelection  whichpapers,
PrintWriter  out,
String  servletPath
[static]
 

Return the standard control screen with message.

Definition at line 187 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLWriter.makeControlForm(), and HTMLWriter.startControlForm().

00192                        {
00193 
00194     // Start new page.
00195     HTMLWriter op = new HTMLWriter(out,servletPath);
00196     op.startControlForm(message);
00197     op.makeControlForm();
00198     op.close();
00199     }

String writeInputBox String  name,
Object  obj
[static]
 

Write an HTML input box using the give name and object.

Definition at line 305 of file HTMLUtils.java.

00305                                                                {
00306     return writeInputTag("text",name,null,obj);
00307     }

String writeInputBox String  name,
String  hover,
Object  obj
[static]
 

Write an HTML input box using the give name, hover text and object.

Definition at line 299 of file HTMLUtils.java.

00299                                                                              {
00300     return writeInputTag("text",name,hover,obj);
00301     }

String writeInputTag String  type,
String  name,
String  hover,
Object  obj
[static]
 

Write an HTML input box using the give type, name, hover text and object.

Parameters:
type the type of input tag.
name The name of the tag to be submitted
hover The hover text which will appear when the mouse lies over it.
obj The value which will be submitted.

Definition at line 327 of file HTMLUtils.java.

00327                                                                                           {
00328 
00329     int length = 5;
00330     if (obj!=null){
00331         length = obj.toString().length()+1;
00332     }
00333     StringBuffer htmlText = 
00334         new StringBuffer("<input type='"+type+"' size='"+length+"' name='"+name+"'");
00335     if (hover!=null) {
00336         htmlText.append(" title='"   +hover+"'"); 
00337     }
00338     if (obj!=null) {
00339         htmlText.append(" value='"+obj+"'");
00340     }
00341 
00342     htmlText.append(">");
00343     return htmlText.toString();
00344     }

void writeJobRequestForm String  message,
ResultSearchPattern  pattern,
PlotSelection  whichpapers,
PrintWriter  out,
String  servletPath
throws JetWebException [static]
 

Write out the Job Request HTML form based.

Definition at line 205 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLWriter.endForm(), HTMLWriter.makeRequestForm(), HTMLWriter.makeSubmitButtons(), HTMLWriter.startForm(), HTMLWriter.write(), and HTMLProcessWriter.writeMCProcessSelector().

00210                                                 {
00211 
00212     // Start new page.
00213     HTMLProcessWriter op = new HTMLProcessWriter(out,servletPath);
00214     op.startForm();
00215     if (message!=null) {
00216         op.write(message);
00217     }
00218     pattern.setSoftDefaults();// Set unspecified parameters to default values
00219     op.makeSubmitButtons();
00220     op.makeRequestForm(pattern);
00221     op.writeMCProcessSelector(null);
00222     op.endForm();
00223     op.close();
00224     }

void writeParameterScreen ResultSearchPattern  pattern,
PrintWriter  out,
String  servletPath,
boolean  submitting
throws JetWebException [static]
 

Write a screen for the user to enter generator parameters.

Definition at line 242 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLGeneratorWriter.display(), HTMLWriter.endForm(), HTMLWriter.makeActionButtons(), HTMLWriter.makeCommonForm(), HTMLWriter.makeSubmitButtons(), HTMLWriter.setModifiable(), HTMLWriter.setVerbose(), HTMLWriter.startForm(), and HTMLWriter.write().

00246                            {
00247 
00248     Generator gen = pattern.getGenerator();
00249 
00250     // Start new page.
00251     HTMLGeneratorWriter op = new HTMLGeneratorWriter(out,servletPath);
00252     op.write("<p>Specify any "+gen.getName()+"-"+gen.getVersion()
00253          +" parameters to be changed.</p>");
00254     op.startForm();
00255     if (submitting){
00256         op.makeSubmitButtons();
00257     } else {
00258         op.makeActionButtons();
00259     }
00260     op.makeCommonForm(pattern);
00261     op.setModifiable(true);
00262     op.setVerbose(true);
00263     op.display(gen);
00264 
00265     op.endForm();
00266     op.close();
00267 
00268     }

void writeProcScreen String  modelIdString,
PrintWriter  out,
String  servletPath
throws JetWebException [static]
 

Write out the screen which allows the user to choose which processTypes to generate.

Definition at line 99 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLWriter.endForm(), HTMLWriter.startForm(), HTMLWriter.write(), and HTMLProcessWriter.writeMCProcessSelector().

00100                           {
00101 
00102     // Start newpage.
00103     HTMLProcessWriter op = new HTMLProcessWriter(out,servletPath);
00104     op.write("<p>Generate more events for Model " + 
00105          modelIdString + 
00106          ".<p>");
00107     op.write("<p>");
00108     op.startForm();
00109     op.write("Minimum PT (GeV) for generated events ");
00110     op.write
00111         ("<input type='text' size='3'" + 
00112          " name='GENPTMIN' title='Enter the minimum PT to generate'><p>");
00113     op.write("Which processes do you wish to generate?<p>");
00114     op.writeMCProcessSelector(modelIdString);
00115     op.endForm();
00116     op.close();
00117     }

void writeQueryScreen String  message,
ResultSearchPattern  pattern,
PlotSelection  whichpapers,
PrintWriter  out,
String  servletPath
throws JetWebException [static]
 

Return the standard query screen, with message.

Definition at line 122 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLPlotWriter.displaySelection(), HTMLWriter.endForm(), HTMLWriter.getWriter(), HTMLWriter.makeActionButtons(), HTMLWriter.makeRequestForm(), HTMLWriter.searchByXML(), HTMLWriter.setModifiable(), HTMLWriter.startForm(), HTMLWriter.write(), and HTMLWriter.writeInputId().

00127                                              {
00128 
00129 
00130     HTMLWriter op = new HTMLWriter(out,servletPath);
00131 
00132     if (message!=null) {op.write(message);}
00133     
00134     // allow the user to select fit id 
00135     op.writeInputId("Fit ID","FITID","Get the fit with this ID.",null);     
00136     // allow the user to select model id 
00137     op.writeInputId("Model ID","MODELID","Get the model with this ID.",null);
00138 
00139     op.searchByXML();
00140 
00141     op.startForm();
00142     
00143     op.makeActionButtons();     
00144 
00145     // Now the PlotSelection
00146     HTMLPlotWriter plotOp = new HTMLPlotWriter(op.getWriter(),servletPath);
00147     plotOp.setModifiable(true);
00148     plotOp.displaySelection(null);
00149 
00150     try {
00151 
00152         op.getWriter().newLine();
00153         op.getWriter().write(HTMLUtils.writeSubmitButton("PROCESSTYPE",
00154                                  "View all the physics processes known to JetWeb",
00155                                  "View Processes"));
00156         op.getWriter().newLine();
00157         op.getWriter().write(HTMLUtils.writeSubmitButton("COLLISION",
00158                                  "View all the colliding beams known to JetWeb",
00159                                  "View Beams"));
00160         //op.getWriter().write("<input type='hidden' name='COLLISIONID' value='5'>");
00161         //op.getWriter().write("<input type='hidden' name='COLLISIONID' value='2'>");
00162         op.getWriter().newLine();
00163         op.getWriter().write(HTMLUtils.writeSubmitButton("PAPER",
00164                                  "View all the papers known to JetWeb",
00165                                  "View Papers"));
00166 
00167         op.getWriter().newLine();
00168 
00169 
00170     } catch (IOException e) {
00171         throw new JetWebException(e,"problem writing button");
00172 
00173     }
00174     op.makeRequestForm(pattern);    
00175 
00176     op.endForm();
00177     
00178     op.close();
00179 
00180     }

void writeSelectPlotsPage ResultSearchPattern  pattern,
PlotSelection  whichPlots,
PrintWriter  out,
String  servletPath
throws JetWebException [static]
 

Write out the Job Request HTML form based.

Definition at line 273 of file HTMLUtils.java.

References HTMLWriter.close(), HTMLPlotWriter.displaySelection(), HTMLWriter.endForm(), HTMLWriter.makeActionButtons(), HTMLWriter.makeRequestForm(), HTMLWriter.setModifiable(), HTMLWriter.setVerbose(), HTMLWriter.startForm(), and HTMLWriter.write().

00277                                                  {
00278 
00279     // Start new page.
00280     HTMLPlotWriter op = new HTMLPlotWriter(out,servletPath);
00281     op.write("<p>Select the plots to be included in the Chi2 sum.</p>");
00282     op.startForm();
00283     op.makeActionButtons();
00284 
00285     op.setVerbose(true);
00286     op.setModifiable(true);
00287     op.displaySelection(whichPlots);
00288 
00289     op.makeRequestForm(pattern);
00290     op.endForm();
00291     op.close();
00292 
00293     }

String writeSubmitButton String  name,
String  hover,
String  text
[static]
 

Write an HTML input box using the give name, hover text and object.

Parameters:
name The name of the tag to be submitted
hover The hover text which will appear when the mouse lies over it.
obj The text which will appear on the button.

Definition at line 315 of file HTMLUtils.java.

00315                                                                                   {
00316 
00317     return writeInputTag("submit",name,hover,text);
00318 
00319     }


Member Data Documentation

final String CHI2ALL = "Fit (All data)" [static]
 

Result sort option

Definition at line 39 of file HTMLUtils.java.

final String CHI2ALLEE = "ee Fit (All data)" [static]
 

Result sort option

Definition at line 61 of file HTMLUtils.java.

final String CHI2ALLEP = "ep Fit (All data)" [static]
 

Result sort option

Definition at line 50 of file HTMLUtils.java.

final String CHI2ALLPP = "pp Fit (All data)" [static]
 

Result sort option

Definition at line 72 of file HTMLUtils.java.

final String CHI2CHARM = "Fit (Charm)" [static]
 

Result sort option

Definition at line 47 of file HTMLUtils.java.

final String CHI2CHARMEE = "ee Fit (Charm)" [static]
 

Result sort option

Definition at line 69 of file HTMLUtils.java.

final String CHI2CHARMEP = "ep Fit (Charm)" [static]
 

Result sort option

Definition at line 58 of file HTMLUtils.java.

final String CHI2CHARMPP = "pp Fit (Charm)" [static]
 

Result sort option

Definition at line 80 of file HTMLUtils.java.

final String CHI2HIGH = "Fit (High ET)" [static]
 

Result sort option

Definition at line 41 of file HTMLUtils.java.

final String CHI2HIGHEE = "ee Fit (High ET)" [static]
 

Result sort option

Definition at line 63 of file HTMLUtils.java.

final String CHI2HIGHEP = "ep Fit (High ET)" [static]
 

Result sort option

Definition at line 52 of file HTMLUtils.java.

final String CHI2HIGHPP = "pp Fit (High ET)" [static]
 

Result sort option

Definition at line 74 of file HTMLUtils.java.

final String CHI2LOW = "Fit (Low ET)" [static]
 

Result sort option

Definition at line 43 of file HTMLUtils.java.

final String CHI2LOWEE = "ee Fit (Low ET)" [static]
 

Result sort option

Definition at line 65 of file HTMLUtils.java.

final String CHI2LOWEP = "ep Fit (Low ET)" [static]
 

Result sort option

Definition at line 54 of file HTMLUtils.java.

final String CHI2LOWPP = "pp Fit (Low ET)" [static]
 

Result sort option

Definition at line 76 of file HTMLUtils.java.

final String CHI2SHAPE = "Fit (Jet Shapes)" [static]
 

Result sort option

Definition at line 45 of file HTMLUtils.java.

final String CHI2SHAPEEE = "ee Fit (Jet Shapes)" [static]
 

Result sort option

Definition at line 67 of file HTMLUtils.java.

final String CHI2SHAPEEP = "ep Fit (Jet Shapes)" [static]
 

Result sort option

Definition at line 56 of file HTMLUtils.java.

final String CHI2SHAPEPP = "pp Fit (Jet Shapes)" [static]
 

Result sort option

Definition at line 78 of file HTMLUtils.java.

final String DATE = "date" [static]
 

Result sort option

Definition at line 37 of file HTMLUtils.java.

final String DONTCARE = "Don't care" [static]
 

Result filter option (no filter)

Definition at line 84 of file HTMLUtils.java.

final String LATEST = "All Latest" [static]
 

Result filter option

Definition at line 86 of file HTMLUtils.java.

final String LATESTEE = "Latest e+e- Data" [static]
 

Result filter option

Definition at line 90 of file HTMLUtils.java.

final String LATESTEP = "Latest ep Data" [static]
 

Result filter option

Definition at line 88 of file HTMLUtils.java.

final String LATESTPP = "Latest pp(bar) Data" [static]
 

Result filter option

Definition at line 92 of file HTMLUtils.java.

final String PTHAT = "pthat" [static]
 

Result sort option

Definition at line 35 of file HTMLUtils.java.


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

Generated Wed Jan 17 09:14:27 GMT 2007