HTML Page.
A HTML Page extends composite with the addition of the HTML Header
tags, fields and elements.
Furthermore, individual parts of the page may be written or the
progressive page be output with flush.
Pages contain parameters and named sections. These are used by
derived Page classes that implement a Look and Feel. Page users
may add to name sections such as "Margin" or "Footer" and set
parameters such as "HelpUrl" without knowledge of how the look and feel
will arrange these. To assist with standard look and feel creation
Page defines a set of standard names for many common parameters
and sections.
If named sections are used, the page constructor or completeSections
must add the named section to the page in the appropriate places.
If named sections are not added to the page, then they can only be
written with an explicit call to write(out,"section",end);
Changes in behaviour to section creation and adding, should be controlled
via page properties.
Back
public static final String Back
BaseUrl
public static final String BaseUrl
BgColour
public static final String BgColour
Content
public static final String Content
ContentSize
public static final String ContentSize
FgColour
public static final String FgColour
Footer
public static final String Footer
FooterSize
public static final String FooterSize
Header
public static final String Header
HeaderSize
public static final String HeaderSize
Heading
public static final String Heading
Help
public static final String Help
HighlightColour
public static final String HighlightColour
Home
public static final String Home
LeftMargin
public static final String LeftMargin
LeftMarginSize
public static final String LeftMarginSize
Margin
public static final String Margin
MarginSize
public static final String MarginSize
Next
public static final String Next
NoTitle
public static final String NoTitle
PageType
public static final String PageType
Prev
public static final String Prev
Request
public static final String Request
Response
public static final String Response
RightMargin
public static final String RightMargin
RightMarginSize
public static final String RightMarginSize
Section
public static final String Section
Target
public static final String Target
Title
public static final String Title
Up
public static final String Up
properties
protected Hashtable properties
addHeader
public Page addHeader(Object o)
Add element or object to the page header.
o
- The Object to add. If it is a String or Element, it is
added directly, otherwise toString() is called.
- This Page (for chained commands)
addSection
public void addSection(String section,
Composite composite)
Set a composite as a named section and add it to the.
contents of the page
addTo
public void addTo(String section,
Object element)
Add content to a named sections. If the named section cannot.
be found, the content is added to the page.
completeSections
protected void completeSections()
This call back is called just before writeHeaders() actually
writes the HTML page headers. It can be implemented by a derived
Page class to complete a named section after the rest of the Page
has been created and appropriate properties set.
flush
public void flush(Writer out)
throws IOException
frameSet
public FrameSet frameSet()
Return the preferred FrameSet to be used with a specialized Page.
The Frames will be named after the sections they are to
contain.
The default implementation returns null
getSection
public Composite getSection(String section)
Get a composite as a named section.
properties
public Dictionary properties()
Access the page properties. It is up to a derived Page class
to interpret these properties.
rewind
public void rewind()
setBackGroundColor
public final Page setBackGroundColor(String color)
Set page background color.
- This Page (for chained commands)
setBackGroundImage
public final Page setBackGroundImage(String bg)
Set page background image.
- This Page (for chained commands)
setBase
public final Page setBase(String target,
String href)
Set the URL Base for the Page.
target
- Default link target, null if none.href
- Default absolute href, null if none.
- This Page (for chained commands)
setSection
public void setSection(String section,
Composite composite)
Set a composite as a named section. Other Page users may.
add to the section by calling addTo(). It is up to the section
creator to add the section to the page in it appropriate position.
title
public Page title(String title)
Set page title.
- This Page (for chained commands)
write
public void write(Writer out)
throws IOException
Write the entire page by calling:
writeHtmlHead(out)
writeBodyTag(out)
writeElements(out)
writeHtmlEnd(out)
- write in interface Composite
write
public void write(Writer out,
String section,
boolean endHtml)
throws IOException
Write page section.
The page is written containing only the named section.
If a head and bodyTag have not been written, then they
are written before the section. If endHtml is true, the
end HTML tag is also written.
If the named section is Content and it cannot be found,
then the normal page contents are written.
writeBodyTag
public void writeBodyTag(Writer out)
throws IOException
Write HTML page body tag.
Write tags <BODY page attributes>.
writeElements
public void writeElements(Writer out)
throws IOException
Write any body elements of the page.
writeHtmlEnd
public void writeHtmlEnd(Writer out)
throws IOException
Write end BODY and end HTML tags.
writeHtmlHead
public void writeHtmlHead(Writer out)
throws IOException
Write HTML page head tags.
Write tags <HTML><head> .... </head>