: Class Page

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mortbay.HTML
Class Page

    java.lang.Object
      |
      +--com.mortbay.HTML.Element
            |
            +--com.mortbay.HTML.Composite
                  |
                  +--com.mortbay.HTML.Page

Direct Known Subclasses:
  FrameSet, JettyLaF

public class Page
extends Composite

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.

PageFactory classes can be statically registered with the Page class and these are used to instantiate Pages in the getPage method.

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.

Version:
  $Id: Page.java,v 2.5 1999/09/22 15:08:41 gregw Exp $
Author:
  Greg Wilkins
See Also:
  `Composite`

Field Summary
`static java.lang.String` | `Back`
`static java.lang.String` | `BaseUrl`
`static java.lang.String` | `BgColour`
`static java.lang.String` | `Content`
`static java.lang.String` | `ContentSize`
`static java.lang.String` | `FgColour`
`static java.lang.String` | `FileBase`
`static java.lang.String` | `Footer`
`static java.lang.String` | `FooterSize`
`static java.lang.String` | `Header`
`static java.lang.String` | `HeaderSize`
`static java.lang.String` | `Heading`
`static java.lang.String` | `Help`
`static java.lang.String` | `HighlightColour`
`static java.lang.String` | `Home`
`static java.lang.String` | `LeftMargin`
`static java.lang.String` | `LeftMarginSize`
`static java.lang.String` | `Margin`
`static java.lang.String` | `MarginSize`
`static java.lang.String` | `Next`
`static java.lang.String` | `NoTitle`
`static java.lang.String` | `PageType`
`static java.lang.String` | `Prev`
`protected java.util.Hashtable` | `properties`
`static java.lang.String` | `Request`
`static java.lang.String` | `Response`
`static java.lang.String` | `RightMargin`
`static java.lang.String` | `RightMarginSize`
`static java.lang.String` | `Section`
`static java.lang.String` | `Target`
`static java.lang.String` | `Title`
`static java.lang.String` | `Up`

Fields inherited from class com.mortbay.HTML.Composite
`elements, nest`

Fields inherited from class com.mortbay.HTML.Element
`ALIGN, attributeMap, BGCOLOR, BOTTOM, CENTER, CLASS, COLOR, HEIGHT, ID, LEFT, MIDDLE, noAttributes, RIGHT, SIZE, STYLE, TOP, VALIGN, WIDTH`

Constructor Summary
`Page()`
`Page(java.lang.String title)`
`Page(java.lang.String title, java.lang.String attributes)`

Method Summary
`Page` | `addHeader(java.lang.Object o)` Add element or object to the page header
`static void` | `addPageFactory(PageFactory f)` Add a PageFactory to the static factory list.
`void` | `addSection(java.lang.String section, Composite composite)` Set a composite as a named section and add it to the contents of the page
`void` | `addTo(java.lang.String section, java.lang.Object element)` Add content to a named sections.
`protected void` | `completeSections()` This call back is called just before writeHeaders() actually writes the HTML page headers.
`static void` | `delPageFactory(PageFactory f)` Delete a PageFactory from the static factory list.
`void` | `flush(java.io.Writer out)`
`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.
`static java.lang.String` | `getDefaultPageType()` Get default Page The default Page is set per JVM
`static Page` | `getPage(java.lang.String name, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)` Get a new Page instance from a Page factory by calling manufacturePage().
`Composite` | `getSection(java.lang.String section)` Get a composite as a named section.
`static Page` | `manufacturePage(java.lang.String name, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)` Get a new Page instance from a Page factory by a named Page specialization of Page.
`java.util.Dictionary` | `properties()` Access the page properties.
`void` | `rewind()`
`Page` | `setBackGroundColor(java.lang.String color)` Set page background color
`Page` | `setBackGroundImage(java.lang.String bg)` Set page background image
`Page` | `setBase(java.lang.String target, java.lang.String href)` Set the URL Base for the Page
`static void` | `setDefaultPageType(java.lang.String name)` set default Page The default Page is set per JVM
`void` | `setSection(java.lang.String section, Composite composite)` Set a composite as a named section.
`Page` | `title(java.lang.String title)` Set page title
`void` | `write(java.io.Writer out)` Write the entire page by calling: writeHtmlHead(out) writeBodyTag(out) writeElements(out) writeHtmlEnd(out)
`void` | `write(java.io.Writer out, java.lang.String section, boolean endHtml)` Write page section The page is written containing only the named section.
`void` | `writeBodyTag(java.io.Writer out)` Write HTML page body tag Write tags <BODY page attributes>.
`void` | `writeElements(java.io.Writer out)` Write any body elements of the page
`void` | `writeHtmlEnd(java.io.Writer out)` Write end BODY and end HTML tags
`void` | `writeHtmlHead(java.io.Writer out)` Write HTML page head tags Write tags <HTML><HEAD> ....

Methods inherited from class com.mortbay.HTML.Composite
`add, contents, nest, replace, reset, setNest, size, unnest`

Methods inherited from class com.mortbay.HTML.Element
`attribute, attribute, attribute, attributes, attributes, bgColor, bottom, center, color, cssClass, cssID, height, height, height, left, middle, right, setAttributesFrom, size, size, style, top, toString, width, width, width, write, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### Request

    public static final java.lang.String Request

### Response

    public static final java.lang.String Response

### Header

    public static final java.lang.String Header

### Title

    public static final java.lang.String Title

### Section

    public static final java.lang.String Section

### HeaderSize

    public static final java.lang.String HeaderSize

### Footer

    public static final java.lang.String Footer

### FooterSize

    public static final java.lang.String FooterSize

### Content

    public static final java.lang.String Content

### ContentSize

    public static final java.lang.String ContentSize

### Margin

    public static final java.lang.String Margin

### MarginSize

    public static final java.lang.String MarginSize

### LeftMargin

    public static final java.lang.String LeftMargin

### LeftMarginSize

    public static final java.lang.String LeftMarginSize

### RightMargin

    public static final java.lang.String RightMargin

### RightMarginSize

    public static final java.lang.String RightMarginSize

### Help

    public static final java.lang.String Help

### Home

    public static final java.lang.String Home

### Heading

    public static final java.lang.String Heading

### Up

    public static final java.lang.String Up

### Prev

    public static final java.lang.String Prev

### Next

    public static final java.lang.String Next

### Back

    public static final java.lang.String Back

### Target

    public static final java.lang.String Target

### BaseUrl

    public static final java.lang.String BaseUrl

### FgColour

    public static final java.lang.String FgColour

### BgColour

    public static final java.lang.String BgColour

### HighlightColour

    public static final java.lang.String HighlightColour

### FileBase

    public static final java.lang.String FileBase

### PageType

    public static final java.lang.String PageType

### NoTitle

    public static final java.lang.String NoTitle

### properties

    protected java.util.Hashtable properties

Constructor Detail

### Page

    public Page()

### Page

    public Page(java.lang.String title)

### Page

    public Page(java.lang.String title,
                java.lang.String attributes)

Method Detail

### title

    public Page title(java.lang.String title)

  Set page title
  Returns:
    This Page (for chained commands)

### addHeader

    public Page addHeader(java.lang.Object o)

  Add element or object to the page header
  Parameters:
    `o` - The Object to add. If it is a String or Element, it is added directly, otherwise toString() is called.
  Returns:
    This Page (for chained commands)

### setBackGroundImage

    public final Page setBackGroundImage(java.lang.String bg)

  Set page background image
  Returns:
    This Page (for chained commands)

### setBackGroundColor

    public final Page setBackGroundColor(java.lang.String color)

  Set page background color
  Returns:
    This Page (for chained commands)

### setBase

    public final Page setBase(java.lang.String target,
                              java.lang.String href)

  Set the URL Base for the Page
  Parameters:
    `target` - Default link target, null if none.
    `href` - Default absolute href, null if none.
  Returns:
    This Page (for chained commands)

### write

    public void write(java.io.Writer out)
               throws java.io.IOException

  Write the entire page by calling:
  writeHtmlHead(out)
  writeBodyTag(out)
  writeElements(out)
  writeHtmlEnd(out)
  Overrides:
    write in class Composite
  Tags copied from class: Composite
  Parameters:
    `out` - Writer to write the element to.

### writeHtmlHead

    public void writeHtmlHead(java.io.Writer out)
                       throws java.io.IOException

  Write HTML page head tags Write tags <HTML><HEAD> .... </HEAD>

### writeBodyTag

    public void writeBodyTag(java.io.Writer out)
                      throws java.io.IOException

  Write HTML page body tag Write tags <BODY page attributes>.

### writeHtmlEnd

    public void writeHtmlEnd(java.io.Writer out)
                      throws java.io.IOException

  Write end BODY and end HTML tags

### writeElements

    public void writeElements(java.io.Writer out)
                       throws java.io.IOException

  Write any body elements of the page

### write

    public void write(java.io.Writer out,
                      java.lang.String section,
                      boolean endHtml)
               throws java.io.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.

### flush

    public void flush(java.io.Writer out)
               throws java.io.IOException

### rewind

    public void rewind()

### properties

    public java.util.Dictionary properties()

  Access the page properties. It is up to a derived Page class to interpret these properties.

### 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

### setSection

    public void setSection(java.lang.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.

### addSection

    public void addSection(java.lang.String section,
                           Composite composite)

  Set a composite as a named section and add it to the contents of the page

### getSection

    public Composite getSection(java.lang.String section)

  Get a composite as a named section.

### addTo

    public void addTo(java.lang.String section,
                      java.lang.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.

### addPageFactory

    public static void addPageFactory(PageFactory f)

  Add a PageFactory to the static factory list. This is used by the getPage() method when creating a new page instance.

### delPageFactory

    public static void delPageFactory(PageFactory f)

  Delete a PageFactory from the static factory list.

### manufacturePage

    public static Page manufacturePage(java.lang.String name,
                                       javax.servlet.ServletRequest request,
                                       javax.servlet.ServletResponse response)
                                throws java.lang.ClassNotFoundException,
                                       java.lang.InstantiationException,
                                       java.lang.IllegalAccessException,
                                       java.lang.ClassCastException

  Get a new Page instance from a Page factory by a named Page specialization of Page. If no factory creates the page required, then the name is tried as a ClassName.
  Parameters:
    `name` - The name of the page to pass to any registered PageFactories, otherwise the class name.
    `request` - The request that this page is being created for. The request can be used to select or tailor the that page and it is also placed in the pages Request property.

### getPage

    public static Page getPage(java.lang.String name,
                               javax.servlet.ServletRequest request,
                               javax.servlet.ServletResponse response)

  Get a new Page instance from a Page factory by calling manufacturePage(). If any error occurs, a vanilla page is returned.
  Parameters:
    `name` - The name of the page to pass to any registered PageFactories, otherwise the class name.
    `request` - The request that this page is being created for. The request can be used to select or tailor the that page and it is also placed in the pages Request property.

### getDefaultPageType

    public static java.lang.String getDefaultPageType()

  Get default Page The default Page is set per JVM

### setDefaultPageType

    public static void setDefaultPageType(java.lang.String name)

  set default Page The default Page is set per JVM

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD