org.opencms.frontend.templateone
Class CmsTemplateBean

java.lang.Object
  extended by org.opencms.jsp.CmsJspBean
      extended by org.opencms.jsp.CmsJspActionElement
          extended by org.opencms.frontend.templateone.CmsTemplateBase
              extended by org.opencms.frontend.templateone.CmsTemplateBean
Direct Known Subclasses:
CmsTemplateForm, CmsTemplateImprint, CmsTemplateSearch

public class CmsTemplateBean
extends CmsTemplateBase

Provides methods to create the HTML for the frontend output in the main JSP template one.

Since:
6.0.0

Field Summary
static java.lang.String FILE_CONFIG_COMMON
          File name of the website area configuration file.
static java.lang.String FILE_CSS
          File name of the CSS style sheet to use.
static java.lang.String FILE_CSS_ACCESSIBLE
          File name of the accessible CSS style sheet to use.
static java.lang.String FILE_LINKS_HEAD
          File name of the head links configuration file.
static java.lang.String FOLDER_ELEMENTS
          Folder path to the included JSP elements.
static java.lang.String MESSAGE_BUNDLE
          Name of the resource bundle containing the localized messages.
static java.lang.String MODULE_NAME
          Name of the frontend module in OpenCms.
static java.lang.String PARAM_ACCESSIBLE
          Request parameter name to show the accessible version of a page.
static java.lang.String PARAM_COMMON
          Request parameter name to show the common version of a page.
static java.lang.String PARAM_HELPURI
          Request parameter name for the help page URI.
static java.lang.String PARAM_LAYOUT
          Request parameter name to determine the displayed version of a page.
static java.lang.String PARAM_LOGINURI
          Request parameter name for the login page URI.
static java.lang.String PARAM_PART
          Request parameter name to determine the part of a JSP element to include.
static java.lang.String PARAM_PRINT
          Request parameter name to show the print version of a page.
static java.lang.String PARAM_SITE
          Request parameter name for the current site.
static java.lang.String PARAM_URI
          Request parameter name for the uri.
static java.lang.String PROPERTY_CONFIGPATH
          Name of the property key to set the configuration path for the template.
static java.lang.String PROPERTY_EXTENSIONMODULE
          Name of the property key to set the extension module for the template.
static java.lang.String PROPERTY_HEAD_DEFAULTLINK
          Name of the property key to set the head default link.
static java.lang.String PROPERTY_HEAD_ELEMENTURI
          Name of the property key to set the head element URI.
static java.lang.String PROPERTY_HEAD_IMGHEIGHT
          Name of the property key to set the head image height.
static java.lang.String PROPERTY_HEAD_IMGLINK
          Name of the property key to set the head image link.
static java.lang.String PROPERTY_HEAD_IMGURI
          Name of the property key to set the head image uri.
static java.lang.String PROPERTY_LAYOUT_CENTER
          Name of the property key to set the path to the layout file for the center layout.
static java.lang.String PROPERTY_LAYOUT_RIGHT
          Name of the property key to set the path to the layout file for the right layout.
static java.lang.String PROPERTY_NAVLEFT_ELEMENTURI
          Name of the property key to set the left navigation include element uri.
static java.lang.String PROPERTY_RESOURCEPATH
          Name of the property key to set the resource path for the template.
static java.lang.String PROPERTY_SHOW_HEADNAV
          Name of the property key to determine if the head navigation row is shown.
static java.lang.String PROPERTY_SHOW_NAVLEFT
          Name of the property key to determine if the left navigation is shown.
static java.lang.String PROPERTY_SHOWHEADIMAGE
          Name of the property key to show the head image row.
static java.lang.String PROPERTY_SHOWHEADLINKS
          Name of the property key to show the head links row.
static java.lang.String PROPERTY_SIDE_URI
          Name of the property key to set the side element uri.
static java.lang.String PROPERTY_STARTFOLDER
          Name of the property key to set the start folder for navigation and search results.
static java.lang.String PROPERTY_VALUE_NONE
          Property value "none" for overriding certain properties.
static java.lang.String RESOURCE_TYPE_MICROSITE_NAME
          Resource type name for the microsite folders specifying a configurable subsite.
 
Fields inherited from class org.opencms.frontend.templateone.CmsTemplateBase
ATTRIBUTE_ORIGINAL_URI
 
Fields inherited from class org.opencms.jsp.CmsJspActionElement
NOT_INITIALIZED
 
Constructor Summary
CmsTemplateBean()
          Empty constructor, required for every JavaBean.
CmsTemplateBean(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Constructor, with parameters.
 
Method Summary
 void buildHtmlBodyEnd()
          Builds the main html output for the template foot and includes all subelements depending on the settings.
 java.lang.String getAreaName()
          Returns the name of the website area specified in the common configuration file.
 java.lang.String getConfigPath()
          Returns the template configuration path in the OpenCms VFS.
 org.opencms.xml.content.CmsXmlContent getConfiguration()
          Returns the common configuration properties for the current web site area.
protected static org.opencms.xml.content.CmsXmlContent getConfigurationFile(java.lang.String fileName, org.opencms.file.CmsObject cms)
          Returns the initialized xmlcontent configuration file.
 java.lang.String getConfigurationValue(java.lang.String key)
          Returns the value for the specified property key name from the configuration.
 java.lang.String getConfigurationValue(java.lang.String key, java.lang.String defaultValue)
          Returns the value for the specified property key name from the configuration.
 java.lang.String getDescription(java.lang.String defaultValue)
          Returns the "Description" property value of the requested uri.
 java.lang.String getEncoding()
          Returns the "content encoding" property value of the requested uri.
 java.lang.String getExtensionModuleFileUri(java.lang.String relFilePath)
          Returns the file Uri of a module element to include.
 java.lang.String getHeadElementUri()
          Returns the URI of the editable head element or "none" if no element is specified.
 java.util.List getHeadLinks()
          Returns the list of the head links.
 java.lang.String getKeywords(java.lang.String defaultValue)
          Returns the "Keywords" property value of the requested uri.
 java.lang.String getLayout()
          Returns the current layout to generate from the template.
 java.lang.String getLeftNavigationElementUri()
          Returns the left navigation include element uri property value.
 java.lang.String getNavigationStartFolder()
          Returns the start folder for the navigation elements.
 java.util.Map getProperties()
          Returns the Map of found resource properties.
 java.lang.String getResourcePath()
          Returns the substituted path to the modules resource folder.
 java.lang.String getSearchIndexName()
          Returns the search index name to use, depending on the current site.
 java.lang.String getStartFolder()
          Returns the start folder for navigation and search results.
 java.lang.String getStyleSheetConfigUri()
          Returns the URI of the CSS style sheet configuration file.
 java.lang.String getStyleSheetUri()
          Returns the substituted URI of the CSS style sheet to use in the template.
 java.lang.String getStyleSheetUri(java.lang.String resPath, java.lang.String config, java.lang.String site, java.util.Locale locale)
          Returns the substituted URI of the CSS style sheet to use in the template.
 CmsTemplateParts getTemplateParts()
          Returns the template parts instance to use for including static JSP elements.
 java.lang.String getTitle(java.lang.String defaultValue)
          Returns the "Title" property value of the requested uri.
 void includeElements()
          Includes the page elements if they are present.
 void includePopup(java.lang.String element, java.lang.String title)
          Includes page elements useable on popup pages ("popuphead", "popupfoot").
 void includeRightLists()
          Includes center list elements if defined.
 void init(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Initialize this bean with the current page context, request and response.
 java.lang.String key(java.lang.String keyName)
          Gets the localized resource string for a given message key.
 java.lang.String keyDefault(java.lang.String keyName, java.lang.String defaultValue)
          Returns the localized resource string for a given message key.
 org.opencms.i18n.CmsMessages messages()
          Returns the initialized CmsMessages object to use on the JSP template.
 org.opencms.i18n.CmsMessages messages(java.lang.String bundleName)
          Returns the initialized CmsMessages object to use on the JSP template.
 void putNavigationProperties()
          Puts the information needed to build the navigation elements to the property map.
 void setLayout(java.lang.String layout)
          Sets the current layout to generate from the template.
 boolean showAccessibleVersion()
          Returns if the accessible version of the page should be shown.
 boolean showHeadImage()
          Returns if the head image should be shown.
 boolean showHeadLinks()
          Returns if the head links should be shown.
 boolean showHeadNavigation()
          Returns if the head navigation menu should be shown.
 boolean showLeftNavigation()
          Returns if the left navigation menu should be shown.
 boolean showPrintVersion()
          Returns if the print version of the page should be created.
 
Methods inherited from class org.opencms.frontend.templateone.CmsTemplateBase
getOriginalUri, initUri, isUriChanged
 
Methods inherited from class org.opencms.jsp.CmsJspActionElement
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, getNavigationUri, img, img, include, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, user
 
Methods inherited from class org.opencms.jsp.CmsJspBean
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_CONFIG_COMMON

public static final java.lang.String FILE_CONFIG_COMMON
File name of the website area configuration file.

See Also:
Constant Field Values

FILE_CSS

public static final java.lang.String FILE_CSS
File name of the CSS style sheet to use.

See Also:
Constant Field Values

FILE_CSS_ACCESSIBLE

public static final java.lang.String FILE_CSS_ACCESSIBLE
File name of the accessible CSS style sheet to use.

See Also:
Constant Field Values

FILE_LINKS_HEAD

public static final java.lang.String FILE_LINKS_HEAD
File name of the head links configuration file.

See Also:
Constant Field Values

FOLDER_ELEMENTS

public static final java.lang.String FOLDER_ELEMENTS
Folder path to the included JSP elements.

See Also:
Constant Field Values

MESSAGE_BUNDLE

public static final java.lang.String MESSAGE_BUNDLE
Name of the resource bundle containing the localized messages.

See Also:
Constant Field Values

MODULE_NAME

public static final java.lang.String MODULE_NAME
Name of the frontend module in OpenCms.

See Also:
Constant Field Values

PARAM_ACCESSIBLE

public static final java.lang.String PARAM_ACCESSIBLE
Request parameter name to show the accessible version of a page.

See Also:
Constant Field Values

PARAM_COMMON

public static final java.lang.String PARAM_COMMON
Request parameter name to show the common version of a page.

See Also:
Constant Field Values

PARAM_HELPURI

public static final java.lang.String PARAM_HELPURI
Request parameter name for the help page URI.

See Also:
Constant Field Values

PARAM_LAYOUT

public static final java.lang.String PARAM_LAYOUT
Request parameter name to determine the displayed version of a page.

See Also:
Constant Field Values

PARAM_LOGINURI

public static final java.lang.String PARAM_LOGINURI
Request parameter name for the login page URI.

See Also:
Constant Field Values

PARAM_PART

public static final java.lang.String PARAM_PART
Request parameter name to determine the part of a JSP element to include.

See Also:
Constant Field Values

PARAM_PRINT

public static final java.lang.String PARAM_PRINT
Request parameter name to show the print version of a page.

See Also:
Constant Field Values

PARAM_SITE

public static final java.lang.String PARAM_SITE
Request parameter name for the current site.

See Also:
Constant Field Values

PARAM_URI

public static final java.lang.String PARAM_URI
Request parameter name for the uri.

See Also:
Constant Field Values

PROPERTY_CONFIGPATH

public static final java.lang.String PROPERTY_CONFIGPATH
Name of the property key to set the configuration path for the template.

See Also:
Constant Field Values

PROPERTY_EXTENSIONMODULE

public static final java.lang.String PROPERTY_EXTENSIONMODULE
Name of the property key to set the extension module for the template.

See Also:
Constant Field Values

PROPERTY_HEAD_DEFAULTLINK

public static final java.lang.String PROPERTY_HEAD_DEFAULTLINK
Name of the property key to set the head default link.

See Also:
Constant Field Values

PROPERTY_HEAD_ELEMENTURI

public static final java.lang.String PROPERTY_HEAD_ELEMENTURI
Name of the property key to set the head element URI.

See Also:
Constant Field Values

PROPERTY_HEAD_IMGHEIGHT

public static final java.lang.String PROPERTY_HEAD_IMGHEIGHT
Name of the property key to set the head image height.

See Also:
Constant Field Values

PROPERTY_HEAD_IMGLINK

public static final java.lang.String PROPERTY_HEAD_IMGLINK
Name of the property key to set the head image link.

See Also:
Constant Field Values

PROPERTY_HEAD_IMGURI

public static final java.lang.String PROPERTY_HEAD_IMGURI
Name of the property key to set the head image uri.

See Also:
Constant Field Values

PROPERTY_LAYOUT_CENTER

public static final java.lang.String PROPERTY_LAYOUT_CENTER
Name of the property key to set the path to the layout file for the center layout.

See Also:
Constant Field Values

PROPERTY_LAYOUT_RIGHT

public static final java.lang.String PROPERTY_LAYOUT_RIGHT
Name of the property key to set the path to the layout file for the right layout.

See Also:
Constant Field Values

PROPERTY_NAVLEFT_ELEMENTURI

public static final java.lang.String PROPERTY_NAVLEFT_ELEMENTURI
Name of the property key to set the left navigation include element uri.

See Also:
Constant Field Values

PROPERTY_RESOURCEPATH

public static final java.lang.String PROPERTY_RESOURCEPATH
Name of the property key to set the resource path for the template.

See Also:
Constant Field Values

PROPERTY_SHOW_HEADNAV

public static final java.lang.String PROPERTY_SHOW_HEADNAV
Name of the property key to determine if the head navigation row is shown.

See Also:
Constant Field Values

PROPERTY_SHOW_NAVLEFT

public static final java.lang.String PROPERTY_SHOW_NAVLEFT
Name of the property key to determine if the left navigation is shown.

See Also:
Constant Field Values

PROPERTY_SHOWHEADIMAGE

public static final java.lang.String PROPERTY_SHOWHEADIMAGE
Name of the property key to show the head image row.

See Also:
Constant Field Values

PROPERTY_SHOWHEADLINKS

public static final java.lang.String PROPERTY_SHOWHEADLINKS
Name of the property key to show the head links row.

See Also:
Constant Field Values

PROPERTY_SIDE_URI

public static final java.lang.String PROPERTY_SIDE_URI
Name of the property key to set the side element uri.

See Also:
Constant Field Values

PROPERTY_STARTFOLDER

public static final java.lang.String PROPERTY_STARTFOLDER
Name of the property key to set the start folder for navigation and search results.

See Also:
Constant Field Values

PROPERTY_VALUE_NONE

public static final java.lang.String PROPERTY_VALUE_NONE
Property value "none" for overriding certain properties.

See Also:
Constant Field Values

RESOURCE_TYPE_MICROSITE_NAME

public static final java.lang.String RESOURCE_TYPE_MICROSITE_NAME
Resource type name for the microsite folders specifying a configurable subsite.

See Also:
Constant Field Values
Constructor Detail

CmsTemplateBean

public CmsTemplateBean()
Empty constructor, required for every JavaBean.


CmsTemplateBean

public CmsTemplateBean(javax.servlet.jsp.PageContext context,
                       javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse res)
Constructor, with parameters.

Use this constructor for the template.

Parameters:
context - the JSP page context object
req - the JSP request
res - the JSP response
Method Detail

getConfigurationFile

protected static org.opencms.xml.content.CmsXmlContent getConfigurationFile(java.lang.String fileName,
                                                                            org.opencms.file.CmsObject cms)
Returns the initialized xmlcontent configuration file.

Parameters:
fileName - the absolute path to the configuration file
cms - the CmsObject to access the VFS
Returns:
the initialized xmlcontent configuration file

buildHtmlBodyEnd

public void buildHtmlBodyEnd()
                      throws java.io.IOException,
                             javax.servlet.jsp.JspException
Builds the main html output for the template foot and includes all subelements depending on the settings.

Throws:
java.io.IOException - if writing the output fails
javax.servlet.jsp.JspException - if including an element fails

getAreaName

public java.lang.String getAreaName()
Returns the name of the website area specified in the common configuration file.

If the name is not found, the title of the start folder is shown.

Returns:
the name of the website area

getConfigPath

public java.lang.String getConfigPath()
Returns the template configuration path in the OpenCms VFS.

Returns:
the template configuration path

getConfiguration

public org.opencms.xml.content.CmsXmlContent getConfiguration()
Returns the common configuration properties for the current web site area.

Returns:
the common configuration properties

getConfigurationValue

public java.lang.String getConfigurationValue(java.lang.String key)
Returns the value for the specified property key name from the configuration.

Parameters:
key - the property key name to look up
Returns:
the value for the specified property key name

getConfigurationValue

public java.lang.String getConfigurationValue(java.lang.String key,
                                              java.lang.String defaultValue)
Returns the value for the specified property key name from the configuration.

Returns the default value argument if the property is not found.

Parameters:
key - the property key name to look up
defaultValue - a default value
Returns:
the value for the specified property key name

getDescription

public java.lang.String getDescription(java.lang.String defaultValue)
Returns the "Description" property value of the requested uri.

Parameters:
defaultValue - the default value used when the property was not found
Returns:
the "Description" property value of the requested uri

getEncoding

public java.lang.String getEncoding()
Returns the "content encoding" property value of the requested uri.

Returns:
the "content encoding" property value of the requested uri

getExtensionModuleFileUri

public java.lang.String getExtensionModuleFileUri(java.lang.String relFilePath)
Returns the file Uri of a module element to include.

Checks the presence of an extension module and if the requested element is available.

Parameters:
relFilePath - the path of the element relative to the module folder, e.g. "elements/myelement.jsp"
Returns:
the absolute uri of the module element to include

getHeadElementUri

public java.lang.String getHeadElementUri()
Returns the URI of the editable head element or "none" if no element is specified.

Returns:
the URI of the editable head element or "none" if no element is specified

getHeadLinks

public java.util.List getHeadLinks()
Returns the list of the head links.

Returns:
the list of head link objects

getKeywords

public java.lang.String getKeywords(java.lang.String defaultValue)
Returns the "Keywords" property value of the requested uri.

Parameters:
defaultValue - the default value used when the property was not found
Returns:
the "Keywords" property value of the requested uri

getLayout

public java.lang.String getLayout()
Returns the current layout to generate from the template.

Returns:
the current layout

getLeftNavigationElementUri

public java.lang.String getLeftNavigationElementUri()
Returns the left navigation include element uri property value.

Returns:
the left navigation include element uri property value

getNavigationStartFolder

public java.lang.String getNavigationStartFolder()
Returns the start folder for the navigation elements.

Returns:
the start folder for the navigation elements

getProperties

public java.util.Map getProperties()
Returns the Map of found resource properties.

Returns:
the Map of found resource properties

getResourcePath

public java.lang.String getResourcePath()
Returns the substituted path to the modules resource folder.

Returns:
the substituted path to the modules resource folder

getSearchIndexName

public java.lang.String getSearchIndexName()
Returns the search index name to use, depending on the current site.

Returns "[Projectname] project (VFS)" for the default site and the site root as index name for other sites.

Returns:
the search index name to use, depending on the current site

getStartFolder

public java.lang.String getStartFolder()
Returns the start folder for navigation and search results.

Returns:
the start folder for navigation and search results

getStyleSheetConfigUri

public java.lang.String getStyleSheetConfigUri()
Returns the URI of the CSS style sheet configuration file.

Returns:
the URI of the CSS style sheet configuration file

getStyleSheetUri

public java.lang.String getStyleSheetUri()
Returns the substituted URI of the CSS style sheet to use in the template.

Returns:
the substituted URI of the CSS style sheet

getStyleSheetUri

public java.lang.String getStyleSheetUri(java.lang.String resPath,
                                         java.lang.String config,
                                         java.lang.String site,
                                         java.util.Locale locale)
Returns the substituted URI of the CSS style sheet to use in the template.

Parameters:
resPath - the resource path
config - the uri to the configuration settings
site - the site
locale - the locale
Returns:
the substituted URI of the CSS style sheet

getTemplateParts

public CmsTemplateParts getTemplateParts()
Returns the template parts instance to use for including static JSP elements.

These element parts depend on the current Locale, the layout to display and the project.

Returns:
the template parts instance

getTitle

public java.lang.String getTitle(java.lang.String defaultValue)
Returns the "Title" property value of the requested uri.

Parameters:
defaultValue - the default value used when the property was not found
Returns:
the "Title" property value of the requested uri

includeElements

public void includeElements()
                     throws java.io.IOException,
                            javax.servlet.jsp.JspException
Includes the page elements if they are present.

The page elements are layouted in a 4 row, 2 columns layout. If one element of a single row is missing, the present element will be spanned across the 2 columns.

Throws:
java.io.IOException - if writing the output fails
javax.servlet.jsp.JspException - if including an element fails

includePopup

public void includePopup(java.lang.String element,
                         java.lang.String title)
                  throws javax.servlet.jsp.JspException
Includes page elements useable on popup pages ("popuphead", "popupfoot").

Parameters:
element - the element to display from the target
title - the title for the popup page
Throws:
javax.servlet.jsp.JspException - if including the element fails

includeRightLists

public void includeRightLists()
                       throws javax.servlet.jsp.JspException
Includes center list elements if defined.

Throws:
javax.servlet.jsp.JspException - if including an element fails

init

public void init(javax.servlet.jsp.PageContext context,
                 javax.servlet.http.HttpServletRequest req,
                 javax.servlet.http.HttpServletResponse res)
Initialize this bean with the current page context, request and response.

It is required to call one of the init() methods before you can use the instance of this bean.

Overrides:
init in class org.opencms.jsp.CmsJspBean
Parameters:
context - the JSP page context object
req - the JSP request
res - the JSP response

key

public java.lang.String key(java.lang.String keyName)
Gets the localized resource string for a given message key.

If the key was not found in the bundle, the return value is "??? " + keyName + " ???". This will also be returned if the bundle was not properly initialized first.

Parameters:
keyName - the key for the desired string
Returns:
the resource string for the given key
See Also:
CmsMessages.key(String)

keyDefault

public java.lang.String keyDefault(java.lang.String keyName,
                                   java.lang.String defaultValue)
Returns the localized resource string for a given message key.

If the key was not found in the bundle, the provided default value is returned.

Parameters:
keyName - the key for the desired string
defaultValue - the default value in case the key does not exist in the bundle
Returns:
the resource string for the given key it it exists, or the given default if not
See Also:
CmsMessages.keyDefault(String, String)

messages

public org.opencms.i18n.CmsMessages messages()
Returns the initialized CmsMessages object to use on the JSP template.

Returns:
the initialized CmsMessages object

messages

public org.opencms.i18n.CmsMessages messages(java.lang.String bundleName)
Returns the initialized CmsMessages object to use on the JSP template.

Parameters:
bundleName - the name of the ResourceBundle to use
Returns:
the initialized CmsMessages object

putNavigationProperties

public void putNavigationProperties()
Puts the information needed to build the navigation elements to the property map.


setLayout

public void setLayout(java.lang.String layout)
Sets the current layout to generate from the template.

Parameters:
layout - the current layout to generate

showAccessibleVersion

public boolean showAccessibleVersion()
Returns if the accessible version of the page should be shown.

Returns:
true if the accessible version should be shown, otherwise false

showHeadImage

public boolean showHeadImage()
Returns if the head image should be shown.

Returns:
true if the head image should be shown, otherwise false

showHeadLinks

public boolean showHeadLinks()
Returns if the head links should be shown.

Returns:
true if the head links should be shown, otherwise false

showHeadNavigation

public boolean showHeadNavigation()
Returns if the head navigation menu should be shown.

Returns:
true if the head navigation menu should be shown, otherwise false

showLeftNavigation

public boolean showLeftNavigation()
Returns if the left navigation menu should be shown.

Returns:
true if the left navigation menu should be shown, otherwise false

showPrintVersion

public boolean showPrintVersion()
Returns if the print version of the page should be created.

Returns:
true if the print version should be created, otherwise false