PAJES 2.3.9

org.pajes.html
Class Head

java.lang.Object
  extended byorg.pajes.html.Tag
      extended byorg.pajes.html.TraversableElement
          extended byorg.pajes.html.Container
              extended byorg.pajes.html.Head
All Implemented Interfaces:
java.lang.Cloneable, HTML, java.io.Serializable, Traversable

public class Head
extends Container

Generates the >HEAD< and >/HEAD< tags and hold all the HTML objects that appear between them.

See Also:
Serialized Form

Nested Class Summary
 class Head.Base
          Inner class for the <base> tag which only ever appears in the header.
 class Head.Link
          Inner class for the <link> tag which only ever appears in the header.
 class Head.Meta
          Inner class for the <meta> tag.
 class Head.Title
          Inner class for the <title> tag which only ever appears in the header.
 
Field Summary
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
Head()
          Builds the HTML header section of the page.
Head(java.lang.String title)
          Builds the HTML header section of the page.
Head(java.lang.String title, java.lang.String baseTarget)
          Builds the HTML header section of the page.
Head(java.lang.String title, java.lang.String baseTarget, java.lang.String clientSideJavaScript)
          Builds the HTML header section of the page.
 
Method Summary
 Container add(HTML htmlObject)
          Over-rides add() in Container.
 Head addAutoRefresh(int seconds)
          Adds an automatic refresh of the page.
 Head addAutoRefresh(int seconds, java.lang.String destinationURL)
          Adds an automatic refresh of the page, and redirects the browser to another URL.
 Head addBase(java.lang.String target)
          Adds the BASE header tag.
 Head addBase(java.lang.String href, java.lang.String target)
          Adds the BASE header tag.
 Head addClientSideJavaScript(java.lang.String clientSideJavaScript)
          Adds a line of JavaScript to the SCRIPT section in the page header
 Head addLink(java.lang.String relationship, java.lang.String sourceURL, java.lang.String type)
          Adds the LINK header tag.
 Head addLink(java.lang.String relationship, java.lang.String sourceURL, java.lang.String type, java.lang.String id)
          Adds the LINK header tag.
 Head addMeta(java.lang.String name, java.lang.String content)
          Adds the META header tag.
 Head addMeta(java.lang.String name, java.lang.String content, java.lang.String httpEquivalent)
          Adds the META header tag.
 Head addMeta(java.lang.String name, java.lang.String content, java.lang.String httpEquivalent, java.lang.String id)
          Adds the META header tag.
 Head addPageTitle(java.lang.String title)
          Adds a page title.
 Head addStyleSheetLink(java.lang.String sourceURL)
          Adds a new style sheet link.
 Container clear()
          Empties the container.
 Head.Base getBaseTag()
          Returns the >BASE< header tag.
static java.lang.String getDefaultBaseHREF(javax.servlet.http.HttpServletRequest request)
          Returns a concatenated string of the following request values: If getHeader("Host") returns null: getScheme() "://" getServerName() ":" getServerPort() getContextPath() '/' If getHeader("Host") returns a host: getScheme() "://" getHeader("Host") getContextPath() '/'
 Head.Link[] getLinkTags()
          Returns an array of the >LINK< header tags.
 Head.Meta[] getMetaTags()
          Returns an array of the >LINK< header tags.
 java.lang.String getPageTitle()
          Returns the page title from the HTML header section of the page.
 Script getScript()
          Returns the instance of >SCRIPT< in this header.
 Script[] getScripts()
          Returns an array of the >SCRIPT< header tags.
 StyleSheet getStyleSheet()
          Returns the instance of >STYLE< in this header.
 Container replace(Container container)
          Deletes all the objects in this container, and replaces them with the cloned objects from another container.
 Head setPageTitle(java.lang.String title)
          Sets the page title in the HTML header section of the page
 Head useDefaultBaseHREF(boolean on)
          Determines whether the base tag href= attribute will be automatically generated or not.
 void write(Browser browser)
          Prints the <HEAD> tags and any contained objects to the browser.
 
Methods inherited from class org.pajes.html.Container
add, add, add, addContent, clone, delete, delete, destroy, get, getContent, getContents, getPosition, insert, set, setContent, setContent, size, writeContent
 
Methods inherited from class org.pajes.html.TraversableElement
dump, dump, getAll, getFieldByName, getFirstFieldByName, getFirstTagByAttribute, getFirstTagByClass, getFirstTagByID, getFirstTagByName, getTagByAttribute, getTagByClass, getTagByID, getTagByName, setWritable
 
Methods inherited from class org.pajes.html.Tag
addAttribute, addAttributes, addAttributes, clearAttribute, clearAttributes, getAttribute, getAttributes, getAttributeSet, getContainer, getDocument, getId, getOnClickHandler, getOnDBLClickHandler, getOnKeyDownHandler, getOnKeyPressHandler, getOnKeyUpHandler, getOnMouseDownHandler, getOnMouseOutHandler, getOnMouseOverHandler, getOnMouseUpHandler, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, init, initAttributes, isWritable, isWritable, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContainer, setId, setOnClickHandler, setOnDBLClickHandler, setOnKeyDownHandler, setOnKeyPressHandler, setOnKeyUpHandler, setOnMouseDownHandler, setOnMouseOutHandler, setOnMouseOverHandler, setOnMouseUpHandler, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Head

public Head()
Builds the HTML header section of the page.


Head

public Head(java.lang.String title)
Builds the HTML header section of the page.

Parameters:
title - the page title.

Head

public Head(java.lang.String title,
            java.lang.String baseTarget)
Builds the HTML header section of the page.

Parameters:
title - the page title
baseTarget - is the default frame name into which URLs are to be loaded.

Head

public Head(java.lang.String title,
            java.lang.String baseTarget,
            java.lang.String clientSideJavaScript)
Builds the HTML header section of the page.

Parameters:
title - the page title
baseTarget - is the default frame name into which URLs are to be loaded.
clientSideJavaScript - the file name of a file of JavaScript
Method Detail

getBaseTag

public Head.Base getBaseTag()
Returns the >BASE< header tag.

Returns:
the BASE header tag.

getDefaultBaseHREF

public static java.lang.String getDefaultBaseHREF(javax.servlet.http.HttpServletRequest request)
Returns a concatenated string of the following request values: If getHeader("Host") returns null: If getHeader("Host") returns a host:

Parameters:
request - the object that contains the request the client made of the servlet.
Returns:
a String specifying the base portion of the request URL that indicates the scheme, server, port and context of the request.

getLinkTags

public Head.Link[] getLinkTags()
Returns an array of the >LINK< header tags.

Returns:
an array of the LINK header tags.

getMetaTags

public Head.Meta[] getMetaTags()
Returns an array of the >LINK< header tags.

Returns:
an array of the LINK header tags.

setPageTitle

public Head setPageTitle(java.lang.String title)
Sets the page title in the HTML header section of the page

Parameters:
title - The new title value
Returns:
the modified Head object.

getPageTitle

public java.lang.String getPageTitle()
Returns the page title from the HTML header section of the page.

Returns:
the page title.

getScript

public Script getScript()
Returns the instance of >SCRIPT< in this header.

Returns:
the instance of Script in this header.

getScripts

public Script[] getScripts()
Returns an array of the >SCRIPT< header tags.

Returns:
an array of the SCRIPT header tags.

getStyleSheet

public StyleSheet getStyleSheet()
Returns the instance of >STYLE< in this header.

Returns:
the instance of StyleSheet in this header.

add

public Container add(HTML htmlObject)
Over-rides add() in Container.

Overrides:
add in class Container
Parameters:
htmlObject - - the Object to add (eg. doc.add(new Body();)
Returns:
the modified Container object;

addAutoRefresh

public Head addAutoRefresh(int seconds)
Adds an automatic refresh of the page.

Parameters:
seconds - the number of seconds to wait before automatically refreshing the page.
Returns:
the modified Head object.

addAutoRefresh

public Head addAutoRefresh(int seconds,
                           java.lang.String destinationURL)
Adds an automatic refresh of the page, and redirects the browser to another URL.

Parameters:
seconds - the number of seconds to wait before automatically refreshing the page.
destinationURL - the fully qualified absolute document URL which will be displayed after the specifed time.
Returns:
the modified Head object.

addBase

public Head addBase(java.lang.String target)
Adds the BASE header tag. The <base> tag defines the default base URL for all anchors in the document.

Parameters:
target - is the default frame name into which URLs are to be loaded.
Returns:
the modified Head object.

addBase

public Head addBase(java.lang.String href,
                    java.lang.String target)
Adds the BASE header tag. The <base> tag defines the default base URL for all anchors in the document.

Parameters:
href - is used to define the absolute URL against which relative URLs are based within the document.
target - is the default frame name into which URLs are to be loaded.
Returns:
the modified Head object.

addClientSideJavaScript

public Head addClientSideJavaScript(java.lang.String clientSideJavaScript)
Adds a line of JavaScript to the SCRIPT section in the page header

Parameters:
clientSideJavaScript - The feature to be added to the ClientSideJavaScript attribute
Returns:
the modified Head object.

addLink

public Head addLink(java.lang.String relationship,
                    java.lang.String sourceURL,
                    java.lang.String type)
Adds the LINK header tag. The >LINK< tag defines the relationship between the current document and another in a Web collection.

Parameters:
relationship - defines the relationship between the current element and the destination of the link
sourceURL - the URL of the destination link
type - the type of Link
Returns:
the modified Head object.

addLink

public Head addLink(java.lang.String relationship,
                    java.lang.String sourceURL,
                    java.lang.String type,
                    java.lang.String id)
Adds the LINK header tag. The >LINK< tag defines the relationship between the current document and another in a Web collection.

Parameters:
relationship - defines the relationship between the current element and the destination of the link
sourceURL - the URL of the destination link
type - the type of Link
id - the id attribute
Returns:
the modified Head object.

addMeta

public Head addMeta(java.lang.String name,
                    java.lang.String content)
Adds the META header tag. The >META< tag defines name/value pairs in the document header.

Parameters:
name - the name of the name/value pair.
content - the value of the name/value pair.
Returns:
the modified Head object.

addMeta

public Head addMeta(java.lang.String name,
                    java.lang.String content,
                    java.lang.String httpEquivalent)
Adds the META header tag. The >META< tag defines name/value pairs in the document header.

Parameters:
name - the name of the name/value pair.
content - the value of the name/value pair.
httpEquivalent - supplies a name for the name/value pair and instructs the server to include the name/value pair in the MIME document header that is passed to the browser before sending the actual document.
Returns:
the modified Head object.

addMeta

public Head addMeta(java.lang.String name,
                    java.lang.String content,
                    java.lang.String httpEquivalent,
                    java.lang.String id)
Adds the META header tag. The >META< tag defines name/value pairs in the document header.

Parameters:
name - the name of the name/value pair.
content - the value of the name/value pair.
httpEquivalent - supplies a name for the name/value pair and instructs the server to include the name/value pair in the MIME document header that is passed to the browser before sending the actual document.
id - the id attribute
Returns:
the modified Head object.

addPageTitle

public Head addPageTitle(java.lang.String title)
Adds a page title.

Parameters:
title - The new title.
Returns:
the modified Head object.

addStyleSheetLink

public Head addStyleSheetLink(java.lang.String sourceURL)
Adds a new style sheet link.

Parameters:
sourceURL - the URL of the style sheet.
Returns:
the modified Head object.

clear

public Container clear()
Description copied from class: Container
Empties the container.

Overrides:
clear in class Container
Returns:
The modified Container instance.
See Also:
Container.clear()

replace

public Container replace(Container container)
Deletes all the objects in this container, and replaces them with the cloned objects from another container.

Overrides:
replace in class Container
Parameters:
container - the Container from which objects are to be copied.
Returns:
the modified Container object.

useDefaultBaseHREF

public Head useDefaultBaseHREF(boolean on)
Determines whether the base tag href= attribute will be automatically generated or not.

Parameters:
on - if true (the default), the base tag href= attribute will be automatically set from HttpServletRequest.getContextPath(), even if the href= attribute has already been explicityly defined . Set to false to turn off this behaviour and respect any defined href= attributes.
Returns:
the modified Head object.

write

public void write(Browser browser)
           throws java.io.IOException
Prints the <HEAD> tags and any contained objects to the browser.

Specified by:
write in interface HTML
Overrides:
write in class Tag
Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an IO exception occurs
See Also:
Tag.setWriteEndTag(boolean), Tag.writeContent(org.pajes.servlet.Browser)

PAJES 2.3.9

Copyright © 2002-2003 Viridian Pty Limited. All Rights Reserved.