org.opencms.frontend.templateone
Class CmsTemplateNavigation

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.CmsTemplateNavigation

public class CmsTemplateNavigation
extends CmsTemplateBase

Provides methods to build the different navigations for the OpenCms template one.

The navigation methods are used by the included JSP elements of template one. The inclusion has to be done by passing the Map of request parameters to the included element. The following request parameters have to be added before inclusion:

Remember to set the Flex cache settings of the navigation elements to consider these request parameters.

Since:
6.0.0

Field Summary
static java.lang.String FILE_CONFIG_HEADNAV
          Configuration file name for the optional manual head navigation configuration.
static java.lang.String PARAM_HEADNAV_FOLDER
          Request parameter name for the head navigation start folder.
static java.lang.String PARAM_HEADNAV_IMAGES
          Request parameter name for the head navigation flag to use images on 1st level.
static java.lang.String PARAM_HEADNAV_MANUAL
          Request parameter name for the head navigation flag to manually configure the head navigation.
static java.lang.String PARAM_HEADNAV_MARKCURRENT
          Request parameter name for the head navigation flag to mark the current top level folder.
static java.lang.String PARAM_HEADNAV_MENUCLICK
          Request parameter name for the head navigation flag to expand the submenus on click (true) or mouseover (false).
static java.lang.String PARAM_HEADNAV_MENUDEPTH
          Request parameter name for the head navigation sub menu depth.
static java.lang.String PARAM_LOCALE
          Request parameter name for the current locale.
static java.lang.String PARAM_NAVLEFT_ELEMENTURI
          Request parameter name for the left navigation editable include element uri.
static java.lang.String PARAM_NAVLEFT_SHOWSELECTED
          Request parameter name for the flag if the left navigation should display only the selected resources.
static java.lang.String PARAM_NAVLEFT_SHOWTREE
          Request parameter name for the flag if the left navigation tree should be displayed.
static java.lang.String PARAM_RESPATH
          Request parameter name for the current resource path.
static java.lang.String PARAM_SHOWMENUS
          Request parameter name for the flag if the head navigation menus should be shown.
static java.lang.String PARAM_STARTFOLDER
          Request parameter name for the current start folder.
static java.lang.String PROPERTY_HEADNAV_USE
          Name of the property key to determine if the current element is shown in headnav.
 
Fields inherited from class org.opencms.frontend.templateone.CmsTemplateBase
ATTRIBUTE_ORIGINAL_URI
 
Fields inherited from class org.opencms.jsp.CmsJspActionElement
NOT_INITIALIZED
 
Constructor Summary
CmsTemplateNavigation()
          Empty constructor, required for every JavaBean.
CmsTemplateNavigation(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Constructor, with parameters.
 
Method Summary
 java.lang.String buildNavigationBreadCrumb(java.lang.String styleClass)
          Returns the html for the bread crumb navigation above the page content.
 java.lang.String buildNavigationHead(java.lang.String homeLabel, java.lang.String styleLink, java.lang.String styleSeparator)
          Returns the html for the head navigation row.
 java.lang.String buildNavigationHeadMenus(java.lang.String styleClass)
          Returns the html for the head navigation menus.
 java.lang.String buildNavigationLeft()
          Returns the html for the left navigation tree.
 void buildNavLeftIncludeElement()
          Builds the html for the inclusion of the editable element under the left navigation tree.
 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.
 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 getHeadNavFolder()
          Returns the path to the head navigation start folder.
 java.util.List getHeadNavItemsFromConfig(int menuLevel, java.lang.String menuIndexes)
          Creates a List of CmsJspNavElement objects from a manual XML content configuration file.
 boolean getHeadNavMarkCurrent()
          Returns if the currently active top level folder should be marked in the head navigation.
 boolean getHeadNavMenuClick()
          Returns if the submenus are expanded on click (true) or mouseover (false).
 java.lang.String getLocale()
          Returns the currently active locale.
 int getMenuDepth()
          Returns the maximum depth of the head navigation sub menu structure.
 java.lang.StringBuffer getMenuNavigation(java.util.List curNav, java.lang.String styleClass, java.lang.String prefix, int currentDepth, java.lang.String menuIndexes)
          This method builds a complete menu navigation with entries of all branches from the specified folder.
 java.lang.String getNavLeftElementUri()
          Returns the URI of the page element to include on the left navigation.
 java.lang.String getResourcePath()
          Returns the substituted path to the modules resource folder.
 java.lang.String getStartFolder()
          Returns the start folder for navigation and search results.
 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.
 org.opencms.i18n.CmsMessages messages()
          Returns the initialized CmsMessages object to use on the JSP template.
 void setHeadNavItemDefaultValue(boolean defaultValue)
          Sets the default value of the property style_head_nav_showitem in case the property is not set.
 boolean showAccessibleVersion()
          Returns if the accessible version of the page should be shown.
 boolean showHeadNavImages()
          Returns if the head navigation should use images for the 1st navigation level.
 boolean showMenus()
          Returns if the second level navigation menus of the head navigation should be shown.
 boolean showNavLeftElement()
          Returns true if the left navigation include element should be shown.
 boolean showNavLeftSelected()
          Returns true if the left navigation follows the selection in the head navigation menu.
 boolean showNavLeftTree()
          Returns true if the left navigation tree should be displayed.
 
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_HEADNAV

public static final java.lang.String FILE_CONFIG_HEADNAV
Configuration file name for the optional manual head navigation configuration.

See Also:
Constant Field Values

PARAM_HEADNAV_FOLDER

public static final java.lang.String PARAM_HEADNAV_FOLDER
Request parameter name for the head navigation start folder.

See Also:
Constant Field Values

PARAM_HEADNAV_IMAGES

public static final java.lang.String PARAM_HEADNAV_IMAGES
Request parameter name for the head navigation flag to use images on 1st level.

See Also:
Constant Field Values

PARAM_HEADNAV_MARKCURRENT

public static final java.lang.String PARAM_HEADNAV_MARKCURRENT
Request parameter name for the head navigation flag to mark the current top level folder.

See Also:
Constant Field Values

PARAM_HEADNAV_MANUAL

public static final java.lang.String PARAM_HEADNAV_MANUAL
Request parameter name for the head navigation flag to manually configure the head navigation.

See Also:
Constant Field Values

PARAM_HEADNAV_MENUCLICK

public static final java.lang.String PARAM_HEADNAV_MENUCLICK
Request parameter name for the head navigation flag to expand the submenus on click (true) or mouseover (false).

See Also:
Constant Field Values

PARAM_HEADNAV_MENUDEPTH

public static final java.lang.String PARAM_HEADNAV_MENUDEPTH
Request parameter name for the head navigation sub menu depth.

See Also:
Constant Field Values

PARAM_LOCALE

public static final java.lang.String PARAM_LOCALE
Request parameter name for the current locale.

See Also:
Constant Field Values

PARAM_NAVLEFT_ELEMENTURI

public static final java.lang.String PARAM_NAVLEFT_ELEMENTURI
Request parameter name for the left navigation editable include element uri.

See Also:
Constant Field Values

PARAM_NAVLEFT_SHOWSELECTED

public static final java.lang.String PARAM_NAVLEFT_SHOWSELECTED
Request parameter name for the flag if the left navigation should display only the selected resources.

See Also:
Constant Field Values

PARAM_NAVLEFT_SHOWTREE

public static final java.lang.String PARAM_NAVLEFT_SHOWTREE
Request parameter name for the flag if the left navigation tree should be displayed.

See Also:
Constant Field Values

PARAM_RESPATH

public static final java.lang.String PARAM_RESPATH
Request parameter name for the current resource path.

See Also:
Constant Field Values

PARAM_SHOWMENUS

public static final java.lang.String PARAM_SHOWMENUS
Request parameter name for the flag if the head navigation menus should be shown.

See Also:
Constant Field Values

PARAM_STARTFOLDER

public static final java.lang.String PARAM_STARTFOLDER
Request parameter name for the current start folder.

See Also:
Constant Field Values

PROPERTY_HEADNAV_USE

public static final java.lang.String PROPERTY_HEADNAV_USE
Name of the property key to determine if the current element is shown in headnav.

See Also:
Constant Field Values
Constructor Detail

CmsTemplateNavigation

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


CmsTemplateNavigation

public CmsTemplateNavigation(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

buildNavigationBreadCrumb

public java.lang.String buildNavigationBreadCrumb(java.lang.String styleClass)
Returns the html for the bread crumb navigation above the page content.

The bread crumb navigation is only displayed if the folder depth of the current URI is deeper than 3 levels relative to the defined start level.

Parameters:
styleClass - the CSS class name to use in the <div> and <a> elements
Returns:
the html for the bread crumb navigation above the page content

buildNavigationHead

public java.lang.String buildNavigationHead(java.lang.String homeLabel,
                                            java.lang.String styleLink,
                                            java.lang.String styleSeparator)
Returns the html for the head navigation row.

This method only creates the head row part, be sure to add the dhtml menu entries by calling the method buildNavigationHeadMenus(java.lang.String).

Parameters:
homeLabel - the label of the "home" link
styleLink - the CSS class name of the link node
styleSeparator - the CSS class name of the spearator node
Returns:
the html for the head navigation row

buildNavigationHeadMenus

public java.lang.String buildNavigationHeadMenus(java.lang.String styleClass)
Returns the html for the head navigation menus.

This method only creates the menu entries, be sure to build the head row calling the menus, too.

Parameters:
styleClass - the CSS class name of the <div> nodes
Returns:
the html for the head navigation menus

buildNavigationLeft

public java.lang.String buildNavigationLeft()
Returns the html for the left navigation tree.

Returns:
the html for the left navigation tree

buildNavLeftIncludeElement

public void buildNavLeftIncludeElement()
                                throws java.io.IOException,
                                       javax.servlet.jsp.JspException
Builds the html for the inclusion of the editable element under the left navigation tree.

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

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,
                                              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

getHeadNavFolder

public java.lang.String getHeadNavFolder()
Returns the path to the head navigation start folder.

Returns:
the path to the head navigation start folder

getHeadNavItemsFromConfig

public java.util.List getHeadNavItemsFromConfig(int menuLevel,
                                                java.lang.String menuIndexes)
Creates a List of CmsJspNavElement objects from a manual XML content configuration file.

A manual configuration file can be used to build a head navigation that does not depend on the OpenCms resource structure. The menu level starts with 0 meaning the current level to create, the menuIndexes String contains at each char position numbers from 0-9 meaning the xpath index of the submenu entries in the XML content configuration file.

To get the first row, call this method like getHeadNavItemsFromConfig(0, "0") , to get the subitems for the second entry in the second row getHeadNavItemsFromConfig(1, "1").

Parameters:
menuLevel - the menu level to get the items for, starting with 0
menuIndexes - the menu indexes of the submenus for xpath creation, starting with "0"
Returns:
a sorted list of CmsJspNavElement objects

getHeadNavMarkCurrent

public boolean getHeadNavMarkCurrent()
Returns if the currently active top level folder should be marked in the head navigation.

Returns:
true if the currently active top level folder should be marked in the head navigation, otherwise false

getHeadNavMenuClick

public boolean getHeadNavMenuClick()
Returns if the submenus are expanded on click (true) or mouseover (false).

Returns:
true if the submenus are expanded on click, otherwise false

getLocale

public java.lang.String getLocale()
Returns the currently active locale.

Returns:
the locale

getMenuDepth

public int getMenuDepth()
Returns the maximum depth of the head navigation sub menu structure.

Returns:
the maximum depth of the head navigation sub menu structure

getMenuNavigation

public java.lang.StringBuffer getMenuNavigation(java.util.List curNav,
                                                java.lang.String styleClass,
                                                java.lang.String prefix,
                                                int currentDepth,
                                                java.lang.String menuIndexes)
This method builds a complete menu navigation with entries of all branches from the specified folder.

Parameters:
curNav - the List of current navigation elements
styleClass - the CSS class name of the <div> nodes
prefix - the prefix to generate the unique menu node id.
currentDepth - the depth of the current submenu
menuIndexes - String representing the menu indexes in the manual XML configuration, if null, no manual configuration is used
Returns:
the HTML to generate menu entries

getNavLeftElementUri

public java.lang.String getNavLeftElementUri()
Returns the URI of the page element to include on the left navigation.

Returns:
the URI of the page element to include on the left navigation

getResourcePath

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

Returns:
the substituted path to the modules resource folder

getStartFolder

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

Returns:
the start folder for navigation and search results

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

messages

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

Returns:
the initialized CmsMessages object

setHeadNavItemDefaultValue

public void setHeadNavItemDefaultValue(boolean defaultValue)
Sets the default value of the property style_head_nav_showitem in case the property is not set.

Parameters:
defaultValue - if true, all resources without property value are included in head menu, if false, vice versa

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

showHeadNavImages

public boolean showHeadNavImages()
Returns if the head navigation should use images for the 1st navigation level.

Returns:
true if the head navigation should use images for the 1st navigation level, otherwise false

showMenus

public boolean showMenus()
Returns if the second level navigation menus of the head navigation should be shown.

Returns:
true if the second level navigation menus of the head navigation should be shown

showNavLeftElement

public boolean showNavLeftElement()
Returns true if the left navigation include element should be shown.

Returns:
true if the left navigation include element should be shown

showNavLeftSelected

public boolean showNavLeftSelected()
Returns true if the left navigation follows the selection in the head navigation menu.

Returns:
true if the left navigation follows the selection in the head navigation menu

showNavLeftTree

public boolean showNavLeftTree()
Returns true if the left navigation tree should be displayed.

Returns:
true if the left navigation tree should be displayed