jetweb is hosted by Hepforge, IPPP Durham

cedar.jetweb.html
Class HTMLWriter

java.lang.Object
  extended by cedar.jetweb.html.HTMLWriter
Direct Known Subclasses:
HTMLFitWriter, HTMLGeneratorWriter, HTMLJobWriter, HTMLModelWriter, HTMLPaperWriter, HTMLPlotWriter, HTMLProcessWriter

public class HTMLWriter
extends java.lang.Object

A class containing a BufferedWriter and various methods for writing JetWeb objects to it.

Version:
$Date: 2006-06-22 09:19:00 +0100 (Thu, 22 Jun 2006) $ $Revision: 1204 $
Author:
Jon Butterworth

Field Summary
protected  java.text.SimpleDateFormat dateFormat
          Standard format for dates.
protected static java.text.NumberFormat dform
          Standard format for decimals.
protected  boolean hidden
          Write objects as hidden in HTML forms.
protected static int LISTLENGTH
           
protected  boolean modifiable
          Write objects modiable form fields.
protected  java.io.BufferedWriter ofile
          Output destinatation.
protected  java.lang.String servletPath
          The path to be used for all links to servlets.
protected  boolean verbose
          Write verbose verions of objects.
 
Constructor Summary
HTMLWriter(java.io.BufferedWriter out, java.lang.String newServletPath)
          Start a new html stream.
HTMLWriter(java.io.PrintWriter out, java.lang.String newServletPath)
          Start a new html stream.
HTMLWriter(java.lang.String filename, java.lang.String newServletPath)
          Start a new html stream.
 
Method Summary
 void close()
          Method to close the buffered writer.
 void display(java.lang.Object object)
           
 void displayList(java.util.List<java.lang.Object> list)
          Send html output of a search to the printwriter specified.
 void endForm()
          End form.
 void endListPage(java.lang.String resultKey)
          Write footer for a list of Fits with a forward link pabes on the fitKey
 void forwardTo(java.lang.String htmlPath)
          Write the necessary HTML to forward to use to the page at htmlPath.
 java.io.BufferedWriter getWriter()
          Return the buffered writer.
 void listHiddenPars(ResultSearchPattern pattern)
          Add the generic parameters from the ResultSearchPattern to the HTML form as hidden inputs.
protected  void listLogs(java.util.Enumeration list)
           
 void listPendingJobs()
          Write list of pending jobs.
 void makeActionButtons()
          Write out the HTML search toolbar.
 void makeCommonForm(ResultSearchPattern pattern)
           
 void makeControlForm()
          Write out the top-level maintenance options form.
 void makeRequestForm(ResultSearchPattern pattern)
          Construct an HTML request form containing the parameters of a ResultSearchPattern
 void makeSubmitButtons()
          Write out the HTML job submission toolbar.
 void setDateFormat(java.text.SimpleDateFormat form)
          Set the date format.
 void setHidden(boolean hide)
          Write objects as hidden parameters or not.
 void setModifiable(boolean mod)
          Write objects as modifiable parameters or not.
 void setNumberFormat(java.text.NumberFormat form)
          Set the number format.
 void setVerbose(boolean verb)
          Write verbose versions of objects
 void startControlForm()
          Write out the HTML for the start of a (no message) control form.
 void startControlForm(java.lang.String message)
          Write out the HTML for the start of a control form with message.
 void startForm(java.lang.String message)
          Write out the HTML start tag for a form, with an (optional) message.
 void writeDirChoiceForm(java.lang.String suggestion)
          Write out run directory selection screen.
 void writeInputId(java.lang.String text, java.lang.String name, java.lang.String hover, java.lang.Integer id)
          Write a standard form to fetch an object with an input ID.
 void writeList(java.util.List<java.lang.Object> list)
          Write a list of objects.
 void writeListContinued(java.lang.String listKey)
          writes fit list page subsequent to first page
 void writeOkCancel()
          Write the OK and CANCEL buttons to screens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LISTLENGTH

protected static final int LISTLENGTH
See Also:
Constant Field Values

servletPath

protected java.lang.String servletPath
The path to be used for all links to servlets.


ofile

protected java.io.BufferedWriter ofile
Output destinatation.


dform

protected static java.text.NumberFormat dform
Standard format for decimals.


dateFormat

protected java.text.SimpleDateFormat dateFormat
Standard format for dates.


modifiable

protected boolean modifiable
Write objects modiable form fields.


hidden

protected boolean hidden
Write objects as hidden in HTML forms.


verbose

protected boolean verbose
Write verbose verions of objects.

Constructor Detail

HTMLWriter

public HTMLWriter(java.io.BufferedWriter out,
                  java.lang.String newServletPath)
Start a new html stream. This does nothing except assign the output stream and the path which will be used to refer back to the current servlet. This version writes output to the given PrintWriter.

Parameters:
out - - output writer
newServletPath - required for links back


HTMLWriter

public HTMLWriter(java.io.PrintWriter out,
                  java.lang.String newServletPath)
Start a new html stream. This does nothing except assign the output stream and the path which will be used to refer back to the current servlet. This version writes output to the given PrintWriter.

Parameters:
out - - output writer
newServletPath - required for links back


HTMLWriter

public HTMLWriter(java.lang.String filename,
                  java.lang.String newServletPath)
Start a new html stream. This does nothing except assign the output stream and the path which will be used to refer back to the current servlet. This version writes output to the given file. (Deletes any existing file with the same name).

Parameters:
filename - for output file
newServletPath - required for links on output html page

Method Detail

setNumberFormat

public void setNumberFormat(java.text.NumberFormat form)
Set the number format.


setDateFormat

public void setDateFormat(java.text.SimpleDateFormat form)
Set the date format.


getWriter

public java.io.BufferedWriter getWriter()
Return the buffered writer.


close

public void close()
Method to close the buffered writer.


setHidden

public void setHidden(boolean hide)
Write objects as hidden parameters or not.


setModifiable

public void setModifiable(boolean mod)
Write objects as modifiable parameters or not.


setVerbose

public void setVerbose(boolean verb)
Write verbose versions of objects


startControlForm

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


startControlForm

public void startControlForm(java.lang.String message)
Write out the HTML for the start of a control form with message.

Parameters:
message -


startForm

public void startForm(java.lang.String message)
Write out the HTML start tag for a form, with an (optional) message.

Parameters:
message - to be displayed


endForm

public void endForm()
End form.


makeActionButtons

public void makeActionButtons()
Write out the HTML search toolbar.


makeSubmitButtons

public void makeSubmitButtons()
Write out the HTML job submission toolbar.


makeRequestForm

public void makeRequestForm(ResultSearchPattern pattern)
                     throws JetWebException
Construct an HTML request form containing the parameters of a ResultSearchPattern

Parameters:
pattern - determines parameters for job request form.
Throws:
JetWebException
See Also:
ResultSearchPattern


makeControlForm

public void makeControlForm()
Write out the top-level maintenance options form.


writeOkCancel

public void writeOkCancel()
Write the OK and CANCEL buttons to screens.


writeDirChoiceForm

public void writeDirChoiceForm(java.lang.String suggestion)
Write out run directory selection screen.

Parameters:
suggestion - name for new JobFile


listPendingJobs

public void listPendingJobs()
Write list of pending jobs.


listHiddenPars

public void listHiddenPars(ResultSearchPattern pattern)
Add the generic parameters from the ResultSearchPattern to the HTML form as hidden inputs.

Parameters:
pattern -


forwardTo

public void forwardTo(java.lang.String htmlPath)
Write the necessary HTML to forward to use to the page at htmlPath.


listLogs

protected void listLogs(java.util.Enumeration list)
                 throws java.io.IOException
Throws:
java.io.IOException

writeInputId

public void writeInputId(java.lang.String text,
                         java.lang.String name,
                         java.lang.String hover,
                         java.lang.Integer id)
                  throws JetWebException
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.
Throws:
JetWebException


makeCommonForm

public void makeCommonForm(ResultSearchPattern pattern)
                    throws JetWebException
Throws:
JetWebException

displayList

public void displayList(java.util.List<java.lang.Object> list)
                 throws JetWebException
Send html output of a search to the printwriter specified. Custom data selection.

Parameters:
list - the list of object to write.
Throws:
JetWebException


writeList

public void writeList(java.util.List<java.lang.Object> list)
               throws JetWebException
Write a list of objects.

Parameters:
fitList - to write out
Throws:
JetWebException


writeListContinued

public void writeListContinued(java.lang.String listKey)
writes fit list page subsequent to first page

Parameters:
out - the printwriter to receive output
servletPath - path required for responses from HTML page
listKey - string specifying the list cached in memory.
Throws:
JetWebException


endListPage

public void endListPage(java.lang.String resultKey)
Write footer for a list of Fits with a forward link pabes on the fitKey


display

public void display(java.lang.Object object)
             throws JetWebException
Throws:
JetWebException