com.ibm.xsp.designer.context
Class XSPContext

java.lang.Object
  extended by com.ibm.xsp.designer.context.XSPContext

public abstract class XSPContext
extends java.lang.Object


Field Summary
static java.lang.String COMPONENT_PARAMETERS
           
static java.lang.String CONTEXT
           
static java.lang.String COOKIE
           
static java.lang.String DELIMITER
           
static java.lang.String FALSE
           
static java.lang.String TRUE
           
 
Constructor Summary
protected XSPContext(javax.faces.context.FacesContext context)
          Construct a RuntimeContext instance based on the specified FacesContext object.
 
Method Summary
protected  void addUrlParameter(XSPUrl url, java.lang.String name, java.lang.String value)
           
 java.util.ResourceBundle bundle(java.lang.String bundleName)
          Return a named resource bundle for the current Locale.
 java.util.ResourceBundle bundle(java.lang.String bundleName, java.util.Locale locale)
          Return a named resource bundle for a particular Locale.
protected  XSPUrl createRequestUrl(javax.faces.context.FacesContext facesContext)
           
protected  XSPUrl createRequestUrlFromViewId(javax.faces.component.UIViewRoot viewRoot)
           
protected  com.ibm.designer.runtime.directory.DirectoryUser createUser(java.lang.String dName, java.lang.String cName, boolean fillUserFromDirectory)
           
 java.lang.String filterHTML(java.lang.String html)
          Filter the content of an HTML snippet.
 java.lang.String filterHTML(java.lang.String html, java.lang.String processor)
          Filter the content of an HTML snippet.
 java.lang.String getComponentInstanceId()
          Gets the component instance ID.
 java.lang.String getComponentMode()
          Gets the component execution mode.
 java.lang.Object getComponentParameter(java.lang.String name)
          Gets the value of a component parameter.
protected  com.ibm.designer.runtime.directory.DirectoryServer getDirectoryServer()
           
 javax.faces.context.FacesContext getFacesContext()
           
 FacesContextEx getFacesContextEx()
           
 java.lang.String getHistoryUrl(int level)
          Get a URL in the history stack.
 java.lang.String[] getHistoryUrls()
          Get the URLs in the history stack.
 java.util.Locale getLocale()
          Gets the current locale.
 java.lang.String getLocaleString()
          Gets the current locale as a string.
protected  PersistentSessionData getPersistentSessionData()
           
 java.lang.String getProperty(java.lang.String name)
          Return a property value.
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Return a property value.
 java.lang.String getSessionProperty(java.lang.String name)
          Return a session property value.
 java.lang.String getSubmittedValue()
          Get submitted value.
 java.lang.String getThemeId()
          Return the current theme id.
 java.util.TimeZone getTimeZone()
          Gets the current time zone.
 java.lang.String getTimeZoneString()
          Gets the current time zone as a string.
 XSPUrl getUrl()
          Gets the URL of the requested page
 java.lang.String getUrlParameter(java.lang.String name)
          Gets the an URL parameter value.
 com.ibm.designer.runtime.directory.DirectoryUser getUser()
          Gets the current user from the directory.
 XSPUserAgent getUserAgent()
          Return the current browser.
static XSPContext getXSPContext(javax.faces.context.FacesContext context)
           
protected  void init(javax.faces.context.FacesContext context)
           
 boolean isComponent()
          Check if the application is running as a component.
 boolean isDataBeingLoaded()
          Check if a datasource is being loaded.
 boolean isDataBeingSaved()
          Check if a datasource is being saved.
 boolean isDirectionLTR()
          Check for LTR mode.
 boolean isDirectionRTL()
          Check for RTL mode.
 boolean isPortletContext()
          When running within the context of a portlet this method will return true.
 boolean isRcpContext()
          When running within the context of the rich client platpage this method will return true.
 boolean isRunningContext(java.lang.String context)
          Check if the application is running in a particular context.
 boolean isServletContext()
          When running within the context of a servlet this method will return true.
 void redirectToHome()
          Redirect to the home page.
 void redirectToPage(java.lang.String page)
          Use a new page to edit the same document(s)
 void redirectToPage(java.lang.String page, boolean redirect)
          Use a new page to edit the same document(s)
 void redirectToPrevious()
          Redirect to the previous page, if any.
 void reloadPage()
          Reload the current page
protected  void renderPage(java.lang.String page, boolean redirect)
           
 void resetUrlInternal()
           
protected  java.lang.Object resolveVariable(java.lang.String name)
           
 void setComponentMode(java.lang.String mode)
          Change current component mode.
 void setComponentMode(java.lang.String mode, boolean cancel)
          Change current component mode.
 void setComponentParameter(java.lang.String name, java.lang.Object value)
          Set the value of a component parameter.
protected  void setDirectoryUser(com.ibm.designer.runtime.directory.DirectoryUser dirUser)
           
 void setDocumentMode(java.lang.String mode)
          Change the current document mode.
 void setDocumentMode(java.lang.String var, java.lang.String mode)
          Change the document mode.
 void setLocale(java.util.Locale locale)
          Force the Locale for this session
 void setLocaleString(java.lang.String locale)
          Force the Locale for this session
 void setSessionProperty(java.lang.String name, java.lang.String value)
          Set a session property value.
 void setTimeZone(java.util.TimeZone timeZone)
          Force the Timezone for this session
 void setTimeZoneString(java.lang.String timeZone)
          Force the Timezone for this session
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT

public static final java.lang.String CONTEXT
See Also:
Constant Field Values

COOKIE

public static final java.lang.String COOKIE
See Also:
Constant Field Values

COMPONENT_PARAMETERS

public static final java.lang.String COMPONENT_PARAMETERS
See Also:
Constant Field Values

DELIMITER

public static final java.lang.String DELIMITER
See Also:
Constant Field Values

TRUE

public static final java.lang.String TRUE
See Also:
Constant Field Values

FALSE

public static final java.lang.String FALSE
See Also:
Constant Field Values
Constructor Detail

XSPContext

protected XSPContext(javax.faces.context.FacesContext context)
Construct a RuntimeContext instance based on the specified FacesContext object.

Parameters:
context -
Method Detail

getXSPContext

public static XSPContext getXSPContext(javax.faces.context.FacesContext context)

init

protected void init(javax.faces.context.FacesContext context)

getFacesContext

public javax.faces.context.FacesContext getFacesContext()

getFacesContextEx

public FacesContextEx getFacesContextEx()

getPersistentSessionData

protected PersistentSessionData getPersistentSessionData()

setDirectoryUser

protected void setDirectoryUser(com.ibm.designer.runtime.directory.DirectoryUser dirUser)

resolveVariable

protected java.lang.Object resolveVariable(java.lang.String name)

getDirectoryServer

protected com.ibm.designer.runtime.directory.DirectoryServer getDirectoryServer()

createUser

protected com.ibm.designer.runtime.directory.DirectoryUser createUser(java.lang.String dName,
                                                                      java.lang.String cName,
                                                                      boolean fillUserFromDirectory)

renderPage

protected void renderPage(java.lang.String page,
                          boolean redirect)

bundle

public java.util.ResourceBundle bundle(java.lang.String bundleName)
                                throws java.io.IOException
Return a named resource bundle for the current Locale.

Parameters:
bundleName - the name of the resource bundle to load
Returns:
The resource bundle object
Throws:
java.io.IOException

bundle

public java.util.ResourceBundle bundle(java.lang.String bundleName,
                                       java.util.Locale locale)
                                throws java.io.IOException
Return a named resource bundle for a particular Locale.

Parameters:
bundleName - the name of the resource bundle to load
locale - the locale to use - null means the current one
Returns:
The resource bundle object
Throws:
java.io.IOException

getUserAgent

public XSPUserAgent getUserAgent()
Return the current browser.

Returns:
The theme id used by the request

getThemeId

public java.lang.String getThemeId()
Return the current theme id.

Returns:
The theme id used by the request

getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defaultValue)
Return a property value. The property is either defined:

Parameters:
name - the property name
defaultValue - the value to return if the property doesn't exist
Returns:
The value of the property if it exists, or the default value

getProperty

public java.lang.String getProperty(java.lang.String name)
Return a property value. The property is either defined:

Parameters:
name - the property name
Returns:
The value of the property if it exists, or null if it doesn't exist

getSessionProperty

public java.lang.String getSessionProperty(java.lang.String name)
Return a session property value.

Parameters:
name - the property name
defaultValue - the value to return if the property doesn't exist
Returns:
The value of the property if it exists, or null if nothing is defined at the user level

setSessionProperty

public void setSessionProperty(java.lang.String name,
                               java.lang.String value)
Set a session property value. The property id is defined for the user session.

Parameters:
name - the property name
defaultValue - the value to return if the property doesn't exist

isComponent

public boolean isComponent()
Check if the application is running as a component.

Returns:
true if running as a component, false otherwise

getComponentInstanceId

public java.lang.String getComponentInstanceId()
Gets the component instance ID.

Returns:
The ID of the component instance, or null if not running as a component

getComponentMode

public java.lang.String getComponentMode()
Gets the component execution mode.

Returns:
The component execution mode, or null if not running a component

setComponentMode

public void setComponentMode(java.lang.String mode)
Change current component mode. If the component is in edit mode then the new components parameters values are passed down to the framework. If the page is not run as a component, this method has no effect.

Parameters:
updateParameters - true is the component parameters should be update

setComponentMode

public void setComponentMode(java.lang.String mode,
                             boolean cancel)
Change current component mode. If the component is in edit mode and if the parameter 'updateParameters' is set to true, then the new components parameters values are passed down to the framework. If the page is not run as a component, this method has no effect.

Parameters:
mode - the new mode to switch to ('view', 'edit', 'help'...)
cancel - true if the previous mode should be cancelled (ex: parameters are no updated)

getComponentParameter

public java.lang.Object getComponentParameter(java.lang.String name)
Gets the value of a component parameter.

Parameters:
name - The name of the parameter.
Returns:
The value of the parameter.

setComponentParameter

public final void setComponentParameter(java.lang.String name,
                                        java.lang.Object value)
Set the value of a component parameter. The changes are applied immediately to the store.

Parameters:
name - The name of the parameter.
value - The value of the parameter.

getSubmittedValue

public java.lang.String getSubmittedValue()
Get submitted value. When an event is submitted through an event handler, then it can pass a string value as a parameter. This allows the client to pass some value contextual value.

Returns:
the submitted value.

isRunningContext

public boolean isRunningContext(java.lang.String context)
Check if the application is running in a particular context.

Returns:
true if the current context is valid

isServletContext

public boolean isServletContext()
When running within the context of a servlet this method will return true.

Returns:
true if the current context is servlet based.

isPortletContext

public boolean isPortletContext()
When running within the context of a portlet this method will return true.

Returns:
true if the current context is portlet based.

isRcpContext

public boolean isRcpContext()
When running within the context of the rich client platpage this method will return true.

Returns:
true if the current context is rich client platpage based.

getLocale

public java.util.Locale getLocale()
Gets the current locale.

Returns:
The locale.
Since:
8.5.0

setLocale

public void setLocale(java.util.Locale locale)
Force the Locale for this session


getLocaleString

public java.lang.String getLocaleString()
Gets the current locale as a string.

Returns:
The locale as a string.
Since:
8.5.0

setLocaleString

public void setLocaleString(java.lang.String locale)
Force the Locale for this session


getTimeZone

public java.util.TimeZone getTimeZone()
Gets the current time zone.

Returns:
The time zone.

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)
Force the Timezone for this session


getTimeZoneString

public java.lang.String getTimeZoneString()
Gets the current time zone as a string.

Returns:
The time zone as a string.

setTimeZoneString

public void setTimeZoneString(java.lang.String timeZone)
Force the Timezone for this session


filterHTML

public java.lang.String filterHTML(java.lang.String html)
Filter the content of an HTML snippet. The html is filtered using the 'acf' filtering processor.

Parameters:
html - the html string to filter
Returns:
The filtered piece of HTML.

filterHTML

public java.lang.String filterHTML(java.lang.String html,
                                   java.lang.String processor)
Filter the content of an HTML snippet. The html is filtered using the specified custom engine

Parameters:
html - the html string to filter
processor - the filtering processor name to use
Returns:
The filtered piece of HTML.

getUser

public com.ibm.designer.runtime.directory.DirectoryUser getUser()
Gets the current user from the directory.

Returns:
The user entry in the directory.

getUrl

public XSPUrl getUrl()
Gets the URL of the requested page

Returns:
the URL object

getUrlParameter

public java.lang.String getUrlParameter(java.lang.String name)
Gets the an URL parameter value. That parameter is got from the query string.

Returns:
the parameter value

resetUrlInternal

public void resetUrlInternal()

createRequestUrl

protected XSPUrl createRequestUrl(javax.faces.context.FacesContext facesContext)

addUrlParameter

protected void addUrlParameter(XSPUrl url,
                               java.lang.String name,
                               java.lang.String value)

createRequestUrlFromViewId

protected XSPUrl createRequestUrlFromViewId(javax.faces.component.UIViewRoot viewRoot)

reloadPage

public void reloadPage()
Reload the current page


redirectToPage

public void redirectToPage(java.lang.String page,
                           boolean redirect)
Use a new page to edit the same document(s)

Parameters:
page - the page name

redirectToPage

public void redirectToPage(java.lang.String page)
Use a new page to edit the same document(s)

Parameters:
page - the page name

redirectToPrevious

public void redirectToPrevious()
Redirect to the previous page, if any. If there is no previous page, then it redirect to the home page.


redirectToHome

public void redirectToHome()
Redirect to the home page.


getHistoryUrl

public java.lang.String getHistoryUrl(int level)
Get a URL in the history stack.

Parameters:
level - the history level: 0 is the current page, 1 or -1 the previous...
Returns:
the URL is available, null otherwise

getHistoryUrls

public java.lang.String[] getHistoryUrls()
Get the URLs in the history stack.

Returns:
the URLs as a string array

isDirectionLTR

public boolean isDirectionLTR()
Check for LTR mode.


isDirectionRTL

public boolean isDirectionRTL()
Check for RTL mode.


isDataBeingLoaded

public boolean isDataBeingLoaded()
Check if a datasource is being loaded.

Returns:
true if a datasource is being loaded

isDataBeingSaved

public boolean isDataBeingSaved()
Check if a datasource is being saved.

Returns:
true if a datasource is being saved

setDocumentMode

public void setDocumentMode(java.lang.String mode)
Change the current document mode.

Parameters:
the - new mode (edit, readOnly, autoEdit, toggle)

setDocumentMode

public void setDocumentMode(java.lang.String var,
                            java.lang.String mode)
Change the document mode.

Parameters:
var - the name of the document to change. null means the current document
the - new mode (edit, readOnly, autoEdit, toggle)