com.sapportals.htmlb.rendering

Interface IPageContext

All Known Implementing Classes:
PageContext

public interface IPageContext

Title: IPageContext Description: Interface for PageContext classes This defines the interface for the PageContext, the central class for generating output. Actual instances for this interface should be generated using the RendererFactory class which can provide specific implementations depending on context.

Copyright 2004 SAP AG


Field Summary
static String HTMLB_ACTIONURL
           
static String HTMLB_HASCONTENTPADDING
           
static String HTMLB_JSPATH
           
static String HTMLB_LOCALE
           
static String HTMLB_MIMEPATH
           
static String HTMLB_RELAXDOMAIN
           
static String HTMLB_SEC508
           
static String HTMLB_STYLEPATH
           
static String HTMLB_TRAYDESIGN
           
 
Method Summary
 void addPerfCounter(String line)
          adds performance counters written a comments in the HTML source
 void cleanUp()
          deletes temporary file of mime multipart postings.
 Document createDocument(String title)
          create a new document.
 Form createForm()
          create a new form and make it the current form.
 Form createFormDocument(String title)
          create a new document and automatically create a form.
 void endDocument()
          end the generated output.
 void endDocumentBody()
          end the body section of the generated output.
 void endDocumentHead()
          close the head section of the produced HTML.
 void flush()
           
 String getActionUrl()
          get the local or absolute URL path where the form should be posted if not already set
 Object getAttribute(String key)
          get an attribute from the current session
 BrowserType getBrowserId()
          get the BrowserType for the recognized browser/user agent
 ClassLoader getClassLoader()
          Get the class loader assigned to this context.
 ClientInfo getClientInfo()
           
 Component getComponentForId(String elementId)
          returns a reconstructed component for a given id.
 String getComponentIdForLabel(String id)
           
 Component[] getComponents()
          returns all the components that were rebuild
 Event getCurrentEvent()
          return the event from the current request.
 Form getCurrentForm()
          get the current form
 String getCurrentFormId()
          get the ID of the current form (HTML!!!)
 AbstractDataType getDataForComponentId(String elementId)
          get the user input for a given id.
 AbstractDataType getDataForComponentId(String tableId, String elementId, int row)
          get the user input for a given id.
 Document getDocument()
          gets the current document
 boolean getDomainRelaxation()
          Get the flag for domain relaxation.
 IFileParam getFileParam(String name)
           
 MobileWmlCard getHiddenCard()
           
 String getJavascriptPath()
          get the URL path where the Javascript library files can be found.
 String getJavascriptUrl()
          get the full URL for the JavaScript library file for the current user agent.
 Locale getLocale()
          Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
 Enumeration getLocales()
          Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
 com.sap.tc.logging.Location getLogLocation()
          returns the Location object used for logging and tracing
 String getMimePath()
          get the local or absolute URL path where the mimes for the current theme can be found.
 Form getOldForm()
          get the reconstructed form from a request
 String getParameter(String name)
          Returns the value of a request parameter as a String, or null if the parameter does not exist.
 String getParameterForId(String elementId)
          gets the raw parameter value for the component with the specified id.
 Enumeration getParameterNames()
          Returns an Enumeration of String objects containing the names of the parameters contained in this request.
 String[] getParameterValues(String name)
          Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
 String[] getParameterValuesForId(String elementId)
          gets the raw parameter values for the component with the specified id.
 String getParamIdForComponent(Component c)
          get a unique ID for a component.
 String getParamIdForComponent(String componentId)
          get the generated unique ID for a component.
 HashMap getParamList()
          Session: Session based storage for HTMLB context information only needed if isUsingSession will return true
 Object getParent()
          Get the pagecontext's parent e.g.
 Object getRequest()
          get the request object for the current context, e.g.
 ResourceBundle getResourceBundle(String baseName, Locale locale)
          get a ResourceBundle for locale specific texts.
 Object getResponse()
          get the response object for the current context, e.g.
 String getStylePath()
          get the local or absolute URL path where the styles for the current theme can be found.
 HashSet getStylesheets()
          returns the required stylesheets
 String getStylesheetUrl()
          get the full URL for the CSS file for the current user agent.
 Component getTableComponentForId(String tableId, String elementId, int row)
          get a reconstructed component for a given id.
 TrayDesign getTrayDesign()
          returns a object describing the traydesign the page is contained
 Writer getWriter()
          get the java.io.Writer for output operations
 boolean isFileParam(String name)
           
 boolean isHasContentPadding()
           
 boolean isSingleValueParameter(String name)
          Returns if a parameter has only a single value
 boolean isUsingSession()
          Session: used by the control renderers (Form & Inputfield) to find out where to put their data
 void pop()
          temporary solution for mixed-mode, i.e. creation of component/container structures and raw output.
 void push(Container c)
          temporary solution for mixed-mode, i.e. creation of component/container structures and raw output.
 void rebuildComponents()
          rebuilds all the components that were registered at rendering time
 void registerStylesheet(String key)
          register the required style sheets
 void render()
          render the complete document
 void render(Component component)
          render a single component.
 void render(Component component, int selector)
          render an aspect of a single component.
 void renderJavascriptInterface(Component component, String generatedId)
          render Javascript interface of component.
 boolean requiresSection508Rendering()
          checks if additional information according to Section 508 should be rendered in the output stream.
 void setActionUrl(String actionUrl)
          set the URL path where form should be poset
 void setAdvancedAlignment(boolean advancedAlignment)
          aligment compatibility mode default value:false
 void setAttribute(String key, Object value)
          set an attribute in the current session
 void setClassLoader(ClassLoader classLoader)
          Set the class loader for this context.
 void setCurrentForm(Form form)
          set the current form.
 void setDomainRelaxation(boolean relaxDomain)
          Set the domain relaxation for the portal.
 void setFormDefaults(Form form)
          sets the defaults values for the form within the current context.
 void setHasContentPadding(boolean hasContentPadding)
           
 void setJavascriptPath(String javascriptPath)
          set the URL path where the JavaScript libraries can be found
 void setMessageBarAtBodyEnd(boolean messageBarAtBodyEnd)
          sets whether messageBar should be renderted at body start or end.
 void setMimePath(String mimePath)
          set the URL path where the mimes can be found
 void setParent(Object parent)
          Set the pagecontext's parent e.g.
 void setRequest(Object request)
          set the request object.
 void setResponse(Object response)
          set the response object.
 void setRTL(boolean rtl)
           
 void setSection508Rendering(boolean requires508)
          sets if additional information according to Section 508 should be rendered in the output stream.
 void setStylePath(String stylePath)
          set the URL path where the mimes can be found
 void setTrayDesign(TrayDesign trayType)
          Set the traytype for the right background style of the body
 void setUsingSession(boolean useSession)
          Session: if an application want to use session state instead of persisting all HTMLB context in the HTML page
 void setWriter(Writer writer)
          set the Writer to which output will be send.
 void startDocument()
          start a new document.
 void startDocumentBody()
          begin the body section of the generated output.
 void startDocumentHead(String title)
          begin the header of the document
 void storeParametersInSession(String formId)
          Session: called by the form renderer when it has finished rendering it's content Now you can be sure that all needed context info is in the ParamList
 void write(int i)
          write the integer value to the designated writer for the response
 void write(String text)
          write a String to the designated writer for the response
 void writeEncoded(String text)
          write a String to the designated writer for the response but encode critical characters, e.g. '<' as '<'
 void writeHeadBegin(String text)
           
 void writeHeadIncludes()
          write the required head includes to the output This will insert JavaScript and Stylesheet references.
 void writeHeadIncludes(String text)
           
 

Field Detail

HTMLB_JSPATH

public static final String HTMLB_JSPATH
See Also:
Constant Field Values

HTMLB_MIMEPATH

public static final String HTMLB_MIMEPATH
See Also:
Constant Field Values

HTMLB_SEC508

public static final String HTMLB_SEC508
See Also:
Constant Field Values

HTMLB_ACTIONURL

public static final String HTMLB_ACTIONURL
See Also:
Constant Field Values

HTMLB_STYLEPATH

public static final String HTMLB_STYLEPATH
See Also:
Constant Field Values

HTMLB_RELAXDOMAIN

public static final String HTMLB_RELAXDOMAIN
See Also:
Constant Field Values

HTMLB_TRAYDESIGN

public static final String HTMLB_TRAYDESIGN
See Also:
Constant Field Values

HTMLB_LOCALE

public static final String HTMLB_LOCALE
See Also:
Constant Field Values

HTMLB_HASCONTENTPADDING

public static final String HTMLB_HASCONTENTPADDING
See Also:
Constant Field Values
Method Detail

getCurrentEvent

public Event getCurrentEvent()
return the event from the current request.

Returns:
Event theEvent the user caused.

getParameterNames

public Enumeration getParameterNames()
Returns an Enumeration of String objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration.

Returns:
an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters

getParameter

public String getParameter(String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.

You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use getParameterValues(java.lang.String).

This method does not return values for Components since component ids are encoded. Use getComponentForId or getDataForComponentId for that case.

Returns:
String a String representing the single value of the parameter

getParameterValues

public String[] getParameterValues(String name)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

Parameters:
name - a String containing the name of the parameter whose value is requested
Returns:
an array of String objects containing the parameter's values

isSingleValueParameter

public boolean isSingleValueParameter(String name)
Returns if a parameter has only a single value

Returns:
boolean true if a single value exists for this parameter

isFileParam

public boolean isFileParam(String name)
Returns:
boolean true if parameter is IFileParam

getFileParam

public IFileParam getFileParam(String name)
Returns:
IFileParam the IFileParam object

getActionUrl

public String getActionUrl()
get the local or absolute URL path where the form should be posted if not already set

Returns:
String a URL to the mimes, e.g. "/irj/servlet/..."

setActionUrl

public void setActionUrl(String actionUrl)
set the URL path where form should be poset

Parameters:
actionUrl - the Url for tha action

getMimePath

public String getMimePath()
get the local or absolute URL path where the mimes for the current theme can be found.

Returns:
String a URL to the mimes, e.g. "/htmlb/mimes/common/"

setStylePath

public void setStylePath(String stylePath)
set the URL path where the mimes can be found


getStylePath

public String getStylePath()
get the local or absolute URL path where the styles for the current theme can be found.

Returns:
String a URL to the mimes, e.g. "/htmlb/mimes/ur/"

setMimePath

public void setMimePath(String mimePath)
set the URL path where the mimes can be found

Parameters:
mimePath - the path for the mimes

getJavascriptPath

public String getJavascriptPath()
get the URL path where the Javascript library files can be found.

Returns:
a URL for the JavaScript files.

setJavascriptPath

public void setJavascriptPath(String javascriptPath)
set the URL path where the JavaScript libraries can be found

Parameters:
javascriptPath - URL path

getRequest

public Object getRequest()
get the request object for the current context, e.g. the HttpServletRequest for a servlet

Returns:
the request object

setRequest

public void setRequest(Object request)
set the request object. This method should only be used internally.

Parameters:
request - the request Object

getResponse

public Object getResponse()
get the response object for the current context, e.g. the HttpServletResponse for a servlet

Returns:
the request object

setResponse

public void setResponse(Object response)
set the response object. This method should only be used internally.

Implementations for this method should always test if the passed parameter is null since IPageContext may be instantiated without a response object.

Parameters:
response - the response Object

getBrowserId

public BrowserType getBrowserId()
get the BrowserType for the recognized browser/user agent

Returns:
the BrowserType enumeration value for the browser

getLocale

public Locale getLocale()
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.

Returns:
the preferred Locale for the client

getLocales

public Enumeration getLocales()
Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns an Enumeration containing one Locale, the default locale for the server.

Returns:
an Enumeration of preferred Locale objects for the client

getWriter

public Writer getWriter()
get the java.io.Writer for output operations

Returns:
a Writer for output operations

setWriter

public void setWriter(Writer writer)
set the Writer to which output will be send. Usually this is set up in the init method.

Parameters:
writer - the Writer used for output

write

public void write(String text)
write a String to the designated writer for the response

Parameters:
text - a String to write

writeHeadIncludes

public void writeHeadIncludes(String text)

writeHeadBegin

public void writeHeadBegin(String text)

writeEncoded

public void writeEncoded(String text)
write a String to the designated writer for the response but encode critical characters, e.g. '<' as '<'

Parameters:
text - a String to write

write

public void write(int i)
write the integer value to the designated writer for the response

Parameters:
i - a int whose value should be written

render

public void render()
render the complete document


render

public void render(Component component)
render a single component. This method is only useful for components that produce atomic HTML code.

Parameters:
component - the Component that should be rendered.

render

public void render(Component component,
                   int selector)
render an aspect of a single component. This method is intended for components that need to produce more than one piece of HTML code, e.g. a Tray that needs to render some begin information and requires some end tags.

Parameters:
component - the Component that should be rendered.
selector - a String indicating which part of the Component should be rendered.

renderJavascriptInterface

public void renderJavascriptInterface(Component component,
                                      String generatedId)
render Javascript interface of component.

Parameters:
component - the Component that should be rendered.

getJavascriptUrl

public String getJavascriptUrl()
get the full URL for the JavaScript library file for the current user agent.

Returns:
a URL like "/htmlb/jslib/htmlbie5.js"

getStylesheetUrl

public String getStylesheetUrl()
get the full URL for the CSS file for the current user agent.

Returns:
a URL like "/htmlb/jslib/htmlbie5.css"

requiresSection508Rendering

public boolean requiresSection508Rendering()
checks if additional information according to Section 508 should be rendered in the output stream.

Section 508 requires specific rendering functions that might not be sensible for non-disabled persons.

Basically if anything is to be rendered section 508 conform this means, that


setSection508Rendering

public void setSection508Rendering(boolean requires508)
sets if additional information according to Section 508 should be rendered in the output stream.


createDocument

public Document createDocument(String title)
create a new document.

Parameters:
title - the title for the new document

createFormDocument

public Form createFormDocument(String title)
create a new document and automatically create a form.

Parameters:
title - the title for the new document

createForm

public Form createForm()
create a new form and make it the current form. This automatically adds the Form to the Document and tries to set up the form action according to the environment.

Returns:
a newly created form

setFormDefaults

public void setFormDefaults(Form form)
sets the defaults values for the form within the current context.

Parameters:
form - the form

getParamIdForComponent

public String getParamIdForComponent(Component c)
get a unique ID for a component. Note that some components require to be placed within a form.

Parameters:
c - the component for which a unique ID is required
Returns:
a unique ID as String

getParamIdForComponent

public String getParamIdForComponent(String componentId)
get the generated unique ID for a component. This refers to the previous document information.

Returns:
a unique ID as String

startDocument

public void startDocument()
start a new document. This might e.g. write a simple "" to the output. There would of course be different implementations for WAP rendering, etc.


startDocumentHead

public void startDocumentHead(String title)
begin the header of the document

Parameters:
title - the Title for the page

writeHeadIncludes

public void writeHeadIncludes()
write the required head includes to the output This will insert JavaScript and Stylesheet references.


endDocumentHead

public void endDocumentHead()
close the head section of the produced HTML.


startDocumentBody

public void startDocumentBody()
begin the body section of the generated output. ""


endDocumentBody

public void endDocumentBody()
end the body section of the generated output.


endDocument

public void endDocument()
end the generated output.


getDocument

public Document getDocument()
gets the current document

Returns:
the current document

getCurrentFormId

public String getCurrentFormId()
get the ID of the current form (HTML!!!)

Returns:
the id of the current form

getCurrentForm

public Form getCurrentForm()
get the current form

Returns:
the current form

getOldForm

public Form getOldForm()
get the reconstructed form from a request

Returns:
the old form that was submitted

getComponentForId

public Component getComponentForId(String elementId)
returns a reconstructed component for a given id. You can use this method to retrieve user input or basic state information from a component. If you are only interested in the data you can use getDataForComponentId

Parameters:
elementId - the Id for the component
Returns:
a partially reconstructed component
See Also:
getDataForComponentId(String)

getTableComponentForId

public Component getTableComponentForId(String tableId,
                                        String elementId,
                                        int row)
get a reconstructed component for a given id. You can use this method to retrieve user input. This is a specialised getter for fields within a table.

Parameters:
elementId - the name given to the component by the user
row - table row
Returns:
the partially reconstructed Component for the given cell location, or null if none exists.

getParameterForId

public String getParameterForId(String elementId)
gets the raw parameter value for the component with the specified id. This is a low level access. If you are working with typed data you should use getDataForComponentId.

Parameters:
elementId - the Id for the component
Returns:
the raw parameter value or null if no such parameter exists
See Also:
getDataForComponentId(String)

getParameterValuesForId

public String[] getParameterValuesForId(String elementId)
gets the raw parameter values for the component with the specified id. This is a low level access. If you are working with typed data you should use getDataForComponentId. As of release 1.0 the only component that can return values is the ListBox.

Parameters:
elementId - the Id for the component
Returns:
the raw parameter values or null if no such parameter exists
See Also:
getDataForComponentId(String)

getDataForComponentId

public AbstractDataType getDataForComponentId(String elementId)
get the user input for a given id. You can use this method to retrieve user input.

Parameters:
elementId - the Id for the component
Returns:
a DataType containing the specific data.

getDataForComponentId

public AbstractDataType getDataForComponentId(String tableId,
                                              String elementId,
                                              int row)
get the user input for a given id. You can use this method to retrieve user input from a table. Note: row is the visible row, i.e. you can use values from 1 to the visibleRowCount of the TableView

Parameters:
elementId - the Id for the component

setCurrentForm

public void setCurrentForm(Form form)
set the current form. This should only be called by the form renderer! Current is related to rendering.

Parameters:
form - the current form

push

public void push(Container c)
temporary solution for mixed-mode, i.e. creation of component/container structures and raw output. push a container, i.e. make the container recipient for temporary content.

Parameters:
c - Container that should receive what's written.

pop

public void pop()
temporary solution for mixed-mode, i.e. creation of component/container structures and raw output. pop a container, i.e. the container is no longer receiving direct output.


cleanUp

public void cleanUp()
deletes temporary file of mime multipart postings. This method is automatically called if you're using the DynPage model. If you're writing a simple Servlet or a PortalComponent you should call this method at the end of the request cycle. You must call this method if you're handling file uploads!


setAttribute

public void setAttribute(String key,
                         Object value)
set an attribute in the current session

Parameters:
key - the key
value - the value associated with this key

getAttribute

public Object getAttribute(String key)
get an attribute from the current session

Parameters:
key - the key
Returns:
the value associated with this key or null

getResourceBundle

public ResourceBundle getResourceBundle(String baseName,
                                        Locale locale)
get a ResourceBundle for locale specific texts.

Parameters:
baseName - the baseName for the bundle
locale - the locale for the bundle or null if the default locale from the request should be used.
Returns:
the ResourceBundle
See Also:
ResourceBundle

getComponentIdForLabel

public String getComponentIdForLabel(String id)

setMessageBarAtBodyEnd

public void setMessageBarAtBodyEnd(boolean messageBarAtBodyEnd)
sets whether messageBar should be renderted at body start or end. a page context is free to place restrictions depending upon browser or integration


getClientInfo

public ClientInfo getClientInfo()

getHiddenCard

public MobileWmlCard getHiddenCard()

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Set the class loader for this context.


getClassLoader

public ClassLoader getClassLoader()
Get the class loader assigned to this context.

Returns:
the assigned class loader

setDomainRelaxation

public void setDomainRelaxation(boolean relaxDomain)
Set the domain relaxation for the portal.


getDomainRelaxation

public boolean getDomainRelaxation()
Get the flag for domain relaxation.

Returns:
the flag for domain relaxation

getParamList

public HashMap getParamList()
Session: Session based storage for HTMLB context information only needed if isUsingSession will return true


setUsingSession

public void setUsingSession(boolean useSession)
Session: if an application want to use session state instead of persisting all HTMLB context in the HTML page


isUsingSession

public boolean isUsingSession()
Session: used by the control renderers (Form & Inputfield) to find out where to put their data


storeParametersInSession

public void storeParametersInSession(String formId)
Session: called by the form renderer when it has finished rendering it's content Now you can be sure that all needed context info is in the ParamList


getParent

public Object getParent()
Get the pagecontext's parent e.g. Servlet or Dynpage


setParent

public void setParent(Object parent)
Set the pagecontext's parent e.g. Servlet or Dynpage


rebuildComponents

public void rebuildComponents()
rebuilds all the components that were registered at rendering time


getComponents

public Component[] getComponents()
returns all the components that were rebuild


getTrayDesign

public TrayDesign getTrayDesign()
returns a object describing the traydesign the page is contained


setTrayDesign

public void setTrayDesign(TrayDesign trayType)
Set the traytype for the right background style of the body

Parameters:
trayType - TrayDesign the traydesign

registerStylesheet

public void registerStylesheet(String key)
register the required style sheets


getStylesheets

public HashSet getStylesheets()
returns the required stylesheets


flush

public void flush()

setRTL

public void setRTL(boolean rtl)

getLogLocation

public com.sap.tc.logging.Location getLogLocation()
returns the Location object used for logging and tracing


setAdvancedAlignment

public void setAdvancedAlignment(boolean advancedAlignment)
aligment compatibility mode default value:false

Parameters:
advancedAlignment -

addPerfCounter

public void addPerfCounter(String line)
adds performance counters written a comments in the HTML source


isHasContentPadding

public boolean isHasContentPadding()
Returns:
if the tray should have content padding

setHasContentPadding

public void setHasContentPadding(boolean hasContentPadding)


Copyright 2006 SAP AG Complete Copyright Notice