edu.whoi.ursa.argoDatabase.servletUtil.page
Class BasePage

java.lang.Object
  extended by edu.whoi.ursa.argoDatabase.servletUtil.page.BasePage
Direct Known Subclasses:
ArrayStatisticsPage.ArrayStatistics, Download._Download, GDACPage._GDAC, GreyListPage._GreyList, IndexPage._SearchPage, IndexPage._SplashPage, IndexPage.IndividualRecord, LoginPage._LoginForm, LoginPage._LoginHandler, LoginPage._Logout, Map._ActiveWHOIMap, ProtectedPage, UnderConstruction._UnderConstruction

public abstract class BasePage
extends java.lang.Object

Servlet implementation class BasePage


Nested Class Summary
static class BasePage.NavMenuItem
          Navigation menu item.
static class BasePage.OverviewItem
          Overview Item class
 class BasePage.Script
           
 
Field Summary
protected  org.w3c.dom.Element _actualContent
           
protected  org.w3c.dom.Element _body
           
protected  org.w3c.dom.Element _content
           
protected  org.w3c.dom.Element _contentHeader
           
protected  org.w3c.dom.Element _contentHeaderWrapper
           
protected  org.w3c.dom.Element _contentPane
           
protected  org.w3c.dom.Element _contentWrapper
           
private  java.util.List<java.lang.String> _errors
           
protected  org.w3c.dom.Element _footer
           
protected  org.w3c.dom.Element _footerWrapper
           
protected  org.w3c.dom.Element _head
           
protected  org.w3c.dom.Element _headerWrapper
           
protected  org.w3c.dom.Element _html
           
protected  org.w3c.dom.Element _loading
           
protected  org.w3c.dom.Element _logo
           
protected  org.w3c.dom.Element _logoWrapper
           
protected  org.w3c.dom.Element _navMenuWrapper
           
protected  org.w3c.dom.Element _search
           
protected  org.w3c.dom.Element _title
           
protected  org.w3c.dom.Element _userInfo
           
protected  org.w3c.dom.Element _userInfoWrapper
           
private static BasePage.NavMenuItem argoDBMenuRoot
          Navigation menu hierarcy
protected static java.lang.String authorized
           
private  java.lang.Boolean customResponse
           
private static javax.xml.parsers.DocumentBuilderFactory dfactory
           
private static java.lang.String DOCTYPE
           
protected  org.w3c.dom.Document document
           
protected  javax.servlet.http.HttpSession httpSession
           
protected  java.lang.String pageTitle
           
protected  java.util.Map<java.lang.String,java.lang.String[]> parameterMap
           
private static java.util.Properties properties
           
protected  javax.servlet.http.HttpServletRequest request
           
protected static java.lang.String requrl
           
protected  javax.servlet.http.HttpServletResponse response
           
protected  java.util.List<BasePage.Script> scripts
           
protected  java.util.List<java.lang.String> styleLinks
           
private static javax.xml.transform.TransformerFactory tfactory
           
 
Constructor Summary
BasePage()
           
BasePage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
BasePage(java.lang.String title, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          BasePage constructor
 
Method Summary
private  org.w3c.dom.Element addAbyss()
           
private  org.w3c.dom.Element addArgoFloat()
           
static void addOverviewDateItem(org.w3c.dom.Element element, java.lang.String label, java.lang.String description, java.util.Calendar date)
          Add overview item to element
static void addOverviewItem(org.w3c.dom.Element element, java.lang.String label, java.lang.String description, java.lang.Object item)
          Add overview item to element
static void addOverviewItemNarrowLabel(org.w3c.dom.Element element, java.lang.String label, java.lang.String description, java.lang.Object item)
          Add overview item to element
static void addOverviewItemWideLabel(org.w3c.dom.Element element, java.lang.String label, java.lang.String description, java.lang.Object item)
          Add overview item to element
static void addOverviewItemWideLabel(org.w3c.dom.Element element, java.lang.String label, java.lang.String description, java.lang.Object item, java.lang.String href)
          Add overview item to element
static void addOverviewLinkItem(org.w3c.dom.Element element, java.lang.String label, java.lang.String description, java.lang.Object item, java.lang.String href)
          Add overview item to element
static org.w3c.dom.Element createContentPane(org.w3c.dom.Element element, java.lang.String id)
           
static org.w3c.dom.Element createContentPane(org.w3c.dom.Element element, java.lang.String id, java.lang.String heading)
           
static org.w3c.dom.Element[] createNavigableContentPane(org.w3c.dom.Element element, java.lang.String cls, java.lang.String heading)
          create content pane
protected  void error(java.lang.String... errors)
           
protected  void finalizeHtml()
          Finalize html
protected abstract  void generateContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  org.w3c.dom.Element generateContentHeader()
          Generate content header
protected  org.w3c.dom.Element generateFooterContent()
          generate footer content
protected  org.w3c.dom.Element generateNavMenu()
           
private  org.w3c.dom.Element generateSearch()
          Generate search div
private  org.w3c.dom.Element generateUserDiv()
          generate user div
 java.lang.Object getAttribute(java.lang.String key)
           
 javax.servlet.http.HttpSession getHttpSession()
           
protected  java.lang.String getParameter(java.lang.String key)
          Retrieve parameter from HttpServletRequest as String.
protected  java.lang.String[] getParameterAsArray(java.lang.String key)
          Retrieve parameter from HttpServletRequest as Array of Strings.
protected  java.lang.Integer[] getParameterAsArrayOfIntegers(java.lang.String key)
          Retrieve parameter from HttpServletRequest as Integer.
protected  java.util.Calendar getParameterAsCalendar(java.lang.String key)
          Retrieve parameter from HttpServletRequest as Float.
protected  java.lang.Float getParameterAsFloat(java.lang.String key)
          Retrieve parameter from HttpServletRequest as Float.
protected  java.lang.Integer getParameterAsInteger(java.lang.String key)
          Retrieve parameter from HttpServletRequest as Integer.
protected  java.lang.Long getParameterAsLong(java.lang.String key)
          Retrieve parameter from HttpServletRequest as Long.
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
           
protected  User getUser()
           
protected  java.lang.Integer getUserId()
           
protected  void initializeDocument()
           
protected  org.w3c.dom.Element initializeHTML()
           
protected  void initializePage()
           
protected  java.lang.Boolean isSet(java.lang.String key)
          Is parameter set?
private  void printErrors()
          print errors to floating div
 void removeAttribute(java.lang.String key)
           
protected  void respond(javax.servlet.http.HttpServletResponse response)
           
protected  void respondCustom(javax.servlet.http.HttpServletResponse response)
           
protected  java.io.OutputStream respondTextFile(javax.servlet.http.HttpServletResponse response, java.lang.String filename)
           
 void setAttribute(java.lang.String key, java.lang.Object object)
           
 void setCustomResponse(java.lang.Boolean customResponse)
           
protected  void setLinksAndStyles()
          Set css styles and scripts
 void setScripts(BasePage.Script... scripts)
           
 void setStyleLinks(java.lang.String... styleLinks)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

authorized

protected static final java.lang.String authorized
See Also:
Constant Field Values

requrl

protected static final java.lang.String requrl
See Also:
Constant Field Values

argoDBMenuRoot

private static final BasePage.NavMenuItem argoDBMenuRoot
Navigation menu hierarcy


_errors

private java.util.List<java.lang.String> _errors

pageTitle

protected java.lang.String pageTitle

styleLinks

protected java.util.List<java.lang.String> styleLinks

scripts

protected java.util.List<BasePage.Script> scripts

DOCTYPE

private static final java.lang.String DOCTYPE
See Also:
Constant Field Values

dfactory

private static final javax.xml.parsers.DocumentBuilderFactory dfactory

document

protected org.w3c.dom.Document document

tfactory

private static final javax.xml.transform.TransformerFactory tfactory

properties

private static final java.util.Properties properties

parameterMap

protected java.util.Map<java.lang.String,java.lang.String[]> parameterMap

_loading

protected org.w3c.dom.Element _loading

_html

protected org.w3c.dom.Element _html

_head

protected org.w3c.dom.Element _head

_title

protected org.w3c.dom.Element _title

_body

protected org.w3c.dom.Element _body

_headerWrapper

protected org.w3c.dom.Element _headerWrapper

_userInfoWrapper

protected org.w3c.dom.Element _userInfoWrapper

_userInfo

protected org.w3c.dom.Element _userInfo

_navMenuWrapper

protected org.w3c.dom.Element _navMenuWrapper

_logoWrapper

protected org.w3c.dom.Element _logoWrapper

_logo

protected org.w3c.dom.Element _logo

_search

protected org.w3c.dom.Element _search

_contentWrapper

protected org.w3c.dom.Element _contentWrapper

_content

protected org.w3c.dom.Element _content

_actualContent

protected org.w3c.dom.Element _actualContent

_contentPane

protected org.w3c.dom.Element _contentPane

_contentHeaderWrapper

protected org.w3c.dom.Element _contentHeaderWrapper

_contentHeader

protected org.w3c.dom.Element _contentHeader

_footerWrapper

protected org.w3c.dom.Element _footerWrapper

_footer

protected org.w3c.dom.Element _footer

httpSession

protected javax.servlet.http.HttpSession httpSession

request

protected javax.servlet.http.HttpServletRequest request

response

protected javax.servlet.http.HttpServletResponse response

customResponse

private java.lang.Boolean customResponse
Constructor Detail

BasePage

public BasePage()

BasePage

public BasePage(javax.servlet.http.HttpServletRequest request,
                javax.servlet.http.HttpServletResponse response)
Parameters:
request -
response -

BasePage

public BasePage(java.lang.String title,
                javax.servlet.http.HttpServletRequest request,
                javax.servlet.http.HttpServletResponse response)
BasePage constructor

Parameters:
title -
Method Detail

addOverviewDateItem

public static void addOverviewDateItem(org.w3c.dom.Element element,
                                       java.lang.String label,
                                       java.lang.String description,
                                       java.util.Calendar date)
Add overview item to element

Parameters:
element -
label -
description -
item -

addOverviewItem

public static void addOverviewItem(org.w3c.dom.Element element,
                                   java.lang.String label,
                                   java.lang.String description,
                                   java.lang.Object item)
Add overview item to element

Parameters:
element -
label -
description -
item -

addOverviewLinkItem

public static void addOverviewLinkItem(org.w3c.dom.Element element,
                                       java.lang.String label,
                                       java.lang.String description,
                                       java.lang.Object item,
                                       java.lang.String href)
Add overview item to element

Parameters:
element -
label -
description -
item -

addOverviewItemNarrowLabel

public static void addOverviewItemNarrowLabel(org.w3c.dom.Element element,
                                              java.lang.String label,
                                              java.lang.String description,
                                              java.lang.Object item)
Add overview item to element

Parameters:
element -
label -
description -
item -

addOverviewItemWideLabel

public static void addOverviewItemWideLabel(org.w3c.dom.Element element,
                                            java.lang.String label,
                                            java.lang.String description,
                                            java.lang.Object item)
Add overview item to element

Parameters:
element -
label -
description -
item -

addOverviewItemWideLabel

public static void addOverviewItemWideLabel(org.w3c.dom.Element element,
                                            java.lang.String label,
                                            java.lang.String description,
                                            java.lang.Object item,
                                            java.lang.String href)
Add overview item to element

Parameters:
element -
label -
description -
item -

createContentPane

public static org.w3c.dom.Element createContentPane(org.w3c.dom.Element element,
                                                    java.lang.String id)
Parameters:
element -
id -
Returns:

createContentPane

public static org.w3c.dom.Element createContentPane(org.w3c.dom.Element element,
                                                    java.lang.String id,
                                                    java.lang.String heading)
Parameters:
element -
id -
heading -
Returns:

createNavigableContentPane

public static org.w3c.dom.Element[] createNavigableContentPane(org.w3c.dom.Element element,
                                                               java.lang.String cls,
                                                               java.lang.String heading)
create content pane

Parameters:
element -
label -
description -
item -

addAbyss

private org.w3c.dom.Element addAbyss()

addArgoFloat

private org.w3c.dom.Element addArgoFloat()

error

protected void error(java.lang.String... errors)

finalizeHtml

protected void finalizeHtml()
Finalize html


generateContent

protected abstract void generateContent(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response)
Parameters:
request -
response -

generateContentHeader

protected org.w3c.dom.Element generateContentHeader()
Generate content header

Returns:

generateFooterContent

protected org.w3c.dom.Element generateFooterContent()
generate footer content

Parameters:
element -
Returns:

generateNavMenu

protected org.w3c.dom.Element generateNavMenu()

generateSearch

private org.w3c.dom.Element generateSearch()
Generate search div

Parameters:
_search -
Returns:

generateUserDiv

private org.w3c.dom.Element generateUserDiv()
generate user div

Parameters:
header -
user -
Returns:

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Parameters:
key -
Returns:

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()
Returns:
the httpSession

getParameter

protected java.lang.String getParameter(java.lang.String key)
Retrieve parameter from HttpServletRequest as String.

Parameters:
key -
Returns:
parameter as String. null if parameter is not set

getParameterAsArray

protected java.lang.String[] getParameterAsArray(java.lang.String key)
Retrieve parameter from HttpServletRequest as Array of Strings.

Parameters:
key -
Returns:
parameter as Array of Strings. null if parameter is not set

getParameterAsArrayOfIntegers

protected java.lang.Integer[] getParameterAsArrayOfIntegers(java.lang.String key)
Retrieve parameter from HttpServletRequest as Integer.

Parameters:
key -
Returns:
parameter as Float. null if parameter is not set or if not valid Integer value

getParameterAsCalendar

protected java.util.Calendar getParameterAsCalendar(java.lang.String key)
Retrieve parameter from HttpServletRequest as Float.

Parameters:
key -
Returns:
parameter as Integer. null if parameter is not set or if not valid Float value

getParameterAsFloat

protected java.lang.Float getParameterAsFloat(java.lang.String key)
Retrieve parameter from HttpServletRequest as Float.

Parameters:
key -
Returns:
parameter as Integer. null if parameter is not set or if not valid Float value

getParameterAsInteger

protected java.lang.Integer getParameterAsInteger(java.lang.String key)
Retrieve parameter from HttpServletRequest as Integer.

Parameters:
key -
Returns:
parameter as Float. null if parameter is not set or if not valid Integer value

getParameterAsLong

protected java.lang.Long getParameterAsLong(java.lang.String key)
Retrieve parameter from HttpServletRequest as Long.

Parameters:
key -
Returns:
parameter as Long. null if parameter is not set or if not valid Long value

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Returns:
the parameterMap

getUser

protected User getUser()
Returns:
the user

getUserId

protected java.lang.Integer getUserId()
Returns:
the userid

initializeDocument

protected void initializeDocument()
                           throws javax.xml.parsers.ParserConfigurationException,
                                  java.io.IOException
Throws:
javax.xml.parsers.ParserConfigurationException
java.io.IOException

initializeHTML

protected org.w3c.dom.Element initializeHTML()
Returns:
Element _html

initializePage

protected void initializePage()

isSet

protected java.lang.Boolean isSet(java.lang.String key)
Is parameter set?

Parameters:
key -
Returns:
true if parameter is set, false otherwise

printErrors

private void printErrors()
print errors to floating div


removeAttribute

public void removeAttribute(java.lang.String key)
Parameters:
key -
object -

respond

protected void respond(javax.servlet.http.HttpServletResponse response)
Parameters:
response -

respondCustom

protected void respondCustom(javax.servlet.http.HttpServletResponse response)
Parameters:
response -

respondTextFile

protected java.io.OutputStream respondTextFile(javax.servlet.http.HttpServletResponse response,
                                               java.lang.String filename)
Parameters:
response -
filename -
Returns:

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object object)
Parameters:
key -
object -

setCustomResponse

public void setCustomResponse(java.lang.Boolean customResponse)
Parameters:
customResponse - the customResponse to set

setLinksAndStyles

protected void setLinksAndStyles()
Set css styles and scripts


setScripts

public void setScripts(BasePage.Script... scripts)
Parameters:
scripts - the scripts to set

setStyleLinks

public void setStyleLinks(java.lang.String... styleLinks)
Parameters:
styleLinks - the styleLinks to set

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object