prog.utils
Class WebPage

java.lang.Object
  |
  +--prog.utils.WebPage
Direct Known Subclasses:
WebPagePhoons

public class WebPage
extends java.lang.Object

A WebPage object enables the setting of filename, heading, keywords, background image and guts of a web page and generates a String containing the HTML tags for a completed web page.

Author:
John E. Darrow (c) 2000, 2001

Field Summary
static java.util.Hashtable lookupNames
          Information about names taken so far.
 
Constructor Summary
WebPage(java.lang.String title, java.lang.String filename)
          Sets the title and filename of the web page.
 
Method Summary
static void main(java.lang.String[] args)
           
 java.lang.String makeHTML(java.lang.String guts)
          Returns a String containing the HTML expressions for the entire web page, saving it in the file named via setFilename() or the constructor.
 void prependMeta(java.lang.String additionalMeta)
          Inserts the HTML expression contained in additionalMeta into the default META expression.
static java.lang.String[] queryBaseName(java.lang.String inStr)
          Determines what the basename would be for the HTML file without registering it.
static void setBkgdImage(java.lang.String backgroundImage)
          Sets the image to be used for the background in the <BODY> expression.
 void setFilename(java.lang.String filename)
          Sets the filename for the HTML file.
 void setKeywords(java.lang.String keywords)
          Inserts the keywords into the META tag expression for keywords.
 void setPreloadImages(java.util.Vector imageHrefs)
          Builds an expression that appears in the <BODY> statement.
static java.lang.String toBaseName(java.lang.String inStr)
          Converts the input phrase into a lowercase expression suitable for use as the base or beginning portion of an HTML filename.
static java.lang.String toFilename(java.lang.String inStr)
          Converts the input phrase into an HTML filename, using toBaseName(String) to form the base or beginning portion of the HTML filename from the input phrase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lookupNames

public static java.util.Hashtable lookupNames
Information about names taken so far. The key is the basename. The element is the last number appended to that basename to make it unique. Exception: an element value of 1 means the basename was used for the first time without appending a number.
Constructor Detail

WebPage

public WebPage(java.lang.String title,
               java.lang.String filename)
Sets the title and filename of the web page.
Method Detail

setFilename

public void setFilename(java.lang.String filename)
Sets the filename for the HTML file.

prependMeta

public void prependMeta(java.lang.String additionalMeta)
Inserts the HTML expression contained in additionalMeta into the default META expression. The default META expression represents any keywords set via setKeywords().

setKeywords

public void setKeywords(java.lang.String keywords)
Inserts the keywords into the META tag expression for keywords.

setBkgdImage

public static void setBkgdImage(java.lang.String backgroundImage)
Sets the image to be used for the background in the <BODY> expression.

makeHTML

public java.lang.String makeHTML(java.lang.String guts)
Returns a String containing the HTML expressions for the entire web page, saving it in the file named via setFilename() or the constructor. The header includes META tags set via setKeywords(), prependMeta(), and setBkgdImage().
Parameters:
guts - The HTML tags to be inserted between <BODY> and </BODY>.

toFilename

public static java.lang.String toFilename(java.lang.String inStr)
Converts the input phrase into an HTML filename, using toBaseName(String) to form the base or beginning portion of the HTML filename from the input phrase.

toBaseName

public static java.lang.String toBaseName(java.lang.String inStr)
Converts the input phrase into a lowercase expression suitable for use as the base or beginning portion of an HTML filename. The name is registered so that a repeat of the same input expression results in a different basename.

If the input text is one word, that word becomes the first name of the file. For multiple words, up to the first 6 letters of the first three words are used to form the first name. The resultant filename is added to lookupNames.


queryBaseName

public static java.lang.String[] queryBaseName(java.lang.String inStr)
Determines what the basename would be for the HTML file without registering it.
See Also:
toBaseName(String)

setPreloadImages

public void setPreloadImages(java.util.Vector imageHrefs)
Builds an expression that appears in the <BODY> statement. 'imageHrefs' is a collection of Strings of this form:
<p> <relativeLinkToImage>

main

public static void main(java.lang.String[] args)